Make vfio-pci built-in or xhci_hcd optional

Bug #1770845 reported by Nazar Mokrynskyi on 2018-05-12
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Status tracked in Cosmic
Cosmic
Medium
Unassigned

Bug Description

Because of
nazar-pc@nazar-pc ~> cat '/boot/config-4.15.0-21-generic' | grep CONFIG_USB_XHCI_HCD
CONFIG_USB_XHCI_HCD=y

Following doesn't work:
nazar-pc@nazar-pc ~> cat /etc/modprobe.d/gpu-passthrough.conf
options vfio-pci ids=10de:1b06,10de:10ef,1b21:2142
softdep nouveau pre: vfio-pci
softdep xhci_hcd pre: vfio-pci

GPU is fine (first 2 IDs), but USB controller is always occupied by xhci_hcd and I can't change that while xhci_hcd is built-in.

I'd like you to resolve this issue by either embedding vfio-pci module too (prefered solution) or making xhci_hcd optional.

There are some discussions withot clean solution online like this: https://www.reddit.com/r/VFIO/comments/4o6wla/cant_get_vfiopci_to_bind_to_usb_30_card_at_boot/

ProblemType: Bug
DistroRelease: Ubuntu 18.10
Package: linux-image-4.15.0-21-generic 4.15.0-21.22
ProcVersionSignature: Ubuntu 4.15.0-21.22-generic 4.15.17
Uname: Linux 4.15.0-21-generic x86_64
AlsaVersion: Advanced Linux Sound Architecture Driver Version k4.15.0-21-generic.
ApportVersion: 2.20.10-0ubuntu2
Architecture: amd64
ArecordDevices:
 **** List of CAPTURE Hardware Devices ****
 card 1: S51 [SB Omni Surround 5.1], device 0: USB Audio [USB Audio]
   Subdevices: 0/1
   Subdevice #0: subdevice #0
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/pcmC1D0c: nazar-pc 2226 F...m pulseaudio
 /dev/snd/pcmC1D0p: nazar-pc 2226 F...m pulseaudio
 /dev/snd/controlC1: nazar-pc 2226 F.... pulseaudio
                      nazar-pc 2267 F.... volumeicon
Card1.Amixer.info:
 Card hw:1 'S51'/'Creative Technology Ltd SB Omni Surround 5.1 at usb-0000:00:14.0-9.2, full spee'
   Mixer name : 'USB Mixer'
   Components : 'USB041e:322c'
   Controls : 12
   Simple ctrls : 5
CurrentDesktop: Custom
Date: Sat May 12 16:44:11 2018
IwConfig: Error: [Errno 2] Немає такого файла або каталогу: 'iwconfig': 'iwconfig'
MachineType: Micro-Star International Co., Ltd. MS-7B45
ProcFB: 0 inteldrmfb
ProcKernelCmdLine: BOOT_IMAGE=/root/boot/vmlinuz-4.15.0-21-generic root=UUID=5170aca4-061a-4c6c-ab00-bd7fc8ae6030 ro rootflags=subvol=root nosplash intel_pstate=disable scsi_mod.use_blk_mq=1 intel_iommu=on
RelatedPackageVersions:
 linux-restricted-modules-4.15.0-21-generic N/A
 linux-backports-modules-4.15.0-21-generic N/A
 linux-firmware 1.173
RfKill: Error: [Errno 2] Немає такого файла або каталогу: 'rfkill': 'rfkill'
SourcePackage: linux
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 03/29/2018
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: A.51
dmi.board.asset.tag: Default string
dmi.board.name: Z370 GAMING PRO CARBON (MS-7B45)
dmi.board.vendor: Micro-Star International Co., Ltd.
dmi.board.version: 2.0
dmi.chassis.asset.tag: Default string
dmi.chassis.type: 3
dmi.chassis.vendor: Micro-Star International Co., Ltd.
dmi.chassis.version: 2.0
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvrA.51:bd03/29/2018:svnMicro-StarInternationalCo.,Ltd.:pnMS-7B45:pvr2.0:rvnMicro-StarInternationalCo.,Ltd.:rnZ370GAMINGPROCARBON(MS-7B45):rvr2.0:cvnMicro-StarInternationalCo.,Ltd.:ct3:cvr2.0:
dmi.product.family: Default string
dmi.product.name: MS-7B45
dmi.product.version: 2.0
dmi.sys.vendor: Micro-Star International Co., Ltd.

Nazar Mokrynskyi (nazar-pc) wrote :

This change was made by a bot.

Changed in linux (Ubuntu):
status: New → Confirmed
Changed in linux (Ubuntu):
importance: Undecided → Medium
status: Confirmed → Triaged
Nazar Mokrynskyi (nazar-pc) wrote :

What is necessary for this change to happen?
To me it looks like just changing CONFIG_VFIO_PCI=m to CONFIG_VFIO_PCI=y would be enough and I don't think this may cause any regressions.

Johannes Wüller (jwueller) wrote :

Including VFIO in the kernel would be great! This would resolve all kinds of pass-through crashes.

Currently, the only way to do this is to hope that the USB controller behaves properly during reclamation by the kernel (most of them do not), which varies wildly by vendor. In my case, it gets as bad as having the whole system hang on shutdown due to a crash in the xhci_hcd driver. The ideal solution would be the ability to pass the device through directly to a VM guest, so that no cooperation by the controller is required.

Doing bind/unbind should work just fine, as reported on that same reddit discussion. libvirt also takes care of that.

I would rather not change anything here, if those solutions work just fine.

Cascardo.

Changed in linux (Ubuntu Cosmic):
status: Triaged → Opinion
Nazar Mokrynskyi (nazar-pc) wrote :

It does, but not working in 100% of cases, for instance when occupied by USB devices that are actively used by certain applications it was failing for me occasionally.

The only proper and clean solution is to be able to force the device to use vfio-pci, which is impossible with the kernel Ubuntu ships right now, hence this request to change kernel configuration.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers