From: Yu Zhao Subject: PCIe 2.0, VT-d and Intel 82576 enhancement for Xen SR-IOV Date: Thu, 19 Mar 2009 16:38:38 +0800 Message-ID: <20090319083838.GB23515@yzhao-otc.sh.intel.com> References: <20090313032915.GA19927@yzhao-otc.sh.intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="BOKacYhQ+x31HxR3" Return-path: Content-Disposition: inline In-Reply-To: <20090313032915.GA19927@yzhao-otc.sh.intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" Cc: "keir.fraser@eu.citrix.com" List-Id: xen-devel@lists.xenproject.org --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Greetings, Following patches enhance the VT-d and PCI code, and add a quirk for Intel 82576 SR-IOV NIC, so they can work better with the SR-IOV core. PCI: pass ARI and SR-IOV device information to the hypervisor PCI: add a SR-IOV quirk for Intel 82576 NIC PCI: save and restore PCIe 2.0 registers drivers/pci/pci.c | 11 +++++++ drivers/pci/quirks.c | 57 ++++++++++++++++++++++++++++++++++++++++ drivers/xen/core/pci.c | 27 ++++++++++++++++-- include/linux/pci_regs.h | 2 + include/xen/interface/physdev.h | 16 +++++++++++ 5 files changed, 109 insertions(+), 4 deletions(-) Xen: use proper device ID to search VT-d unit for ARI and SR-IOV device arch/ia64/xen/hypercall.c | 22 +++++++++++++++++++ arch/x86/physdev.c | 22 +++++++++++++++++++ drivers/passthrough/pci.c | 41 +++++++++++++++++++++++++++++++++++++ drivers/passthrough/vtd/dmar.c | 14 +++++++++++- drivers/passthrough/vtd/dmar.h | 2 - drivers/passthrough/vtd/intremap.c | 4 +-- drivers/passthrough/vtd/iommu.c | 14 +++++++++--- include/public/physdev.h | 16 ++++++++++++++ include/xen/pci.h | 11 +++++++++ 9 files changed, 138 insertions(+), 8 deletions(-) --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="dom0-pci.patch" # HG changeset patch # User Yu Zhao # Date 1237441331 14400 # Node ID a5d36fbbdea4c1fa0b925689834cf6775066f6f1 # Parent 4839e34e67952b540fa258811324a85ace7feb79 PCI: pass ARI and SR-IOV device information to the hypervisor PCIe Alternative Routing-ID Interpretation (ARI) ECN defines the Extended Function -- a function whose function number is greater than 7 within an ARI Device. Intel VT-d spec 1.2 section 8.3.2 specifies that the Extended Function is under the scope of the same remapping unit as the traditional function. The hypervisor needs to know if a function is Extended Function so it can find proper DMAR for it. And section 8.3.3 specifies that the SR-IOV Virtual Function is under the scope of the same remapping unit as the Physical Function. The hypervisor also needs to know if a function is the Virtual Function and which Physical Function it's associated with for same reason. Signed-off-by: Yu Zhao diff -r 4839e34e6795 -r a5d36fbbdea4 drivers/xen/core/pci.c --- a/drivers/xen/core/pci.c Wed Mar 18 15:43:57 2009 +0000 +++ b/drivers/xen/core/pci.c Thu Mar 19 01:42:11 2009 -0400 @@ -6,6 +6,7 @@ #include #include #include +#include "../../pci/pci.h" static int (*pci_bus_probe)(struct device *dev); static int (*pci_bus_remove)(struct device *dev); @@ -15,10 +16,30 @@ int r; struct pci_dev *pci_dev = to_pci_dev(dev); struct physdev_manage_pci manage_pci; - manage_pci.bus = pci_dev->bus->number; - manage_pci.devfn = pci_dev->devfn; + struct physdev_manage_pci_ext manage_pci_ext; - r = HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_add, &manage_pci); + if (pci_dev->is_virtfn) { + memset(&manage_pci_ext, 0, sizeof(manage_pci_ext)); + manage_pci_ext.bus = pci_dev->bus->number; + manage_pci_ext.devfn = pci_dev->devfn; + manage_pci_ext.is_virtfn = 1; + manage_pci_ext.physfn.bus = pci_dev->physfn->bus->number; + manage_pci_ext.physfn.devfn = pci_dev->physfn->devfn; + r = HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_add_ext, + &manage_pci_ext); + } else if (pci_ari_enabled(pci_dev->bus) && PCI_SLOT(pci_dev->devfn)) { + memset(&manage_pci_ext, 0, sizeof(manage_pci_ext)); + manage_pci_ext.bus = pci_dev->bus->number; + manage_pci_ext.devfn = pci_dev->devfn; + manage_pci_ext.is_extfn = 1; + r = HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_add_ext, + &manage_pci_ext); + } else { + manage_pci.bus = pci_dev->bus->number; + manage_pci.devfn = pci_dev->devfn; + r = HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_add, + &manage_pci); + } if (r && r != -ENOSYS) return r; diff -r 4839e34e6795 -r a5d36fbbdea4 include/xen/interface/physdev.h --- a/include/xen/interface/physdev.h Wed Mar 18 15:43:57 2009 +0000 +++ b/include/xen/interface/physdev.h Thu Mar 19 01:42:11 2009 -0400 @@ -192,6 +192,22 @@ typedef struct physdev_restore_msi physdev_restore_msi_t; DEFINE_XEN_GUEST_HANDLE(physdev_restore_msi_t); +#define PHYSDEVOP_manage_pci_add_ext 20 +struct physdev_manage_pci_ext { + /* IN */ + uint8_t bus; + uint8_t devfn; + unsigned is_extfn; + unsigned is_virtfn; + struct { + uint8_t bus; + uint8_t devfn; + } physfn; +}; + +typedef struct physdev_manage_pci_ext physdev_manage_pci_ext_t; +DEFINE_XEN_GUEST_HANDLE(physdev_manage_pci_ext_t); + /* * Argument to physdev_op_compat() hypercall. Superceded by new physdev_op() * hypercall since 0x00030202. --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="dom0-s3.patch" # HG changeset patch # User Yu Zhao # Date 1237442468 14400 # Node ID 2bd960a6fe028119867357f0d99f3388d7a14047 # Parent a5d36fbbdea4c1fa0b925689834cf6775066f6f1 PCI: save and restore PCIe 2.0 registers PCIe 2.0 defines several new registers (Device Control 2, Link Control 2, and Slot Control 2). Save and retore them in pci_save_pcie_state() and pci_restore_pcie_state(). Signed-off-by: Yu Zhao diff -r a5d36fbbdea4 -r 2bd960a6fe02 drivers/pci/pci.c --- a/drivers/pci/pci.c Thu Mar 19 01:42:11 2009 -0400 +++ b/drivers/pci/pci.c Thu Mar 19 02:01:08 2009 -0400 @@ -428,6 +428,8 @@ EXPORT_SYMBOL(pci_choose_state); +#define PCI_EXP_SAVE_REGS 7 + static int pci_save_pcie_state(struct pci_dev *dev) { int pos, i = 0; @@ -449,6 +451,9 @@ pci_read_config_word(dev, pos + PCI_EXP_LNKCTL, &cap[i++]); pci_read_config_word(dev, pos + PCI_EXP_SLTCTL, &cap[i++]); pci_read_config_word(dev, pos + PCI_EXP_RTCTL, &cap[i++]); + pci_read_config_word(dev, pos + PCI_EXP_DEVCTL2, &cap[i++]); + pci_read_config_word(dev, pos + PCI_EXP_LNKCTL2, &cap[i++]); + pci_read_config_word(dev, pos + PCI_EXP_SLTCTL2, &cap[i++]); return 0; } @@ -469,6 +474,9 @@ pci_write_config_word(dev, pos + PCI_EXP_LNKCTL, cap[i++]); pci_write_config_word(dev, pos + PCI_EXP_SLTCTL, cap[i++]); pci_write_config_word(dev, pos + PCI_EXP_RTCTL, cap[i++]); + pci_write_config_word(dev, pos + PCI_EXP_DEVCTL2, cap[i++]); + pci_write_config_word(dev, pos + PCI_EXP_LNKCTL2, cap[i++]); + pci_write_config_word(dev, pos + PCI_EXP_SLTCTL2, cap[i++]); } @@ -739,7 +747,8 @@ { int error; - error = pci_add_cap_save_buffer(dev, PCI_CAP_ID_EXP, 4 * sizeof(u16)); + error = pci_add_cap_save_buffer(dev, PCI_CAP_ID_EXP, + PCI_EXP_SAVE_REGS * sizeof(u16)); if (error) dev_err(&dev->dev, "unable to preallocate PCI Express save buffer\n"); diff -r a5d36fbbdea4 -r 2bd960a6fe02 include/linux/pci_regs.h --- a/include/linux/pci_regs.h Thu Mar 19 01:42:11 2009 -0400 +++ b/include/linux/pci_regs.h Thu Mar 19 02:01:08 2009 -0400 @@ -383,6 +383,8 @@ #define PCI_EXP_DEVCAP2_ARI 0x20 /* Alternative Routing-ID */ #define PCI_EXP_DEVCTL2 40 /* Device Control 2 */ #define PCI_EXP_DEVCTL2_ARI 0x20 /* Alternative Routing-ID */ +#define PCI_EXP_LNKCTL2 48 /* Link Control 2 */ +#define PCI_EXP_SLTCTL2 56 /* Slot Control 2 */ /* Extended Capabilities (PCI-X 2.0 and Express) */ #define PCI_EXT_CAP_ID(header) (header & 0x0000ffff) --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="dom0-quirk.patch" # HG changeset patch # User Yu Zhao # Date 1237445637 14400 # Node ID cdfa79a9463c46ac99b4ce543c86951cfbc40c43 # Parent 2bd960a6fe028119867357f0d99f3388d7a14047 PCI: add a SR-IOV quirk for Intel 82576 NIC If BIOS doesn't allocate resources for VF BARs, zero Flash BAR and program VF BARs to use the old Flash Memory Space. Please refer to Intel 82576 Gigabit Ethernet Controller Datasheet section 7.9.2.14.2 for details. http://download.intel.com/design/network/datashts/82576_Datasheet.pdf Signed-off-by: Yu Zhao diff -r 2bd960a6fe02 -r cdfa79a9463c drivers/pci/quirks.c --- a/drivers/pci/quirks.c Thu Mar 19 02:01:08 2009 -0400 +++ b/drivers/pci/quirks.c Thu Mar 19 02:53:57 2009 -0400 @@ -1747,3 +1747,60 @@ #ifdef CONFIG_HOTPLUG EXPORT_SYMBOL(pci_fixup_device); #endif + +#ifdef CONFIG_PCI_IOV +/* + * If BIOS doesn't allocate resources for SR-IOV BARs, zero Flash BAR + * and program SR-IOV BARs to use the old Flash Memory Space. + * PCI subsystem may try to allocate Memory Space for Flash BAR later, + * that's why we don't clear Flash BAR flags. + */ +static void __devinit intel_82576_quirk(struct pci_dev *dev) +{ + int i, flags; + u32 bar, start, size; + + if (PAGE_SIZE > 0x10000) + return; + + if (pci_read_config_dword(dev, 0x184, &bar)) + return; + + if (bar & PCI_BASE_ADDRESS_MEM_MASK) + return; + + i = 1; + flags = pci_resource_flags(dev, i); + if ((flags & PCI_BASE_ADDRESS_SPACE) == + PCI_BASE_ADDRESS_SPACE_MEMORY && + (flags & PCI_BASE_ADDRESS_MEM_TYPE_MASK) == + PCI_BASE_ADDRESS_MEM_TYPE_32) + goto found; + + i = 2; + flags = pci_resource_flags(dev, i); + if ((flags & PCI_BASE_ADDRESS_SPACE) == + PCI_BASE_ADDRESS_SPACE_MEMORY && + (flags & PCI_BASE_ADDRESS_MEM_TYPE_MASK) == + PCI_BASE_ADDRESS_MEM_TYPE_64) + goto found; + + return; +found: + start = pci_resource_start(dev, i); + size = pci_resource_len(dev, i); + if (!start || size != 0x400000 || start & (size - 1)) + return; + + pci_write_config_dword(dev, 0x10 + i * 4, 0); + pci_resource_start(dev, i) = 0; + pci_resource_end(dev, i) = size - 1; + pci_write_config_dword(dev, 0x184, start); + pci_write_config_dword(dev, 0x190, start + size / 2); + + dev_info(&dev->dev, "use Flash Memory Space for SR-IOV BARs\n"); +} +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10c9, intel_82576_quirk); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10e6, intel_82576_quirk); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10e7, intel_82576_quirk); +#endif /* CONFIG_PCI_IOV */ --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="xen.patch" # HG changeset patch # User Yu Zhao # Date 1237441166 14400 # Node ID 1e79dfa07877236ce5abcc61b916c8b5a67cb2c3 # Parent 2039e82710512f2b4b45f83cf4cdb3b037bf0d7c Xen: use proper device ID to search VT-d unit for ARI and SR-IOV device PCIe Alternative Routing-ID Interpretation (ARI) ECN defines the Extended Function -- a function whose function number is greater than 7 within an ARI Device. Intel VT-d spec 1.2 section 8.3.2 specifies that the Extended Function is under the scope of the same remapping unit as the traditional function. The hypervisor needs to know if a function is Extended Function so it can find proper DMAR for it. And section 8.3.3 specifies that the SR-IOV Virtual Function is under the scope of the same remapping unit as the Physical Function. The hypervisor also needs to know if a function is the Virtual Function and which Physical Function it's associated with for same reason. Signed-off-by: Yu Zhao diff -r 2039e8271051 -r 1e79dfa07877 xen/arch/ia64/xen/hypercall.c --- a/xen/arch/ia64/xen/hypercall.c Wed Mar 18 17:30:13 2009 +0000 +++ b/xen/arch/ia64/xen/hypercall.c Thu Mar 19 01:39:26 2009 -0400 @@ -674,6 +674,28 @@ break; } + case PHYSDEVOP_manage_pci_add_ext: { + struct physdev_manage_pci_ext manage_pci_ext; + struct pci_dev_info pdev_info; + + ret = -EPERM; + if ( !IS_PRIV(current->domain) ) + break; + + ret = -EFAULT; + if ( copy_from_guest(&manage_pci_ext, arg, 1) != 0 ) + break; + + pdev_info.is_extfn = manage_pci_ext.is_extfn; + pdev_info.is_virtfn = manage_pci_ext.is_virtfn; + pdev_info.physfn.bus = manage_pci_ext.physfn.bus; + pdev_info.physfn.devfn = manage_pci_ext.physfn.devfn; + ret = pci_add_device_ext(manage_pci_ext.bus, + manage_pci_ext.devfn, + &pdev_info); + break; + } + default: ret = -ENOSYS; printk("not implemented do_physdev_op: %d\n", cmd); diff -r 2039e8271051 -r 1e79dfa07877 xen/arch/x86/physdev.c --- a/xen/arch/x86/physdev.c Wed Mar 18 17:30:13 2009 +0000 +++ b/xen/arch/x86/physdev.c Thu Mar 19 01:39:26 2009 -0400 @@ -421,6 +421,28 @@ break; } + case PHYSDEVOP_manage_pci_add_ext: { + struct physdev_manage_pci_ext manage_pci_ext; + struct pci_dev_info pdev_info; + + ret = -EPERM; + if ( !IS_PRIV(current->domain) ) + break; + + ret = -EFAULT; + if ( copy_from_guest(&manage_pci_ext, arg, 1) != 0 ) + break; + + pdev_info.is_extfn = manage_pci_ext.is_extfn; + pdev_info.is_virtfn = manage_pci_ext.is_virtfn; + pdev_info.physfn.bus = manage_pci_ext.physfn.bus; + pdev_info.physfn.devfn = manage_pci_ext.physfn.devfn; + ret = pci_add_device_ext(manage_pci_ext.bus, + manage_pci_ext.devfn, + &pdev_info); + break; + } + case PHYSDEVOP_restore_msi: { struct physdev_restore_msi restore_msi; struct pci_dev *pdev; diff -r 2039e8271051 -r 1e79dfa07877 xen/drivers/passthrough/pci.c --- a/xen/drivers/passthrough/pci.c Wed Mar 18 17:30:13 2009 +0000 +++ b/xen/drivers/passthrough/pci.c Thu Mar 19 01:39:26 2009 -0400 @@ -143,6 +143,47 @@ return ret; } +int pci_add_device_ext(u8 bus, u8 devfn, struct pci_dev_info *info) +{ + int ret; + char *pdev_type; + struct pci_dev *pdev; + + if (info->is_extfn) + pdev_type = "Extended Function"; + else if (info->is_virtfn) + pdev_type = "Virtual Function"; + else + return -EINVAL;; + + + ret = -ENOMEM; + spin_lock(&pcidevs_lock); + pdev = alloc_pdev(bus, devfn); + if ( !pdev ) + goto out; + + pdev->info = *info; + + ret = 0; + if ( !pdev->domain ) + { + pdev->domain = dom0; + ret = iommu_add_device(pdev); + if ( ret ) + goto out; + + list_add(&pdev->domain_list, &dom0->arch.pdev_list); + } + +out: + spin_unlock(&pcidevs_lock); + printk(XENLOG_DEBUG "PCI add %s %02x:%02x.%x\n", pdev_type, + bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); + + return ret; +} + static void pci_clean_dpci_irqs(struct domain *d) { struct hvm_irq_dpci *hvm_irq_dpci = NULL; diff -r 2039e8271051 -r 1e79dfa07877 xen/drivers/passthrough/vtd/dmar.c --- a/xen/drivers/passthrough/vtd/dmar.c Wed Mar 18 17:30:13 2009 +0000 +++ b/xen/drivers/passthrough/vtd/dmar.c Thu Mar 19 01:39:26 2009 -0400 @@ -152,11 +152,23 @@ return 0; } -struct acpi_drhd_unit * acpi_find_matched_drhd_unit(u8 bus, u8 devfn) +struct acpi_drhd_unit * acpi_find_matched_drhd_unit(struct pci_dev *pdev) { + u8 bus, devfn; struct acpi_drhd_unit *drhd; struct acpi_drhd_unit *found = NULL, *include_all = NULL; int i; + + if (pdev->info.is_extfn) { + bus = pdev->bus; + devfn = 0; + } else if (pdev->info.is_virtfn) { + bus = pdev->info.physfn.bus; + devfn = PCI_SLOT(pdev->info.physfn.devfn) ? 0 : pdev->info.physfn.devfn; + } else { + bus = pdev->bus; + devfn = pdev->devfn; + } list_for_each_entry ( drhd, &acpi_drhd_units, list ) { diff -r 2039e8271051 -r 1e79dfa07877 xen/drivers/passthrough/vtd/dmar.h --- a/xen/drivers/passthrough/vtd/dmar.h Wed Mar 18 17:30:13 2009 +0000 +++ b/xen/drivers/passthrough/vtd/dmar.h Thu Mar 19 01:39:26 2009 -0400 @@ -79,7 +79,7 @@ for (idx = 0; (bdf = rmrr->scope.devices[idx]) && \ idx < rmrr->scope.devices_cnt; idx++) -struct acpi_drhd_unit * acpi_find_matched_drhd_unit(u8 bus, u8 devfn); +struct acpi_drhd_unit * acpi_find_matched_drhd_unit(struct pci_dev *pdev); struct acpi_atsr_unit * acpi_find_matched_atsr_unit(u8 bus, u8 devfn); void dmar_scope_add_buses(struct dmar_scope *scope, u16 sec, u16 sub); void dmar_scope_remove_buses(struct dmar_scope *scope, u16 sec, u16 sub); diff -r 2039e8271051 -r 1e79dfa07877 xen/drivers/passthrough/vtd/intremap.c --- a/xen/drivers/passthrough/vtd/intremap.c Wed Mar 18 17:30:13 2009 +0000 +++ b/xen/drivers/passthrough/vtd/intremap.c Thu Mar 19 01:39:26 2009 -0400 @@ -450,7 +450,7 @@ struct iommu *iommu = NULL; struct ir_ctrl *ir_ctrl; - drhd = acpi_find_matched_drhd_unit(pdev->bus, pdev->devfn); + drhd = acpi_find_matched_drhd_unit(pdev); iommu = drhd->iommu; ir_ctrl = iommu_ir_ctrl(iommu); @@ -468,7 +468,7 @@ struct iommu *iommu = NULL; struct ir_ctrl *ir_ctrl; - drhd = acpi_find_matched_drhd_unit(pdev->bus, pdev->devfn); + drhd = acpi_find_matched_drhd_unit(pdev); iommu = drhd->iommu; ir_ctrl = iommu_ir_ctrl(iommu); diff -r 2039e8271051 -r 1e79dfa07877 xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Wed Mar 18 17:30:13 2009 +0000 +++ b/xen/drivers/passthrough/vtd/iommu.c Thu Mar 19 01:39:26 2009 -0400 @@ -1193,8 +1193,11 @@ u16 sec_bus, sub_bus; u32 type; u8 secbus, secdevfn; + struct pci_dev *pdev = pci_get_pdev(bus, devfn); - drhd = acpi_find_matched_drhd_unit(bus, devfn); + BUG_ON(!pdev); + + drhd = acpi_find_matched_drhd_unit(pdev); if ( !drhd ) return -ENODEV; @@ -1319,8 +1322,11 @@ int ret = 0; u32 type; u8 secbus, secdevfn; + struct pci_dev *pdev = pci_get_pdev(bus, devfn); - drhd = acpi_find_matched_drhd_unit(bus, devfn); + BUG_ON(!pdev); + + drhd = acpi_find_matched_drhd_unit(pdev); if ( !drhd ) return -ENODEV; @@ -1392,7 +1398,7 @@ if (!pdev) return -ENODEV; - drhd = acpi_find_matched_drhd_unit(bus, devfn); + drhd = acpi_find_matched_drhd_unit(pdev); pdev_iommu = drhd->iommu; domain_context_unmap(source, bus, devfn); @@ -1405,7 +1411,7 @@ for_each_pdev ( source, pdev ) { - drhd = acpi_find_matched_drhd_unit(pdev->bus, pdev->devfn); + drhd = acpi_find_matched_drhd_unit(pdev); if ( drhd->iommu == pdev_iommu ) { found = 1; diff -r 2039e8271051 -r 1e79dfa07877 xen/include/public/physdev.h --- a/xen/include/public/physdev.h Wed Mar 18 17:30:13 2009 +0000 +++ b/xen/include/public/physdev.h Thu Mar 19 01:39:26 2009 -0400 @@ -183,6 +183,22 @@ typedef struct physdev_manage_pci physdev_manage_pci_t; DEFINE_XEN_GUEST_HANDLE(physdev_manage_pci_t); +#define PHYSDEVOP_manage_pci_add_ext 20 +struct physdev_manage_pci_ext { + /* IN */ + uint8_t bus; + uint8_t devfn; + unsigned is_extfn; + unsigned is_virtfn; + struct { + uint8_t bus; + uint8_t devfn; + } physfn; +}; + +typedef struct physdev_manage_pci_ext physdev_manage_pci_ext_t; +DEFINE_XEN_GUEST_HANDLE(physdev_manage_pci_ext_t); + #define PHYSDEVOP_restore_msi 19 struct physdev_restore_msi { /* IN */ diff -r 2039e8271051 -r 1e79dfa07877 xen/include/xen/pci.h --- a/xen/include/xen/pci.h Wed Mar 18 17:30:13 2009 +0000 +++ b/xen/include/xen/pci.h Thu Mar 19 01:39:26 2009 -0400 @@ -31,6 +31,15 @@ #define MAX_MSIX_TABLE_ENTRIES 2048 #define MAX_MSIX_TABLE_PAGES 8 +struct pci_dev_info { + unsigned is_extfn; + unsigned is_virtfn; + struct { + u8 bus; + u8 devfn; + } physfn; +}; + struct pci_dev { struct list_head alldevs_list; struct list_head domain_list; @@ -43,6 +52,7 @@ struct domain *domain; const u8 bus; const u8 devfn; + struct pci_dev_info info; }; #define for_each_pdev(domain, pdev) \ @@ -64,6 +74,7 @@ void pci_release_devices(struct domain *d); int pci_add_device(u8 bus, u8 devfn); int pci_remove_device(u8 bus, u8 devfn); +int pci_add_device_ext(u8 bus, u8 devfn, struct pci_dev_info *info); struct pci_dev *pci_get_pdev(int bus, int devfn); struct pci_dev *pci_get_pdev_by_domain(struct domain *d, int bus, int devfn); --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --BOKacYhQ+x31HxR3--