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

Re: [vfio-users] Trying to pass through USB controller.



Sorry for the delay getting back to you,

On 03/01/17 14:32, Andrew A. wrote:
Does anyone know of a sensible way to more permanently set the port
routing mask so it survives these pci resets?

Unfortunately, the xHCI controller fully controls which ports go where.
That means if you give it to the guest, since the guest driver controls
the PCI device, it controls the ports too. It's not necessarily the PCI
reset causing the switch--see for example the Linux driver:

http://lxr.free-electrons.com/source/drivers/usb/host/pci-quirks.c#L926

It moves all available ports to xHCI on powerup (including waking up
from runtime power-management). What you can try is setting the "xHC USB
2.0 Port Routing Mask Register" (section 16.1.37 in the 9 series PCH
datasheet). If you look at line 930 of the source linked above, you see
that the Linux driver only tries to switch the ports marked as
switchable. This should also work on Windows guests, as the datasheet
specifies "When set to 0, The OS shall not modify the corresponding
USB2HCSEL bit". Of course, since it's closed-source, there's no way to
know if Windows behaves properly without trying.

Masking off those ports so the OS doesn't switch them should not prevent
you from switching them manually. This also means that even if you get
the guest drivers to cooperate, a malicious application running in the
guest could take over your keyboard.

Another potential problem is that your BIOS on the host may
write-protect the mask register. In that case, see the datasheet for how
to unlock it, if possible.

Thanks for writing this up last year,

I'm glad it has been of use!

Andrew

Samuel


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