@@ -94,14 +94,11 @@ has a requirements for a minimum number of vectors the driver can pass a
9494min_vecs argument set to this limit, and the PCI core will return -ENOSPC
9595if it can't meet the minimum number of vectors.
9696
97- The flags argument should normally be set to 0, but can be used to pass the
98- PCI_IRQ_NOMSI and PCI_IRQ_NOMSIX flag in case a device claims to support
99- MSI or MSI-X, but the support is broken, or to pass PCI_IRQ_NOLEGACY in
100- case the device does not support legacy interrupt lines.
101-
102- By default this function will spread the interrupts around the available
103- CPUs, but this feature can be disabled by passing the PCI_IRQ_NOAFFINITY
104- flag.
97+ The flags argument is used to specify which type of interrupt can be used
98+ by the device and the driver (PCI_IRQ_LEGACY, PCI_IRQ_MSI, PCI_IRQ_MSIX).
99+ A convenient short-hand (PCI_IRQ_ALL_TYPES) is also available to ask for
100+ any possible kind of interrupt. If the PCI_IRQ_AFFINITY flag is set,
101+ pci_alloc_irq_vectors() will spread the interrupts around the available CPUs.
105102
106103To get the Linux IRQ numbers passed to request_irq() and free_irq() and the
107104vectors, use the following function:
@@ -131,7 +128,7 @@ larger than the number supported by the device it will automatically be
131128capped to the supported limit, so there is no need to query the number of
132129vectors supported beforehand:
133130
134- nvec = pci_alloc_irq_vectors(pdev, 1, nvec, 0);
131+ nvec = pci_alloc_irq_vectors(pdev, 1, nvec, PCI_IRQ_ALL_TYPES)
135132 if (nvec < 0)
136133 goto out_err;
137134
@@ -140,23 +137,22 @@ interrupts it can request a particular number of interrupts by passing that
140137number to pci_alloc_irq_vectors() function as both 'min_vecs' and
141138'max_vecs' parameters:
142139
143- ret = pci_alloc_irq_vectors(pdev, nvec, nvec, 0 );
140+ ret = pci_alloc_irq_vectors(pdev, nvec, nvec, PCI_IRQ_ALL_TYPES );
144141 if (ret < 0)
145142 goto out_err;
146143
147144The most notorious example of the request type described above is enabling
148145the single MSI mode for a device. It could be done by passing two 1s as
149146'min_vecs' and 'max_vecs':
150147
151- ret = pci_alloc_irq_vectors(pdev, 1, 1, 0 );
148+ ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES );
152149 if (ret < 0)
153150 goto out_err;
154151
155152Some devices might not support using legacy line interrupts, in which case
156- the PCI_IRQ_NOLEGACY flag can be used to fail the request if the platform
157- can't provide MSI or MSI-X interrupts:
153+ the driver can specify that only MSI or MSI-X is acceptable:
158154
159- nvec = pci_alloc_irq_vectors(pdev, 1, nvec, PCI_IRQ_NOLEGACY );
155+ nvec = pci_alloc_irq_vectors(pdev, 1, nvec, PCI_IRQ_MSI | PCI_IRQ_MSIX );
160156 if (nvec < 0)
161157 goto out_err;
162158
0 commit comments