Commit c68db515 authored by Jon Derrick's avatar Jon Derrick Committed by Bjorn Helgaas

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: default avatarJon Derrick <jonathan.derrick@intel.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarKeith Busch <keith.busch@intel.com>
parent 4fe0d154
...@@ -671,11 +671,6 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -671,11 +671,6 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id)
if (vmd->msix_count < 0) if (vmd->msix_count < 0)
return -ENODEV; return -ENODEV;
vmd->irqs = devm_kcalloc(&dev->dev, vmd->msix_count, sizeof(*vmd->irqs),
GFP_KERNEL);
if (!vmd->irqs)
return -ENOMEM;
vmd->msix_entries = devm_kcalloc(&dev->dev, vmd->msix_count, vmd->msix_entries = devm_kcalloc(&dev->dev, vmd->msix_count,
sizeof(*vmd->msix_entries), sizeof(*vmd->msix_entries),
GFP_KERNEL); GFP_KERNEL);
...@@ -689,6 +684,11 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -689,6 +684,11 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id)
if (vmd->msix_count < 0) if (vmd->msix_count < 0)
return vmd->msix_count; return vmd->msix_count;
vmd->irqs = devm_kcalloc(&dev->dev, vmd->msix_count, sizeof(*vmd->irqs),
GFP_KERNEL);
if (!vmd->irqs)
return -ENOMEM;
for (i = 0; i < vmd->msix_count; i++) { for (i = 0; i < vmd->msix_count; i++) {
INIT_LIST_HEAD(&vmd->irqs[i].irq_list); INIT_LIST_HEAD(&vmd->irqs[i].irq_list);
vmd->irqs[i].vmd_vector = vmd->msix_entries[i].vector; vmd->irqs[i].vmd_vector = vmd->msix_entries[i].vector;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment