aboutsummaryrefslogtreecommitdiffstats
path: root/xen/drivers
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2013-08-23 09:22:08 +0200
committerJan Beulich <jbeulich@suse.com>2013-08-23 09:22:08 +0200
commit1035bb64fd7fd9f05c510466d98566fd82e37ad9 (patch)
tree633b821d1480107aaa767fa1382d7510421380d6 /xen/drivers
parentb5692f2ef9b6fd67c3e7b4d4f2a4bdb1d58100e5 (diff)
downloadxen-1035bb64fd7fd9f05c510466d98566fd82e37ad9.tar.gz
xen-1035bb64fd7fd9f05c510466d98566fd82e37ad9.tar.bz2
xen-1035bb64fd7fd9f05c510466d98566fd82e37ad9.zip
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 <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/drivers')
-rw-r--r--xen/drivers/passthrough/pci.c17
1 files changed, 16 insertions, 1 deletions
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);
}