aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Derrick <jonathan.derrick@intel.com>2016-08-29 13:19:01 -0400
committerBjorn Helgaas <bhelgaas@google.com>2016-09-19 14:14:05 -0400
commitc68db51589052ef9adee4dd699462681737849a2 (patch)
tree12af9daa5a8c40032daf3e55a3dc7d76ea199a6a
parent4fe0d154880bb6eb833cbe84fa6f385f400f0b9c (diff)
x86/PCI: VMD: Allocate IRQ lists with correct MSI-X count
To reduce the amount of memory required for IRQ lists, only allocate their space after calling pci_msix_enable_range() which may reduce the number of MSI-X vectors allocated. Signed-off-by: Jon Derrick <jonathan.derrick@intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Keith Busch <keith.busch@intel.com>
-rw-r--r--arch/x86/pci/vmd.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/arch/x86/pci/vmd.c b/arch/x86/pci/vmd.c
index b814ca675131..7a8538da6289 100644
--- a/arch/x86/pci/vmd.c
+++ b/arch/x86/pci/vmd.c
@@ -671,11 +671,6 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id)
671 if (vmd->msix_count < 0) 671 if (vmd->msix_count < 0)
672 return -ENODEV; 672 return -ENODEV;
673 673
674 vmd->irqs = devm_kcalloc(&dev->dev, vmd->msix_count, sizeof(*vmd->irqs),
675 GFP_KERNEL);
676 if (!vmd->irqs)
677 return -ENOMEM;
678
679 vmd->msix_entries = devm_kcalloc(&dev->dev, vmd->msix_count, 674 vmd->msix_entries = devm_kcalloc(&dev->dev, vmd->msix_count,
680 sizeof(*vmd->msix_entries), 675 sizeof(*vmd->msix_entries),
681 GFP_KERNEL); 676 GFP_KERNEL);
@@ -689,6 +684,11 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id)
689 if (vmd->msix_count < 0) 684 if (vmd->msix_count < 0)
690 return vmd->msix_count; 685 return vmd->msix_count;
691 686
687 vmd->irqs = devm_kcalloc(&dev->dev, vmd->msix_count, sizeof(*vmd->irqs),
688 GFP_KERNEL);
689 if (!vmd->irqs)
690 return -ENOMEM;
691
692 for (i = 0; i < vmd->msix_count; i++) { 692 for (i = 0; i < vmd->msix_count; i++) {
693 INIT_LIST_HEAD(&vmd->irqs[i].irq_list); 693 INIT_LIST_HEAD(&vmd->irqs[i].irq_list);
694 vmd->irqs[i].vmd_vector = vmd->msix_entries[i].vector; 694 vmd->irqs[i].vmd_vector = vmd->msix_entries[i].vector;