From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= Subject: PCI passthrough of USB controllers on Xen 4.8.1, Linux 4.9.29, stubdomain Date: Fri, 2 Jun 2017 12:57:19 +0200 Message-ID: <20170602105719.GK10404@mail-itl> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1500275419482908625==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: xen-devel Cc: HW42 List-Id: xen-devel@lists.xenproject.org --===============1500275419482908625== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="fmvA4kSBHQVZhkR6" Content-Disposition: inline --fmvA4kSBHQVZhkR6 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, I'm trying to passthrough USB controllers (details below) to a HVM domain with qemu running in stubdomain. There are two of them (EHCI and xHCI), neither of them works. The stubdomain is non-standard Linux based with Qemu 2.8.0. Both dom0 and guest are running Linux 4.9.29 very close to vanilla. I've started debugging with EHCI. On modprobe ehci-pci I get: [52453.633768] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driv= er [52453.634496] ehci-pci: EHCI PCI platform driver [52453.640088] ehci-pci 0000:00:06.0: EHCI Host Controller [52453.640466] ehci-pci 0000:00:06.0: new USB bus registered, assigned = bus number 5 [52462.453251] ehci-pci 0000:00:06.0: can't setup: -110 [52462.453315] ehci-pci 0000:00:06.0: USB bus 5 deregistered [52462.458375] ehci-pci 0000:00:06.0: init 0000:00:06.0 fail, -110 [52462.458421] ehci-pci: probe of 0000:00:06.0 failed with error -110 And at this time, stubdomain print this: [00:06.0] xen_pt_bar_read: Error: Should not read BAR through QEMU. @0x= 0000000000000004 [00:06.0] xen_pt_bar_read: Error: Should not read BAR through QEMU. @0x= 0000000000000004 [00:06.0] xen_pt_bar_read: Error: Should not read BAR through QEMU. @0x= 0000000000000004 [00:06.0] xen_pt_bar_read: Error: Should not read BAR through QEMU. @0x= 0000000000000004 [00:06.0] xen_pt_bar_read: Error: Should not read BAR through QEMU. @0x= 0000000000000004 [00:06.0] xen_pt_bar_read: Error: Should not read BAR through QEMU. @0x= 0000000000000004 [00:06.0] xen_pt_bar_read: Error: Should not read BAR through QEMU. @0x= 0000000000000004 [00:06.0] xen_pt_bar_read: Error: Should not read BAR through QEMU. @0x= 0000000000000004 [00:06.0] xen_pt_bar_read: Error: Should not read BAR through QEMU. @0x= 0000000000000004 [00:06.0] xen_pt_bar_read: Error: Should not read BAR through QEMU. @0x= 0000000000000004 repeated a lot more times, sometimes with slightly different addresses and/or for write. Just to be sure, I've checked with mini-os based stubdomain, but there I don't even see the EHCI one (only xHCI, which doesn't work the same way as on updated stubdomain). Regarding xHCI, the domU messages are (this one is from older kernel, but the same happens on 4.9 too): [ 347.822393] xhci_hcd 0000:00:05.0: xHCI Host Controller [ 347.822764] xhci_hcd 0000:00:05.0: new USB bus registered, assigned = bus number 2 [ 347.825391] xhci_hcd 0000:00:05.0: hcc params 0x200077c1 hci version= 0x100 quirks 0x0004b810 [ 347.832346] usb usb2: New USB device found, idVendor=3D1d6b, idProdu= ct=3D0002 [ 347.832482] usb usb2: New USB device strings: Mfr=3D3, Product=3D2, = SerialNumber=3D1 [ 347.832643] usb usb2: Product: xHCI Host Controller [ 347.832779] usb usb2: Manufacturer: Linux 4.8.13-100.fc23.x86_64 xhc= i-hcd [ 347.832970] usb usb2: SerialNumber: 0000:00:05.0 [ 347.833867] hub 2-0:1.0: USB hub found [ 347.834089] hub 2-0:1.0: 11 ports detected [ 347.835127] xhci_hcd 0000:00:05.0: xHCI Host Controller [ 347.836927] xhci_hcd 0000:00:05.0: new USB bus registered, assigned = bus number 3 [ 347.837382] usb usb3: New USB device found, idVendor=3D1d6b, idProdu= ct=3D0003 [ 347.837582] usb usb3: New USB device strings: Mfr=3D3, Product=3D2, = SerialNumber=3D1 [ 347.837784] usb usb3: Product: xHCI Host Controller [ 347.837921] usb usb3: Manufacturer: Linux 4.8.13-100.fc23.x86_64 xhc= i-hcd [ 347.838159] usb usb3: SerialNumber: 0000:00:05.0 [ 347.838942] hub 3-0:1.0: USB hub found [ 347.839158] hub 3-0:1.0: 4 ports detected [ 363.487226] xhci_hcd 0000:00:05.0: Error while assigning device slot= ID [ 363.487368] xhci_hcd 0000:00:05.0: Max number of devices this xHCI h= ost supports is 32. [ 363.487508] usb usb2-port1: couldn't allocate usb_device [ 383.967268] xhci_hcd 0000:00:05.0: Error while assigning device slot= ID [ 383.967495] xhci_hcd 0000:00:05.0: Max number of devices this xHCI h= ost supports is 32. [ 383.967715] usb usb2-port2: couldn't allocate usb_device And in this case, dom0 also prints: [ 49.155606] pciback 0000:00:14.0: Driver tried to write to a read-on= ly configuration space field at offset 0x82, size 2. This may be harmless, = but if you have problems with your device: 1) see permissive attribute in sysfs 2) report problems to the xen-devel mailing list along w= ith details of your device obtained from lspci. [ 66.247644] pciback 0000:00:14.0: cache line size of 64 is not suppo= rted [ 66.247646] xen_pciback: 0000:00:14.0: cannot enable memory-write-in= validate (-22) Enabling permissive mode doesn't change anything. Any idea what's wrong? --=20 Best Regards, Marek Marczykowski-G=C3=B3recki Invisible Things Lab A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? --fmvA4kSBHQVZhkR6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJZMUSSAAoJENuP0xzK19cscrsH/ia9VLpsf6tHLio9vePp6XxB oV+4J5rHeAxyGNOIexhXosX6RzhopDBJqqEPHG3F0yuOWIGbUVBwl5wu8GMplA2M OnCXHeDsxZx8pP2CahkO9mgTDDacBgCF2wJMlyaqDpXnHao7wJCgEdcVbIfq49TU WZJ9KSfN3xYQEX2kQoECgZ2tcGizO3gB4xflACekRwE+qpVUTitjsvcLjiq+XsS9 3jS8Ehg0o1wBirG08BYM1zbHr0gUFVMa8KYOQpb7tgEOSK1xzhsUT1N9ndkx6S8t talyRhWB+nbTGCnhZh4uJnsVpy1avyunBJvxbnjhBz2uOnXgMyBHky2ekCz2Bfk= =wfGc -----END PGP SIGNATURE----- --fmvA4kSBHQVZhkR6-- --===============1500275419482908625== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --===============1500275419482908625==--