]> xenbits.xensource.com Git - qemu-xen-3.4-testing.git/commitdiff
passthrough: support the assignment of the VF of Intel 82599 10GbE Controller xen-3.4.2-rc2
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 4 Aug 2009 14:28:14 +0000 (15:28 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 23 Oct 2009 09:57:09 +0000 (10:57 +0100)
The datasheet is available at
http://download.intel.com/design/network/datashts/82599_datasheet.pdf

See 'Table 9.7. VF PCIe Configuration Space' of the datasheet, the PCI
Express Capability Structure of the VF of Intel 82599 10GbE Controller looks
trivial, e.g., the PCI Express Capabilities Register is 0, so the Capability
Version is 0 and pt_pcie_size_init() would fail.

We should not try to expose the PCIe cap of the device to guest.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
(cherry picked from commit a77dc89dde1b8b9331c0f746e34389d6a253755f)

hw/pass-through.c
hw/pci.h

index 51a39db778d0a14ed1d7d1317d364cf95ad12f25..6dd0208c435170cce580ed6c3ee184669b4e02a6 100644 (file)
@@ -2201,6 +2201,25 @@ out:
     return err;
 }
 
+/* A return value of 1 means the capability should NOT be exposed to guest. */
+static int pt_hide_dev_cap(const struct pci_dev *dev, uint8_t grp_id)
+{
+    switch (grp_id)
+    {
+    case PCI_CAP_ID_EXP:
+        /* The PCI Express Capability Structure of the VF of Intel 82599 10GbE
+         * Controller looks trivial, e.g., the PCI Express Capabilities
+         * Register is 0. We should not try to expose it to guest.
+         */
+        if (dev->vendor_id == PCI_VENDOR_ID_INTEL &&
+                dev->device_id == PCI_DEVICE_ID_INTEL_82599_VF)
+            return 1;
+        break;
+    }
+
+    return 0;
+}
+
 /* initialize emulate register group */
 static int pt_config_init(struct pt_dev *ptdev)
 {
@@ -2217,6 +2236,9 @@ static int pt_config_init(struct pt_dev *ptdev)
     {
         if (pt_emu_reg_grp_tbl[i].grp_id != 0xFF)
         {
+            if (pt_hide_dev_cap(ptdev->pci_dev, pt_emu_reg_grp_tbl[i].grp_id))
+                continue;
+
             reg_grp_offset = (uint32_t)find_cap_offset(ptdev->pci_dev,
                                  pt_emu_reg_grp_tbl[i].grp_id);
             if (!reg_grp_offset)
@@ -2349,6 +2371,8 @@ static uint32_t pt_ptr_reg_init(struct pt_dev *ptdev,
             /* check whether the next capability
              * should be exported to guest or not
              */
+            if (pt_hide_dev_cap(ptdev->pci_dev, pt_emu_reg_grp_tbl[i].grp_id))
+                continue;
             if (pt_emu_reg_grp_tbl[i].grp_id == ptdev->dev.config[reg_field])
             {
                 if (pt_emu_reg_grp_tbl[i].grp_type == GRP_TYPE_EMU)
index ee13a3683c7118be04464e9056ab1715366a28f4..a09ca5c168b387e0bec99e67b9f77694d510167a 100644 (file)
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -112,6 +112,7 @@ extern target_phys_addr_t pci_mem_base;
 #define PCI_DEVICE_ID_INTEL_82371AB      0x7111
 #define PCI_DEVICE_ID_INTEL_82371AB_2    0x7112
 #define PCI_DEVICE_ID_INTEL_82371AB_3    0x7113
+#define PCI_DEVICE_ID_INTEL_82599_VF     0x10ed
 
 #define PCI_VENDOR_ID_FSL                0x1957
 #define PCI_DEVICE_ID_FSL_E500           0x0030