[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v9 02/19] hw/usb/hcd-xhci: Add an auto-hub property and leave it off
- To: "berrange@xxxxxxxxxx" <berrange@xxxxxxxxxx>, "junjie.cao@xxxxxxxxx" <junjie.cao@xxxxxxxxx>, "kraxel@xxxxxxxxxx" <kraxel@xxxxxxxxxx>, "marcandre.lureau@xxxxxxxxxx" <marcandre.lureau@xxxxxxxxxx>, "clg@xxxxxxxx" <clg@xxxxxxxx>, "junjie.cao@xxxxxxxxx" <junjie.cao@xxxxxxxxx>, Pierrick Bouvier <pierrick.bouvier@xxxxxxxxxxxxxxxx>, Peter Maydell <peter.maydell@xxxxxxxxxx>, Kane Chen <kane_chen@xxxxxxxxxxxxxx>, Philippe Mathieu-Daudé <philmd@xxxxxxxxxxxxxxxx>, Tyrone Ting <kfting@xxxxxxxxxxx>, Hao Wu <wuhaotsh@xxxxxxxxxx>, Zhao Liu <zhao1.liu@xxxxxxxxx>, Richard Henderson <richard.henderson@xxxxxxxxxx>, Helge Deller <deller@xxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony@xxxxxxxxxxxxxx>, "Edgar E. Iglesias" <edgar.iglesias@xxxxxxxxx>, "open list:All patches CC here" <qemu-devel@xxxxxxxxxx>, "open list:ASPEED BMCs" <qemu-arm@xxxxxxxxxx>, "open list:X86 Xen CPUs" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Jamin Lin <jamin_lin@xxxxxxxxxxxxxx>
- Date: Tue, 10 Nov 2026 07:28:22 +0000
- Accept-language: zh-TW, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=aspeedtech.com; dmarc=pass action=none header.from=aspeedtech.com; dkim=pass header.d=aspeedtech.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wEn5J4/xL+6NFpbWwN9XjuklnPKdDus+6J5yPzw7GCE=; b=YkJ/EBa6+Nfo0qdTdgZkrm96UYgsRKyjerBBmSCfO+8n44Cn7Z/4NKhKtzKEUazYZZ4oDFl2GPk2Hf8KQ1K3S8w+mjxfoQ+xHr7Djo35BoKydM3MuN1yJirqWId1ujMRIsLSrphx9BpP3X+LEGakrvu3Dl/QiG8U4DPQT0Zz3AYErD9D+PnNdrMORg3i+sh+jGOvQgY9gwozEc0AJitRxqwSAUJwPiHWCCK+Yx9B2rIFAjmeIH2PEXdJODQm8485Kwe6P8yNrtWck51+RzJSkmFYTLCr2zi33WEdPnU3HK9UAKuSIhw9UlfvqKrDp5MHhOFIAD+4sRQ9al01iwLuqw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gqRaT5PxhVxCiDRtDzpVKYP1QrHXuzjTp7/252LBHOUGBjylmROusJXBSEBgaDgnb2+Gq4spbabX18NX96nwdhI2opeaVg6HOtdV7frXMAaRRTAOtlhDBRcgexP6vpmJTN53eaOWydK6EB94gyyH705J3faRgbqNxnQSVLdpNSNuT8q1OvMfWT76xDtkp8sBgnlbin1FDJJjELGunqldiRQKD65jW4WjjaXCUtOa1krbs6R0fawM39eoM9RtIDcqQeE7bEy1Nayl5WNJZtqJpx4k0JGDqeD5Dlk95cWx40KWel2yRgBowakNlwH3PDgwAcS58XnAJzqjD4iQ6UJ1YQ==
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=aspeedtech.com header.i="@aspeedtech.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
- Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=aspeedtech.com;
- Cc: Jamin Lin <jamin_lin@xxxxxxxxxxxxxx>, Troy Lee <troy_lee@xxxxxxxxxxxxxx>
- Delivery-date: Tue, 10 Nov 2026 07:28:34 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHdcOUQXfrXBCYUM0mvE3FM5SGv4w==
- Thread-topic: [PATCH v9 02/19] hw/usb/hcd-xhci: Add an auto-hub property and leave it off
xHCI has up to 15 root ports and does not need a hub to fit more
devices.
Add auto-hub and leave it off. hw_compat_11_1 turns it on, so an older
machine type keeps the hub it has today and a guest saved by an older
QEMU still loads.
TODO: Move the entry to hw_compat_11_2 before merge. The series goes
into 12.0, so 11.2 is an old machine type too. hw_compat_11_2 does
not exist yet.
Suggested-by: Gerd Hoffmann <kraxel@xxxxxxxxxx>
Reported-by: Junjie Cao <junjie.cao@xxxxxxxxx>
Signed-off-by: Jamin Lin <jamin_lin@xxxxxxxxxxxxxx>
Reviewed-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
---
hw/usb/hcd-xhci.h | 1 +
hw/core/machine.c | 1 +
hw/usb/hcd-xhci.c | 2 ++
3 files changed, 4 insertions(+)
diff --git a/hw/usb/hcd-xhci.h b/hw/usb/hcd-xhci.h
index 5cb9e06d1d..a3eaf2ebb6 100644
--- a/hw/usb/hcd-xhci.h
+++ b/hw/usb/hcd-xhci.h
@@ -191,6 +191,7 @@ typedef struct XHCIState {
uint32_t numslots;
uint32_t flags;
uint32_t max_pstreams_mask;
+ bool auto_hub;
void (*intr_update)(XHCIState *s, int n, bool enable);
bool (*intr_raise)(XHCIState *s, int n, bool level);
/*
diff --git a/hw/core/machine.c b/hw/core/machine.c
index d9ac4b419a..f8f5b01117 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -43,6 +43,7 @@
GlobalProperty hw_compat_11_1[] = {
{ "sysbus-ehci-usb", "x-migrate-fetch-addr-64bit", "off" },
{ "pci-ehci-usb", "x-migrate-fetch-addr-64bit", "off" },
+ { "base-xhci", "auto-hub", "on" },
};
const size_t hw_compat_11_1_len = G_N_ELEMENTS(hw_compat_11_1);
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 376bc00264..1e42c851b4 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -3377,6 +3377,7 @@ static void usb_xhci_init(XHCIState *xhci)
xhci->numports = xhci->numports_2 + xhci->numports_3;
usb_bus_new(&xhci->bus, sizeof(xhci->bus), &xhci_bus_ops,
xhci->hostOpaque);
+ xhci->bus.auto_hub = xhci->auto_hub;
for (i = 0; i < usbports; i++) {
speedmask = 0;
@@ -3660,6 +3661,7 @@ static const Property xhci_properties[] = {
DEFINE_PROP_UINT32("p3", XHCIState, numports_3, 4),
DEFINE_PROP_LINK("host", XHCIState, hostOpaque, TYPE_DEVICE,
DeviceState *),
+ DEFINE_PROP_BOOL("auto-hub", XHCIState, auto_hub, false),
};
static void xhci_class_init(ObjectClass *klass, const void *data)
--
2.43.0
|