diff mbox series

[RFC,v5,1/3] none-machine: allow cold plugging sysbus devices

Message ID 20220524134809.40732-2-damien.hedde@greensocs.com
State New
Headers show
Series Sysbus device generic QAPI plug support | expand

Commit Message

Damien Hedde May 24, 2022, 1:48 p.m. UTC
Allow plugging any sysbus device on this machine (the sysbus
devices still need to be 'user-creatable').

This commit is needed to use the 'none' machine as a base, and
subsequently to dynamically populate it with sysbus devices using
qapi commands.

Note that this only concern cold-plug: sysbus devices can not be
hot-plugged because the sysbus bus does not support it.

Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---

v5:
  + fix commit message (Philippe)
---
 hw/core/null-machine.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/hw/core/null-machine.c b/hw/core/null-machine.c
index f586a4bef5..21bc2aca23 100644
--- a/hw/core/null-machine.c
+++ b/hw/core/null-machine.c
@@ -16,6 +16,7 @@ 
 #include "hw/boards.h"
 #include "exec/address-spaces.h"
 #include "hw/core/cpu.h"
+#include "hw/sysbus.h"
 
 static void machine_none_init(MachineState *mch)
 {
@@ -54,6 +55,9 @@  static void machine_none_machine_init(MachineClass *mc)
     mc->no_floppy = 1;
     mc->no_cdrom = 1;
     mc->no_sdcard = 1;
+
+    /* allow cold plugging any any "user-creatable" sysbus device */
+    machine_class_allow_dynamic_sysbus_dev(mc, TYPE_SYS_BUS_DEVICE);
 }
 
 DEFINE_MACHINE("none", machine_none_machine_init)