]> xenbits.xensource.com Git - qemu-xen-4.1-testing.git/commitdiff
passthrough: support the assignment of the VF of Intel 82599 10GbE Controller
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>
Tue, 4 Aug 2009 14:28:14 +0000 (15:28 +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>
hw/pass-through.c
hw/pci.h

index fcc1bb62a6540b49ee2a07a54b280f2417ca09a7..8d807551af05ea2a7401f6237cd6f5a365364967 100644 (file)
@@ -2408,6 +2408,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)
 {
@@ -2424,6 +2443,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)
@@ -2556,6 +2578,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 30bcb04d62916bb696ae67d9d14746342e750993..de5a4e15e07e82f8dded46c28c49c1b7f677a7fb 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