qdev-monitor: Check sysbus device type before creating it
authorDamien Hedde <damien.hedde@greensocs.com>
Fri, 29 Oct 2021 14:22:57 +0000 (16:22 +0200)
committerPhilippe Mathieu-Daudé <philmd@redhat.com>
Mon, 1 Nov 2021 18:44:11 +0000 (19:44 +0100)
commit312e1b1f3e8400cbba9fb59a57729768e72003ee
tree67ad39dc4c1b663192491ff6801f986bcbccab71
parentb5fdf4102fa3ecc35e7b84a398ccb3e00ca08944
qdev-monitor: Check sysbus device type before creating it

Add an early check to test if the requested sysbus device type
is allowed by the current machine before creating the device. This
impacts both -device cli option and device_add qmp command.

Before this patch, the check was done well after the device has
been created (in a machine init done notifier). We can now report
the error right away.

Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
Reviewed-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-3-damien.hedde@greensocs.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
softmmu/qdev-monitor.c