summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAlexander Gordeev <agordeev@redhat.com>2013-05-13 11:05:48 +0200
committerRichard Zhu <r65037@freescale.com>2013-11-20 14:10:30 +0800
commit840abba8d0bb6222058e479683dae674cf54d3bf (patch)
tree6681ea45c921dbd80290e4f79ff4153e91f5f171 /include
parentc169e751d3e4dbd6a65b05511d1e56ecc80644e6 (diff)
PCI: Allocate only as many MSI vectors as requested by driver
Because of the encoding of the "Multiple Message Capable" and "Multiple Message Enable" fields, a device can only advertise that it's capable of a power-of-two number of vectors, and the OS can only enable a power-of-two number. For example, a device that's limited internally to using 18 vectors would have to advertise that it's capable of 32. The 14 extra vectors consume vector numbers and IRQ descriptors even though the device can't actually use them. This fix introduces a 'msi_desc::nvec_used' field to address this issue. When non-zero, it is the actual number of MSIs the device will send, as requested by the device driver. This value should be used by architectures to set up and tear down only as many interrupt resources as the device will actually use. Note, although the existing 'msi_desc::multiple' field might seem redundant, in fact it is not. The number of MSIs advertised need not be the smallest power-of-two larger than the number of MSIs the device will send. Thus, it is not always possible to derive the former from the latter, so we need to keep them both to handle this case. [bhelgaas: changelog, rename to "nvec_used"] Signed-off-by: Alexander Gordeev <agordeev@redhat.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/msi.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 20c2d6dd5d25..ee66f3a12fb6 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -35,6 +35,7 @@ struct msi_desc {
u32 masked; /* mask bits */
unsigned int irq;
+ unsigned int nvec_used; /* number of messages */
struct list_head list;
union {