@samitouri / QOSamiQemu / commits / 071d587645

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>

Jamin Lin committed Feb 25, 2026 at 02:12 UTC 071d587645d13e54a966d3d6ef655cbf041a8a8b
1 file changed +17
hw/i3c/core.c
+17
@@ -11,6 +11,7 @@
11 #include "qapi/error.h"
12 #include "trace.h"
13 #include "hw/i3c/i3c.h"
14 +#include "hw/core/hotplug.h"
15 #include "hw/core/qdev-properties.h"
16
17 /*
@@ -26,6 +27,17 @@ static const Property i3c_props[] = {
27 DEFINE_PROP_UINT64("pid", struct I3CTarget, pid, 0),
28 };
29
30 +static void i3c_realize(BusState *bus, Error **errp)
31 +{
32 + qbus_set_bus_hotplug_handler(bus);
33 +}
34 +
35 +static void i3c_class_init(ObjectClass *klass, const void *data)
36 +{
37 + BusClass *k = BUS_CLASS(klass);
38 + k->realize = i3c_realize;
39 +}
40 +
41 I3CBus *i3c_init_bus(DeviceState *parent, const char *name)
42 {
43 return i3c_init_bus_type(TYPE_I3C_BUS, parent, name);
@@ -633,6 +645,11 @@ static const TypeInfo i3c_types[] = {
645 .parent = TYPE_BUS,
646 .instance_size = sizeof(I3CBus),
647 .class_size = sizeof(I3CBusClass),
648 + .class_init = i3c_class_init,
649 + .interfaces = (InterfaceInfo[]) {
650 + { TYPE_HOTPLUG_HANDLER },
651 + { }
652 + }
653 },
654 {
655 .name = TYPE_I3C_TARGET,