Skip to content

RFC hw/i386: let -usb create qemu-xhci on new pc and q35 machine types

Junjie Cao qemu-devel 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4hw/i386: add 12.0 machine types (NOT FOR MERGE)hw/core/machine.c hw/i386/pc.c hw/i386/pc_piix.c +3 more+34 -40 replies
2/4hw/i386: let -usb create qemu-xhci on new pc and q35 machine typeshw/i386/Kconfig hw/i386/pc.c hw/i386/pc_piix.c +2 more+44 -30 replies
3/4tests/qtest: check which host controller -usb creates on pc and q35tests/qtest/meson.build tests/qtest/usb-pc-default-test.c+138 -00 replies
4/4docs/system/devices/usb: describe -usb after the qemu-xhci switchdocs/system/devices/usb.rst qemu-options.hx+20 -120 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/4] hw/i386: let -usb create qemu-xhci on new pc and q35 machine types

-usb still gives the PIIX3 UHCI on pc and the ICH9 EHCI plus three UHCI companions on q35. In May Peter asked whether -usb could give the PC machines an xHCI on new machine versions and Gerd agreed [1]. Daniel's secure-devices series keeps UHCI/OHCI/EHCI in the virtualization scope partly because -usb still creates them [2]; older machine types keep doing so. From pc-i440fx-12.0 and pc-q35-12.0 on, -usb creates qemu-xhci.

Patch 1 adds the 12.0 machine types so the rest has a version to hang off; drop it once the real "hw: add compat machines for 12.0" lands.

Open question: where the controller sits. It takes 1d.0 on both machines; patch 2 says why the PIIX3's own USB function is out. Slot 1d has no hardware meaning on i440fx. Alternatives: an interrupt-pin property on qemu-xhci so 01.2 can use INTD like the UHCI, or an automatic slot as spapr does for nec-usb-xhci, which shifts user -device addresses on the new types by one slot. I prefer the fixed slot.

Checked:

- SeaBIOS and OVMF (Ubuntu 24.04) drive the xHCI at 00:1d.0 and find the keyboard on both machines.
- Debian 12 under KVM: xhci_hcd at 1d.0, HID at 480 Mb/s, with MSI and with -global qemu-xhci.msi=off -global qemu-xhci.msix=off (INTx routed, IRQ 10 on pc and 16 on q35). pc-q35-11.2 unchanged: ehci-pci plus three uhci_hcd.
- pc-i440fx-11.2 and pc-q35-11.2 with -usb: a running Debian guest saved by master at d29412cca5 and loaded by this series keeps its USB devices and interrupts.
- check-qtest-x86_64 passes.

Windows 7 and earlier do not include an xHCI driver; usb.rst now says to use an older machine type or -device piix3-usb-uhci for them.

Jamin's usbredir-server series turns auto-hub off on new machine types [3]. With both, -usb on the new types gives four USB 2 root ports and no automatic hub. The two series are independent; Jamin's compat entries have to move to hw_compat_11_2 either way.

[1] https://lore.kernel.org/qemu-devel/[email protected]/
[2] https://lore.kernel.org/qemu-devel/[email protected]/
[3] https://lore.kernel.org/qemu-devel/[email protected]/

Junjie Cao (4):
hw/i386: add 12.0 machine types (NOT FOR MERGE)
hw/i386: let -usb create qemu-xhci on new pc and q35 machine types tests/qtest: check which host controller -usb creates on pc and q35 docs/system/devices/usb: describe -usb after the qemu-xhci switch

 docs/system/devices/usb.rst       |  23 +++--
 hw/core/machine.c                 |   3 +
 hw/i386/Kconfig                   |   2 +
 hw/i386/pc.c                      |  21 +++++
 hw/i386/pc_piix.c                 |  24 +++++-
 hw/i386/pc_q35.c                  |  25 +++++-
 include/hw/core/boards.h          |   3 +
 include/hw/i386/pc.h              |   7 ++
 qemu-options.hx                   |   9 +-
 tests/qtest/meson.build           |   3 +
 tests/qtest/usb-pc-default-test.c | 135 ++++++++++++++++++++++++++++++
 11 files changed, 236 insertions(+), 19 deletions(-)
 create mode 100644 tests/qtest/usb-pc-default-test.c
Signature · 1 line
2.43.0