[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v2 10/16] qdev-monitor: allow adding any sysbus device before
From: |
Damien Hedde |
Subject: |
[RFC PATCH v2 10/16] qdev-monitor: allow adding any sysbus device before machine is ready |
Date: |
Wed, 22 Sep 2021 18:13:59 +0200 |
Skip the sysbus device type per-machine allow-list check before the
MACHINE_INIT_PHASE_READY phase.
This patch permits adding any sysbus device (it still needs to be
user_creatable) when using the -preconfig experimental option.
Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
---
This commit is RFC. Depending on the condition to allow a device
to be added, it may change.
---
softmmu/qdev-monitor.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
index f1c9242855..73b991adda 100644
--- a/softmmu/qdev-monitor.c
+++ b/softmmu/qdev-monitor.c
@@ -269,8 +269,13 @@ static DeviceClass *qdev_get_device_class(const char
**driver, Error **errp)
return NULL;
}
- if (object_class_dynamic_cast(oc, TYPE_SYS_BUS_DEVICE)) {
- /* sysbus devices need to be allowed by the machine */
+ if (object_class_dynamic_cast(oc, TYPE_SYS_BUS_DEVICE) &&
+ phase_check(MACHINE_INIT_PHASE_READY)) {
+ /*
+ * Sysbus devices need to be allowed by the machine.
+ * We only check that after the machine is ready in order to let
+ * us add any user_creatable sysbus device during machine creation.
+ */
MachineClass *mc = MACHINE_CLASS(object_get_class(qdev_get_machine()));
if (!machine_class_is_dynamic_sysbus_dev_allowed(mc, *driver)) {
error_setg(errp, "'%s' is not an allowed pluggable sysbus device "
--
2.33.0
- [RFC PATCH v2 04/16] softmmu/qdev-monitor: add error handling in qdev_set_id, (continued)
- [RFC PATCH v2 04/16] softmmu/qdev-monitor: add error handling in qdev_set_id, Damien Hedde, 2021/09/22
- [RFC PATCH v2 01/16] rename MachineInitPhase enum constants for QAPI compatibility, Damien Hedde, 2021/09/22
- [RFC PATCH v2 08/16] qdev-monitor: Check sysbus device type before creating it, Damien Hedde, 2021/09/22
- [RFC PATCH v2 05/16] qdev-monitor: prevent conflicts between qmp/device_add and cli/-device, Damien Hedde, 2021/09/22
- [RFC PATCH v2 07/16] hw/core/machine: add machine_class_is_dynamic_sysbus_dev_allowed, Damien Hedde, 2021/09/22
- [RFC PATCH v2 13/16] hw/mem/system-memory: add a memory sysbus device, Damien Hedde, 2021/09/22
- [RFC PATCH v2 12/16] add x-sysbus-mmio-map qmp command, Damien Hedde, 2021/09/22
- [RFC PATCH v2 14/16] docs/system: add doc about the initialized machine phase and an example, Damien Hedde, 2021/09/22
- [RFC PATCH v2 10/16] qdev-monitor: allow adding any sysbus device before machine is ready,
Damien Hedde <=
- [RFC PATCH v2 09/16] hw/core/machine: Remove the dynamic sysbus devices type check, Damien Hedde, 2021/09/22
- [RFC PATCH v2 16/16] hw/intc/ibex_plic: set user_creatable, Damien Hedde, 2021/09/22
- [RFC PATCH v2 11/16] softmmu/memory: add memory_region_try_add_subregion function, Damien Hedde, 2021/09/22
- [RFC PATCH v2 15/16] hw/char/ibex_uart: set user_creatable, Damien Hedde, 2021/09/22
- Re: [RFC PATCH v2 00/16] Initial support for machine creation via QMP, Philippe Mathieu-Daudé, 2021/09/22