Hi,

I am running the KVM kernel & userspace downloaded on 4/24 with Fedora 10 host 
Linux on a Dell T7400 Xeon with VT-x and VT-d enabled. The T7400 has an onboard 
Broadcom NIC, but when I use VT-d to assign this NIC to a Fedora 10 guest, the 
NIC's tg3 driver in the guest aborts because it cannot find the PM Capability 
in the device's PCI config space.

Here is the lspci config space for the NIC on the host Linux:

00: e4 14 7a 16 00 00 10 00 02 00 00 02 10 00 00 00
10: 04 00 ef f7 00 00 00 00 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 28 10 1d 02
30: 00 00 00 00 48 00 00 00 00 00 00 00 0b 01 00 00
                ^^  Cap List Pointer
40: 00 00 00 00 00 00 00 00 01 50 03 c0 08 20 00 64
                            ^^ ^^  1st Cap List entry, type 0x01=PM
50: 03 58 e0 00 00 00 00 00 09 e8 78 00 47 68 89 8a
60: 00 00 00 00 00 00 00 00 00 00 02 b0 00 00 00 10
70: 12 12 00 00 a0 00 00 00 00 00 00 00 00 00 00 00
80: 00 00 00 00 00 00 00 00 00 00 00 00 82 90 08 24
90: 21 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0: 00 00 00 00 00 00 00 00 0e 00 00 00 00 00 00 00
d0: 10 00 01 00 a0 8f 00 00 06 20 11 00 11 64 03 00
e0: 40 01 11 10 00 00 00 00 05 d0 80 00 0c f0 e0 fe
                            ^^ 4th Cap List entry, type 0x05=MSI
f0: 00 00 00 00 72 41 00 00 00 00 00 00 00 00 00 00


Here is the lspci config space for the NIC in the guest Linux. Note that the 
Capabilities List Pointer at offset 0x34 is now 0x40, which points to a 
Capabilities List with only one entry, of type 0x05 (MSI Interrupt):

00: e4 14 7a 16 00 04 10 00 02 00 00 02 10 00 00 00
10: 00 00 01 f2 00 00 00 00 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 28 10 1d 02
30: 00 00 00 00 40 00 00 00 00 00 00 00 0a 01 00 00
                ^^ Cap List Pointer
40: 05 00 00 00 00 00 00 00 00 00 00 00 08 20 00 64
    ^^ ^^ 1st (and only) Cap List entry, type 0x05=MSI
50: 03 58 e0 00 00 00 00 00 09 e8 78 00 48 6a 89 ba
60: 00 00 00 00 00 00 00 00 00 00 02 b0 00 00 00 10
70: 12 12 00 00 a0 00 00 00 00 00 00 00 00 00 00 00
80: 00 00 00 00 00 00 00 00 00 00 00 00 82 90 08 24
90: 21 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0: 00 00 00 00 00 00 00 00 0e 00 00 00 00 00 00 00
d0: 10 00 01 00 a0 8f 00 00 06 20 11 00 11 64 03 00
e0: 40 01 11 10 00 00 00 00 05 d0 81 00 0c f0 e0 fe
f0: 00 00 00 00 52 41 00 00 00 00 00 00 00 00 00 00


The issue is that the virtualized config space in the guest does not contain 
the complete Capability List.  It looks like QEMU only creates the MSI/MSI-X 
capabilities and leaves out any others.  However this causes the guest's tg3 
driver to abort because it expects to find the device's PM capabilities.  Here 
is the abort code from tg3:

    /* Find power-management capability. */
    pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
    if (pm_cap == 0) {
        printk(KERN_ERR PFX "Cannot find PowerManagement capability, "
            "aborting.\n");
        err = -EIO;
        goto err_out_free_res;
    }

FWIW under Xen the tg3 driver runs fine as-is and the passthru for this NIC 
works without issue.

So has anyone else seen this, and what is the right way to address it?  It's 
not good to simply pass thru certain device Capabilities if they cannot be 
properly handled by KVM/QEMU, but OTOH the unmodified guest OS drivers should 
not break because they were written to expect certain Capabilities.  Is there 
any plan to add support for these missing Capabilities?

Regards,
Ed

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to