[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v2 09/16] hw/core/machine: Remove the dynamic sysbus devices
From: |
Damien Hedde |
Subject: |
[RFC PATCH v2 09/16] hw/core/machine: Remove the dynamic sysbus devices type check |
Date: |
Wed, 22 Sep 2021 18:13:58 +0200 |
Now that we check sysbus device types during device creation, we
can remove the check done in the machine init done notifier.
This was the only thing done by this notifier, so we remove the
whole sysbus_notifier structure of the MachineState.
Note: This notifier was checking all /peripheral and /peripheral-anon
sysbus devices. Now we only check those added by -device cli option or
device_add qmp command when handling the command/option. So if there
are some devices added in one of these containers manually (eg in
machine C code), these will not be checked anymore.
This use case does not seem to appear apart from
hw/xen/xen-legacy-backend.c (it uses qdev_set_id() and in this case,
not for a sysbus device, so it's ok).
Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
---
include/hw/boards.h | 1 -
hw/core/machine.c | 27 ---------------------------
2 files changed, 28 deletions(-)
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 934443c1cd..ccbc40355a 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -311,7 +311,6 @@ typedef struct CpuTopology {
struct MachineState {
/*< private >*/
Object parent_obj;
- Notifier sysbus_notifier;
/*< public >*/
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 1a18912dc8..521438e90a 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -571,18 +571,6 @@ bool
machine_class_is_dynamic_sysbus_dev_allowed(MachineClass *mc,
return allowed;
}
-static void validate_sysbus_device(SysBusDevice *sbdev, void *opaque)
-{
- MachineState *machine = opaque;
- MachineClass *mc = MACHINE_GET_CLASS(machine);
-
- if (!device_is_dynamic_sysbus(mc, DEVICE(sbdev))) {
- error_report("Option '-device %s' cannot be handled by this machine",
- object_class_get_name(object_get_class(OBJECT(sbdev))));
- exit(1);
- }
-}
-
static char *machine_get_memdev(Object *obj, Error **errp)
{
MachineState *ms = MACHINE(obj);
@@ -598,17 +586,6 @@ static void machine_set_memdev(Object *obj, const char
*value, Error **errp)
ms->ram_memdev_id = g_strdup(value);
}
-static void machine_init_notify(Notifier *notifier, void *data)
-{
- MachineState *machine = MACHINE(qdev_get_machine());
-
- /*
- * Loop through all dynamically created sysbus devices and check if they
are
- * all allowed. If a device is not allowed, error out.
- */
- foreach_dynamic_sysbus_device(validate_sysbus_device, machine);
-}
-
HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine)
{
int i;
@@ -1030,10 +1007,6 @@ static void machine_initfn(Object *obj)
"Table (HMAT)");
}
- /* Register notifier when init is done for sysbus sanity checks */
- ms->sysbus_notifier.notify = machine_init_notify;
- qemu_add_machine_init_done_notifier(&ms->sysbus_notifier);
-
/* default to mc->default_cpus */
ms->smp.cpus = mc->default_cpus;
ms->smp.max_cpus = mc->default_cpus;
--
2.33.0
- [RFC PATCH v2 07/16] hw/core/machine: add machine_class_is_dynamic_sysbus_dev_allowed, (continued)
- [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, 2021/09/22
- [RFC PATCH v2 09/16] hw/core/machine: Remove the dynamic sysbus devices type check,
Damien Hedde <=
- [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