aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 19:31:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 19:31:35 -0400
commit862f0012549110d6f2586bf54b52ed4540cbff3a (patch)
tree83d29a684b885b1f58af76e0cd29b8552fd480ea /drivers/iommu
parentf991fae5c6d42dfc5029150b05a78cf3f6c18cc9 (diff)
parenta0f75f9d495b3905b4c658c1d813a127f558a350 (diff)
Merge tag 'pci-v3.11-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI changes from Bjorn Helgaas: "PCI device hotplug - Add pci_alloc_dev() interface (Gu Zheng) - Add pci_bus_get()/put() for reference counting (Jiang Liu) - Fix SR-IOV reference count issues (Jiang Liu) - Remove unused acpi_pci_roots list (Jiang Liu) MSI - Conserve interrupt resources on x86 (Alexander Gordeev) AER - Force fatal severity when component has been reset (Betty Dall) - Reset link below Root Port as well as Downstream Port (Betty Dall) - Fix "Firmware first" flag setting (Bjorn Helgaas) - Don't parse HEST for non-PCIe devices (Bjorn Helgaas) ASPM - Warn when we can't disable ASPM as driver requests (Bjorn Helgaas) Miscellaneous - Add CircuitCo PCI IDs (Darren Hart) - Add AMD CZ SATA and SMBus PCI IDs (Shane Huang) - Work around Ivytown NTB BAR size issue (Jon Mason) - Detect invalid initial BAR values (Kevin Hao) - Add pcibios_release_device() (Sebastian Ott) - Fix powerpc & sparc PCI_UNKNOWN power state usage (Bjorn Helgaas)" * tag 'pci-v3.11-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (51 commits) MAINTAINERS: Add ACPI folks for ACPI-related things under drivers/pci PCI: Add CircuitCo vendor ID and subsystem ID PCI: Use pdev->pm_cap instead of pci_find_capability(..,PCI_CAP_ID_PM) PCI: Return early on allocation failures to unindent mainline code PCI: Simplify IOV implementation and fix reference count races PCI: Drop redundant setting of bus->is_added in virtfn_add_bus() unicore32/PCI: Remove redundant call of pci_bus_add_devices() m68k/PCI: Remove redundant call of pci_bus_add_devices() PCI / ACPI / PM: Use correct power state strings in messages PCI: Fix comment typo for pcie_pme_remove() PCI: Rename pci_release_bus_bridge_dev() to pci_release_host_bridge_dev() PCI: Fix refcount issue in pci_create_root_bus() error recovery path ia64/PCI: Clean up pci_scan_root_bus() usage PCI/AER: Reset link for devices below Root Port or Downstream Port ACPI / APEI: Force fatal AER severity when component has been reset PCI/AER: Remove "extern" from function declarations PCI/AER: Move AER severity defines to aer.h PCI/AER: Set dev->__aer_firmware_first only for matching devices PCI/AER: Factor out HEST device type matching PCI/AER: Don't parse HEST table for non-PCIe devices ...
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/irq_remapping.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c
index dcfea4e39be7..39f81aeefcd6 100644
--- a/drivers/iommu/irq_remapping.c
+++ b/drivers/iommu/irq_remapping.c
@@ -51,26 +51,27 @@ static void irq_remapping_disable_io_apic(void)
51 51
52static int do_setup_msi_irqs(struct pci_dev *dev, int nvec) 52static int do_setup_msi_irqs(struct pci_dev *dev, int nvec)
53{ 53{
54 int node, ret, sub_handle, index = 0; 54 int node, ret, sub_handle, nvec_pow2, index = 0;
55 unsigned int irq; 55 unsigned int irq;
56 struct msi_desc *msidesc; 56 struct msi_desc *msidesc;
57 57
58 nvec = __roundup_pow_of_two(nvec);
59
60 WARN_ON(!list_is_singular(&dev->msi_list)); 58 WARN_ON(!list_is_singular(&dev->msi_list));
61 msidesc = list_entry(dev->msi_list.next, struct msi_desc, list); 59 msidesc = list_entry(dev->msi_list.next, struct msi_desc, list);
62 WARN_ON(msidesc->irq); 60 WARN_ON(msidesc->irq);
63 WARN_ON(msidesc->msi_attrib.multiple); 61 WARN_ON(msidesc->msi_attrib.multiple);
62 WARN_ON(msidesc->nvec_used);
64 63
65 node = dev_to_node(&dev->dev); 64 node = dev_to_node(&dev->dev);
66 irq = __create_irqs(get_nr_irqs_gsi(), nvec, node); 65 irq = __create_irqs(get_nr_irqs_gsi(), nvec, node);
67 if (irq == 0) 66 if (irq == 0)
68 return -ENOSPC; 67 return -ENOSPC;
69 68
70 msidesc->msi_attrib.multiple = ilog2(nvec); 69 nvec_pow2 = __roundup_pow_of_two(nvec);
70 msidesc->nvec_used = nvec;
71 msidesc->msi_attrib.multiple = ilog2(nvec_pow2);
71 for (sub_handle = 0; sub_handle < nvec; sub_handle++) { 72 for (sub_handle = 0; sub_handle < nvec; sub_handle++) {
72 if (!sub_handle) { 73 if (!sub_handle) {
73 index = msi_alloc_remapped_irq(dev, irq, nvec); 74 index = msi_alloc_remapped_irq(dev, irq, nvec_pow2);
74 if (index < 0) { 75 if (index < 0) {
75 ret = index; 76 ret = index;
76 goto error; 77 goto error;
@@ -95,6 +96,7 @@ error:
95 * IRQs from tearing down again in default_teardown_msi_irqs() 96 * IRQs from tearing down again in default_teardown_msi_irqs()
96 */ 97 */
97 msidesc->irq = 0; 98 msidesc->irq = 0;
99 msidesc->nvec_used = 0;
98 msidesc->msi_attrib.multiple = 0; 100 msidesc->msi_attrib.multiple = 0;
99 101
100 return ret; 102 return ret;