summary refs log tree commit diff stats
path: root/hw/core/qdev-hotplug.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/core/qdev-hotplug.c')
-rw-r--r--hw/core/qdev-hotplug.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/core/qdev-hotplug.c b/hw/core/qdev-hotplug.c
index 168d796474..1d77fffb5e 100644
--- a/hw/core/qdev-hotplug.c
+++ b/hw/core/qdev-hotplug.c
@@ -12,6 +12,7 @@
 #include "qemu/osdep.h"
 #include "hw/qdev-core.h"
 #include "hw/boards.h"
+#include "qapi/error.h"
 
 HotplugHandler *qdev_get_machine_hotplug_handler(DeviceState *dev)
 {
@@ -33,6 +34,14 @@ HotplugHandler *qdev_get_machine_hotplug_handler(DeviceState *dev)
 static bool qdev_hotplug_unplug_allowed_common(DeviceState *dev, BusState *bus,
                                                Error **errp)
 {
+    DeviceClass *dc = DEVICE_GET_CLASS(dev);
+
+    if (!dc->hotpluggable) {
+        error_setg(errp, "Device '%s' does not support hotplugging",
+                   object_get_typename(OBJECT(dev)));
+        return false;
+    }
+
     return true;
 }