Re: vfio-pci: Fix the check on pci device type in vfio_pci_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Am 01.02.2015 um 20:18 schrieb Alex Williamson:
On Sun, 2015-02-01 at 19:47 +0100, Stefan Priebe wrote:
Hi,

Am 01.02.2015 um 15:29 schrieb Alex Williamson:
On Sun, 2015-02-01 at 08:08 +0100, Stefan Priebe wrote:
Hi,

since the above mentioned patch the passthrough of my USB controllers
does not work anymore.

dmesh shows:
[   37.692394] VFIO - User Level meta-driver version: 0.3
[   37.696755] vfio-pci: probe of 0000:00:01.0 failed with error -22
[   38.688986] vfio-pci: probe of 0000:00:01.0 failed with error -22
[   38.689244] vfio-pci: probe of 0000:00:1c.0 failed with error -22
[   39.696653] vfio-pci: probe of 0000:00:01.0 failed with error -22
[   39.696749] vfio-pci: probe of 0000:00:1c.0 failed with error -22

While the text in the patch indicates that it was just a wrong check and
it should never worked. I see a different behaviour as it was working
fine before.

These are PCIe root ports, they have never been supported by vfio-pci
and it has never been correct to bind them to vfio-pci.  The IOMMU group
is considered viable with either pcieport or pci-stub bound to these
devices.  I suggest leaving them untouched and bound to pcieport.

lspci output:
02:00.0 Multimedia controller: Digital Devices GmbH Device 0005

lspci -v:
02:00.0 Multimedia controller: Digital Devices GmbH Device 0005
          Subsystem: Digital Devices GmbH Device 0004
          Flags: bus master, fast devsel, latency 0, IRQ 11
          Memory at dfa00000 (64-bit, non-prefetchable) [size=64K]
          Capabilities: [50] Power Management version 3
          Capabilities: [70] MSI: Enable- Count=1/2 Maskable- 64bit+
          Capabilities: [90] Express Endpoint, MSI 00
          Capabilities: [100] Vendor Specific Information: ID=0000 Rev=0
Len=00c <?>

WHat i'm doing now is reading the iommu group:

# ls /sys/bus/pci/devices/0000:02:00.0/iommu_group/devices/
0000:00:1c.0  0000:00:1c.4  0000:02:00.0  0000:03:00.0

Then unbind all devices in the iommu group and then bind them to
vfio-pci.

But this fails with:
[ 1544.953491] vfio-pci: probe of 0000:00:1c.0 failed with error -22

can you please tell me what's wrong?

Devices 0000:00:1c.x are PCIe root ports, they are not supported by
vfio-pci.  Only endpoint devices are supported by vfio-pci.  This has
always been the case, but due to a coding error was not enforced.
vfio-pci does not know how to manage root ports, bridges or switch
ports, does not know how to expose the device to userspace, and will not
do anything to enable the device to make use of downstream devices.
Only devices 0000:02:00.0 and 0000:03:00.0 from that group should be
bound to vfio-pci.

If you want to code this into your script, devices bound to the pcieport
driver should not be bound to vfio-pci:

# basename $(readlink -f /sys/bus/pci/devices/0000:00:1c.0/driver)
pcieport

You can also read the header directly

# setpci -s 0000:00:1c.0 HEADER_TYPE

Only type 00 or 80 are supported by vfio-pci.  You can also test whether
a "pci_bus" directory exists under the device in sysfs:

-e /sys/bus/pci/devices/0000:00:1c.0/pci_bus

This indicates that the device is some sort of bridge.

Great! Thanks! Thas was the part i'm searching for. thanks a lot.

Stefan


Thanks,

Alex

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]