From: "Oscar Alejandro Sánchez Lucero" <aleszlucero@gmail.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Jean-Christophe Dubois" <jcd@tribudubois.net>,
qemu-arm@nongnu.org,
"Richard Henderson" <richard.henderson@linaro.org>,
"Helge Deller" <deller@gmx.de>,
"Oscar Alejandro Sánchez Lucero" <aleszlucero@gmail.com>
Subject: [PATCH 09/11] hw/usb/hcd-xhci: Convert to Resettable interface
Date: Mon, 30 Nov 2026 20:02:51 +0000 [thread overview]
Message-ID: <20261130-b4-usb-resettable-v1-9-2ee503f50c8a@gmail.com> (raw)
In-Reply-To: <20261130-b4-usb-resettable-v1-0-2ee503f50c8a@gmail.com>
Extract the core reset logic into an xhci_reset() helper for internal
USBCMD_HCRST resets, and replace the transitional
device_class_set_legacy_reset() wrapper with the ResettableClass
interface by implementing the hold phase in xhci_reset_hold().
Signed-off-by: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
---
hw/usb/hcd-xhci.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index aac7f67..3d70f42 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -2716,9 +2716,8 @@ static void xhci_port_reset(XHCIPort *port, bool warm_reset)
xhci_port_notify(port, PORTSC_PRC);
}
-static void xhci_reset(DeviceState *dev)
+static void xhci_reset(XHCIState *xhci)
{
- XHCIState *xhci = XHCI(dev);
int i;
trace_usb_xhci_reset();
@@ -3005,7 +3004,7 @@ static void xhci_oper_write(void *ptr, hwaddr reg,
xhci->usbcmd = val & 0xc0f;
xhci_mfwrap_update(xhci);
if (val & USBCMD_HCRST) {
- xhci_reset(DEVICE(xhci));
+ xhci_reset(xhci);
}
xhci_intr_update(xhci, 0);
break;
@@ -3702,13 +3701,19 @@ static const Property xhci_properties[] = {
DeviceState *),
};
+static void xhci_reset_hold(Object *obj, ResetType type)
+{
+ xhci_reset(XHCI(obj));
+}
+
static void xhci_class_init(ObjectClass *klass, const void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
dc->realize = usb_xhci_realize;
dc->unrealize = usb_xhci_unrealize;
- device_class_set_legacy_reset(dc, xhci_reset);
+ rc->phases.hold = xhci_reset_hold;
device_class_set_props(dc, xhci_properties);
dc->user_creatable = false;
}
--
2.53.0
next prev parent reply other threads:[~2026-11-30 20:05 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 20:02 [PATCH 00/11] hw/usb: Convert USB host controllers and PHY to Resettable interface Oscar Alejandro Sánchez Lucero
2026-11-30 20:02 ` [PATCH 01/11] hw/usb/hcd-dwc3: Convert " Oscar Alejandro Sánchez Lucero
2026-12-01 13:47 ` Bin Meng
2026-12-01 14:46 ` Tommaso Califano
2026-12-01 21:38 ` Philippe Mathieu-Daudé
2026-11-30 20:02 ` [PATCH 02/11] hw/usb/hcd-ehci-pci: " Oscar Alejandro Sánchez Lucero
2026-12-01 13:47 ` Bin Meng
2026-12-01 14:47 ` Tommaso Califano
2026-11-30 20:02 ` [PATCH 03/11] hw/usb/hcd-ehci-sysbus: " Oscar Alejandro Sánchez Lucero
2026-12-01 13:47 ` Bin Meng
2026-12-01 14:47 ` Tommaso Califano
2026-11-30 20:02 ` [PATCH 04/11] hw/usb/hcd-ohci-pci: " Oscar Alejandro Sánchez Lucero
2026-12-01 13:48 ` Bin Meng
2026-12-01 14:48 ` Tommaso Califano
2026-11-30 20:02 ` [PATCH 05/11] hw/usb/hcd-ohci-sysbus: " Oscar Alejandro Sánchez Lucero
2026-12-01 13:48 ` Bin Meng
2026-12-01 14:49 ` Tommaso Califano
2026-11-30 20:02 ` [PATCH 06/11] hw/usb/hcd-uhci: " Oscar Alejandro Sánchez Lucero
2026-12-01 13:49 ` Bin Meng
2026-12-01 14:51 ` Tommaso Califano
2026-12-01 14:52 ` Tommaso Califano
2026-11-30 20:02 ` [PATCH 07/11] hw/usb/hcd-xhci-pci: " Oscar Alejandro Sánchez Lucero
2026-12-01 13:49 ` Bin Meng
2026-12-01 14:53 ` Tommaso Califano
2026-11-30 20:02 ` [PATCH 08/11] hw/usb/hcd-xhci-sysbus: " Oscar Alejandro Sánchez Lucero
2026-12-01 13:49 ` Bin Meng
2026-12-01 14:54 ` Tommaso Califano
2026-11-30 20:02 ` Oscar Alejandro Sánchez Lucero [this message]
2026-12-01 13:50 ` [PATCH 09/11] hw/usb/hcd-xhci: " Bin Meng
2026-12-01 14:55 ` Tommaso Califano
2026-11-30 20:02 ` [PATCH 10/11] hw/usb/imx-usb-phy: " Oscar Alejandro Sánchez Lucero
2026-12-01 13:50 ` Bin Meng
2026-12-01 14:58 ` Tommaso Califano
2026-11-30 20:02 ` [PATCH 11/11] hw/usb/pc87560-ohci: " Oscar Alejandro Sánchez Lucero
2026-12-01 13:50 ` Bin Meng
2026-12-01 14:59 ` Tommaso Califano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261130-b4-usb-resettable-v1-9-2ee503f50c8a@gmail.com \
--to=aleszlucero@gmail.com \
--cc=deller@gmx.de \
--cc=jcd@tribudubois.net \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.