diff --git a/hw/s390x/ap-bridge.c b/hw/s390x/ap-bridge.c index 3795d30dd7..75ad0a66b9 100644 --- a/hw/s390x/ap-bridge.c +++ b/hw/s390x/ap-bridge.c @@ -39,6 +39,7 @@ static const TypeInfo ap_bus_info = { void s390_init_ap(void) { DeviceState *dev; + BusState *bus; /* If no AP instructions then no need for AP bridge */ if (!s390_has_feat(S390_FEAT_AP)) { @@ -52,13 +53,18 @@ void s390_init_ap(void) qdev_init_nofail(dev); /* Create bus on bridge device */ - qbus_create(TYPE_AP_BUS, dev, TYPE_AP_BUS); + bus = qbus_create(TYPE_AP_BUS, dev, TYPE_AP_BUS); + + /* Enable hotplugging */ + qbus_set_hotplug_handler(bus, OBJECT(dev), &error_abort); } static void ap_bridge_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); + HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); + hc->unplug = qdev_simple_device_unplug_cb; set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); } @@ -67,6 +73,10 @@ static const TypeInfo ap_bridge_info = { .parent = TYPE_SYS_BUS_DEVICE, .instance_size = 0, .class_init = ap_bridge_class_init, + .interfaces = (InterfaceInfo[]) { + { TYPE_HOTPLUG_HANDLER }, + { } + } }; static void ap_register(void) diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c index 6166ccd47a..d8b79ebe53 100644 --- a/hw/vfio/ap.c +++ b/hw/vfio/ap.c @@ -169,7 +169,7 @@ static void vfio_ap_class_init(ObjectClass *klass, void *data) set_bit(DEVICE_CATEGORY_MISC, dc->categories); dc->realize = vfio_ap_realize; dc->unrealize = vfio_ap_unrealize; - dc->hotpluggable = false; + dc->hotpluggable = true; dc->reset = vfio_ap_reset; dc->bus_type = TYPE_AP_BUS; }