Commit 071d587645 for qemu.org
commit 071d587645d13e54a966d3d6ef655cbf041a8a8b
Author: Jamin Lin <jamin_lin@aspeedtech.com>
Date: Wed Feb 25 02:12:36 2026 +0000
hw/i3c: Add hotplug support
This adds support for hotplugging in I3C.
Conceptually this can be thought of as an I3C target being physically
socketed onto a board.
It is then the target's responsibility to go through the hot-join and
DAA process so it can participate on the bus.
Signed-off-by: Joe Komlodi <komlodi@google.com>
Reviewed-by: Patrick Venture <venture@google.com>
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Tested-by: Jithu Joseph <jithu.joseph@oss.qualcomm.com>
Link: https://lore.kernel.org/qemu-devel/20260225021158.1586584-21-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
diff --git a/hw/i3c/core.c b/hw/i3c/core.c
index 22e6e226a7..8a37099ce3 100644
--- a/hw/i3c/core.c
+++ b/hw/i3c/core.c
@@ -11,6 +11,7 @@
#include "qapi/error.h"
#include "trace.h"
#include "hw/i3c/i3c.h"
+#include "hw/core/hotplug.h"
#include "hw/core/qdev-properties.h"
/*
@@ -26,6 +27,17 @@ static const Property i3c_props[] = {
DEFINE_PROP_UINT64("pid", struct I3CTarget, pid, 0),
};
+static void i3c_realize(BusState *bus, Error **errp)
+{
+ qbus_set_bus_hotplug_handler(bus);
+}
+
+static void i3c_class_init(ObjectClass *klass, const void *data)
+{
+ BusClass *k = BUS_CLASS(klass);
+ k->realize = i3c_realize;
+}
+
I3CBus *i3c_init_bus(DeviceState *parent, const char *name)
{
return i3c_init_bus_type(TYPE_I3C_BUS, parent, name);
@@ -633,6 +645,11 @@ static const TypeInfo i3c_types[] = {
.parent = TYPE_BUS,
.instance_size = sizeof(I3CBus),
.class_size = sizeof(I3CBusClass),
+ .class_init = i3c_class_init,
+ .interfaces = (InterfaceInfo[]) {
+ { TYPE_HOTPLUG_HANDLER },
+ { }
+ }
},
{
.name = TYPE_I3C_TARGET,