Ubuntu – Blacklist xhci_hcd

blacklistdriversvirtualization

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"
...

Best Answer

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

Related Question