On Sun, Sep 08, 2024 at 11:36:18AM GMT, Guenter Roeck wrote: > Hi, > > the Allwinner H3 USB port qemu emulation creates separate USB ports > for its EHCI and OHCI controllers, resulting in a total of 8 USB ports. > From the orangepi-pc emulation: > > # lsusb > Bus 005 Device 001: ID 1d6b:0002 > Bus 003 Device 001: ID 1d6b:0002 > Bus 001 Device 001: ID 1d6b:0002 > Bus 008 Device 001: ID 1d6b:0002 > Bus 006 Device 001: ID 1d6b:0001 > Bus 004 Device 001: ID 1d6b:0001 > Bus 002 Device 001: ID 1d6b:0002 > Bus 009 Device 001: ID 1d6b:0001 > Bus 007 Device 001: ID 1d6b:0001 > > The SoC supports EHCI companion interfaces, and my understanding is that > it only has four physical USB ports. Does the real hardware instantiate > separate EHCI and OHCI interfaces (for a total of 8 USB ports), or does it > use the companion functionality ?
Well, on the guest side you'll see 8 ports even when using the companion functionality. Each physical usb port has one ehci port (used when you plug in usb 2.0+ devices) and one ohci port (used when you plug in usb 1.1 devices). The main difference is on the qemu backend side. When using the companion functionality you have a single qemu usb bus accepting both 1.1 and 2.0+ devices. When not using the companion functionality you have one usb bus accepting 2.0+ devices and another usb bus accepting usb 1.1 devices ... The guest-visible difference is an per-port bit in ehci registers which controls whenever ehci or the companion manages the device plugged in. This bit exists for backward compatibility (guests without ehci driver can manage all devices via ohci, with usb 2.0+ devices being downgraded to 1.1 compatibility mode then). > If the real hardware only instantiates four USB ports (or, in other words, > if it utilizes EHCI companion functionality), would it make sense to > reflect that in qemu ? Yes. take care, Gerd