From 1035bb64fd7fd9f05c510466d98566fd82e37ad9 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Fri, 23 Aug 2013 09:22:08 +0200 Subject: PCI: break MSI-X data out of struct pci_dev_info Considering that a significant share of PCI devices out there (not the least the myriad of CPU-exposed ones) don't support MSI-X at all, and that the amount of data is well beyond a handful of bytes, break this out of the common structure, at once allowing the actual data to be tracked to become architecture specific. Signed-off-by: Jan Beulich Acked-by: Keir Fraser --- xen/drivers/passthrough/pci.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'xen/drivers') diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index f2756c954a..b488e2ae18 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -179,8 +179,22 @@ static struct pci_dev *alloc_pdev(struct pci_seg *pseg, u8 bus, u8 devfn) *((u8*) &pdev->devfn) = devfn; pdev->domain = NULL; INIT_LIST_HEAD(&pdev->msi_list); + + if ( pci_find_cap_offset(pseg->nr, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), + PCI_CAP_ID_MSIX) ) + { + struct arch_msix *msix = xzalloc(struct arch_msix); + + if ( !msix ) + { + xfree(pdev); + return NULL; + } + spin_lock_init(&msix->table_lock); + pdev->msix = msix; + } + list_add(&pdev->alldevs_list, &pseg->alldevs_list); - spin_lock_init(&pdev->msix_table_lock); /* update bus2bridge */ switch ( pdev->type = pdev_type(pseg->nr, bus, devfn) ) @@ -277,6 +291,7 @@ static void free_pdev(struct pci_seg *pseg, struct pci_dev *pdev) } list_del(&pdev->alldevs_list); + xfree(pdev->msix); xfree(pdev); } -- cgit v1.2.3