aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDamien Hedde <damien.hedde@greensocs.com>2021-10-29 16:22:56 +0200
committerPhilippe Mathieu-Daudé <philmd@redhat.com>2021-11-01 19:44:11 +0100
commitb5fdf4102fa3ecc35e7b84a398ccb3e00ca08944 (patch)
treeb44087ebe5ff4c7de51029ec17e2d92990e69bbb /include
parent9e8e393bb795ff6c6963c47376369e90b1d40467 (diff)
downloadqemu-b5fdf4102fa3ecc35e7b84a398ccb3e00ca08944.zip
qemu-b5fdf4102fa3ecc35e7b84a398ccb3e00ca08944.tar.gz
qemu-b5fdf4102fa3ecc35e7b84a398ccb3e00ca08944.tar.bz2
machine: add device_type_is_dynamic_sysbus function
Right now the allowance check for adding a sysbus device using -device cli option (or device_add qmp command) is done well after the device has been created. It is done during the machine init done notifier: machine_init_notify() in hw/core/machine.c This new function will allow us to do the check at the right time and issue an error if it fails. Also make device_is_dynamic_sysbus() use the new function. Signed-off-by: Damien Hedde <damien.hedde@greensocs.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Acked-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20211029142258.484907-2-damien.hedde@greensocs.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/hw/boards.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/hw/boards.h b/include/hw/boards.h
index e36fc7d..602993b 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -53,6 +53,21 @@ void smp_parse(MachineState *ms, SMPConfiguration *config, Error **errp);
void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type);
/**
+ * device_type_is_dynamic_sysbus: Check if type is an allowed sysbus device
+ * type for the machine class.
+ * @mc: Machine class
+ * @type: type to check (should be a subtype of TYPE_SYS_BUS_DEVICE)
+ *
+ * Returns: true if @type is a type in the machine's list of
+ * dynamically pluggable sysbus devices; otherwise false.
+ *
+ * Check if the QOM type @type is in the list of allowed sysbus device
+ * types (see machine_class_allowed_dynamic_sysbus_dev()).
+ * Note that if @type has a parent type in the list, it is allowed too.
+ */
+bool device_type_is_dynamic_sysbus(MachineClass *mc, const char *type);
+
+/**
* device_is_dynamic_sysbus: test whether device is a dynamic sysbus device
* @mc: Machine class
* @dev: device to check