From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Damien Hedde" <damien.hedde@greensocs.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Alistair Francis" <alistair.francis@wdc.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PULL 10/10] machine: remove the done notifier for dynamic sysbus device type check
Date: Mon, 1 Nov 2021 19:42:59 +0100 [thread overview]
Message-ID: <20211101184259.2859090-11-philmd@redhat.com> (raw)
In-Reply-To: <20211101184259.2859090-1-philmd@redhat.com>
From: Damien Hedde <damien.hedde@greensocs.com>
Now that we check sysbus device types during device creation, we
can remove the check 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>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20211029142258.484907-4-damien.hedde@greensocs.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.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 602993bd5ab..9c1c1901046 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -317,7 +317,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 7c4004ac5a0..e24e3e27dbe 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -572,18 +572,6 @@ bool device_type_is_dynamic_sysbus(MachineClass *mc, const char *type)
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);
@@ -599,17 +587,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;
@@ -949,10 +926,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.31.1
next prev parent reply other threads:[~2021-11-01 20:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-01 18:42 [PULL 00/10] Machine-next patches for 2021-11-01 Philippe Mathieu-Daudé
2021-11-01 18:42 ` [PULL 01/10] machine: Move gpio code to hw/core/gpio.c Philippe Mathieu-Daudé
2021-11-01 18:42 ` [PULL 02/10] hw/core: Restrict sysemu specific files Philippe Mathieu-Daudé
2021-11-01 18:42 ` [PULL 03/10] hw/core: Declare meson source set Philippe Mathieu-Daudé
2021-11-01 18:42 ` [PULL 04/10] hw/core: Extract hotplug-related functions to qdev-hotplug.c Philippe Mathieu-Daudé
2021-11-01 18:42 ` [PULL 05/10] hw/core: Restrict hotplug to system emulation Philippe Mathieu-Daudé
2021-11-01 18:42 ` [PULL 06/10] hw/core/machine: Split out the smp parsing code Philippe Mathieu-Daudé
2021-11-01 18:42 ` [PULL 07/10] tests/unit: Add an unit test for smp parsing Philippe Mathieu-Daudé
2021-11-01 18:42 ` [PULL 08/10] machine: add device_type_is_dynamic_sysbus function Philippe Mathieu-Daudé
2021-11-01 18:42 ` [PULL 09/10] qdev-monitor: Check sysbus device type before creating it Philippe Mathieu-Daudé
2021-11-01 18:42 ` Philippe Mathieu-Daudé [this message]
2021-11-02 11:24 ` [PULL 00/10] Machine-next patches for 2021-11-01 Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211101184259.2859090-11-philmd@redhat.com \
--to=philmd@redhat.com \
--cc=alistair.francis@wdc.com \
--cc=berrange@redhat.com \
--cc=damien.hedde@greensocs.com \
--cc=ehabkost@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).