1

I need to passtrough a USB 3.0 controller for a VM under qemu.

My lspci -nnk is :

...
02:00.0 USB controller [0c03]: Renesas Technology Corp. uPD720201 USB 3.0 Host Controller [1912:0014] (rev 03)
    Kernel driver in use: xhci_hcd
03:00.0 USB controller [0c03]: VIA Technologies, Inc. VL805 USB 3.0 Host Controller [1106:3483] (rev 01)
    Subsystem: Gigabyte Technology Co., Ltd VL805 USB 3.0 Host Controller [1458:5007]
    Kernel driver in use: xhci_hcd
...

The one I want to passtrough is the uPD720201, it is lonely in its IOMMU group.

My vfio.conf is :

options vfio-pci ids=1002:68f9,1002:aa68,1912:0014 disable_vga=1
#Note : the 1002:68f9 and 1002:aa68 are the gpu card, which is correctly pass trough

But now the problem seems to be the xhci_hcd driver overrides the vfio driver, because it seems to be correctly loaded at boot :

$ dmesg | grep "vfio"
[    4.475492] vfio: unknown parameter 'vfio_iommu_type1' ignored
[    4.476319] vfio: unknown parameter 'vfio_virqfd' ignored
[    4.477177] vfio: unknown parameter 'vfio_pci' ignored
[    4.478023] vfio: unknown parameter 'ids' ignored
[   21.546903] vfio-pci 0000:05:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=none:owns=none
[   21.568068] vfio_pci: add [1002:68f9[ffff:ffff]] class 0x000000/00000000
[   21.588151] vfio_pci: add [1002:aa68[ffff:ffff]] class 0x000000/00000000
[   21.588824] vfio_pci: add [1912:0014[ffff:ffff]] class 0x000000/00000000
[   27.296307] vfio-pci 0000:05:00.0: vgaarb: changed VGA decodes: olddecodes=none,decodes=none:owns=none

I already try to blacklist xhci_hcd in blacklist.conf and grub :

/etc/modprobe.d/blacklist.conf
...
blacklist xhci_hcd
...

/etc/default/grub
...
GRUB_CMDLINE_LINUX_DEFAULT="amd_iommu=on iommu=pt kvm_amd.npt=1 modprobe.blacklist=xhci_hcd"
...

I have of course do a update-initramfs -u and a update-grub2 after those modifications. In all cases it has no effect, I always have "Kernel driver in use: xhci_hcd" The only way I found to disable xhci_hcd is to unbind my card by :

$ echo '0000:02:00.0' | tee /sys/bus/pci/devices/0000:02:00.0/driver/unbind

but I don't know how to execute it at boot (probably before vfio assignment).

Do you know a solution to disable xhci_hcd (or another method) to get it work?


I tried, I have this:

grub_cmd_blacklist

The command already appears but all on one line, so I just put carriage returns between them.

Now my onboard USB3 controller is disabled ( I've tried to put a USB device on it and it is realy disabled ) but not my added one.

My lspci -nnk is :

...
02:00.0 USB controller [0c03]: Renesas Technology Corp. uPD720201 USB 3.0 Host Controller [1912:0014] (rev 03)
    Kernel driver in use: xhci_hcd
03:00.0 USB controller [0c03]: VIA Technologies, Inc. VL805 USB 3.0 Host Controller [1106:3483] (rev 01)
    Subsystem: Gigabyte Technology Co., Ltd VL805 USB 3.0 Host Controller [1458:5007]
...

Note : now my grub file is (and it make what I describe above persistant) :

/etc/default/grub
...
GRUB_CMDLINE_LINUX="amd_iommu=on iommu=pt kvm_amd.npt=1"
GRUB_CMDLINE_LINUX="modprobe.blacklist=xhci_hcd"
...
karel
  • 114,770

2 Answers2

1

I finally do the choice to totally rebuild the kernel from kernel.org sources and make xhci_hcd as a loaded module and not built-in module. Now I can disable xhci_hcd by a :

modprobe -r xhci_pci
modprobe -r xhci_hcd

followed by a :

modprobe vfio
modprobe vfio_pci

Now I can attach the controller to the VM and I obtain :

lspci -nnk
...
02:00.0 USB controller [0c03]: Renesas Technology Corp. uPD720201 USB 3.0 Host Controller [1912:0014] (rev 03)
    Kernel driver in use: vfio-pci
    Kernel modules: xhci_pci
03:00.0 USB controller [0c03]: VIA Technologies, Inc. VL805 USB 3.0 Host Controller [1106:3483] (rev 01)
    Subsystem: Gigabyte Technology Co., Ltd VL805 USB 3.0 Host Controller [1458:5007]
    Kernel modules: xhci_pci
...

But unfortunately my onboard USB 3.0 controller (VL805) is disabled, so I just do a :

...
modprobe xhci_pci
modprobe xhci_hcd
...

So now both controllers works on the good machines, but it was a bit complicated

Note : all configurations in grub and blacklist.conf are useless.

  • I've been struggling with the same thing. I've tried all the grub blacklisting and . I don't have the time to recompile a kernel and install it, but I've starred your question and I'll retry this next weekend. Thanks for your helpful solution, as the xhci_pci being a builtin makes sense given my problems. I couldn't even unbind it by echoing my 0000:01:00.1 (my 2060 Super's USB controller) to the /sys/bus/pci/drivers/xhci_hcd/unbind file. I'll comment back to see if it works for me – DeepDeadpool Apr 12 '20 at 22:53
0

Can you bring up the GRUB boot menu and edit the command line options similar to what the @matsuzaki did in this post?

If so, then you may be able to add the blacklist, modprobe.blacklist=xhci_hcd, in as a parameter.

According to this post you may want to try F1 to bring up the boot menu: askubuntu.com/questions/1014626/how-to-access-grub-menu

  • Hi, thanks for your answer, I'll try this when my computer is available. So you think grub din't care about the GRUB_CMDLINE_LINUX_DEFAULT ? – strike2901 Dec 25 '19 at 19:49
  • @strike2901 that question prompted me to look more into it. You may have more luck as far as my experience goes with using the GRUB boot menu. Nonetheless there is another constant you can set called GRUB_CMDLINE_LINUX that may be more effective anyways (it seems the _DEFAULT variant only applies when you boot in 'normal' mode.) See here: https://askubuntu.com/questions/575651/what-is-the-difference-between-grub-cmdline-linux-and-grub-cmdline-linux-default – David West Dec 26 '19 at 01:52