summaryrefslogtreecommitdiffstats
path: root/hw/core
diff options
context:
space:
mode:
authorPeter Maydell2021-04-06 17:04:33 +0200
committerPeter Maydell2021-04-06 17:04:33 +0200
commit4216ba1b2279a3922814d96e6acfb81a85d2dee2 (patch)
tree2055abea5dd75c59fcf5e68cb123aa1cf8d0570c /hw/core
parentMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (diff)
parentRemove myself as i.mx31 maintainer (diff)
downloadqemu-4216ba1b2279a3922814d96e6acfb81a85d2dee2.tar.gz
qemu-4216ba1b2279a3922814d96e6acfb81a85d2dee2.tar.xz
qemu-4216ba1b2279a3922814d96e6acfb81a85d2dee2.zip
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20210406' into staging
target-arm queue: * ppc/e500 and arm/virt: only add valid dynamic sysbus devices to the platform bus * update i.mx31 maintainer list * Revert "target/arm: Make number of counters in PMCR follow the CPU" # gpg: Signature made Tue 06 Apr 2021 13:25:54 BST # gpg: using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE # gpg: issuer "peter.maydell@linaro.org" # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate] # gpg: aka "Peter Maydell <pmaydell@gmail.com>" [ultimate] # gpg: aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [ultimate] # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83 15CF 3C25 25ED 1436 0CDE * remotes/pmaydell/tags/pull-target-arm-20210406: Remove myself as i.mx31 maintainer Revert "target/arm: Make number of counters in PMCR follow the CPU" hw/ppc/e500plat: Only try to add valid dynamic sysbus devices to platform bus hw/arm/virt: Only try to add valid dynamic sysbus devices to platform bus machine: Provide a function to check the dynamic sysbus allowlist include/hw/boards.h: Document machine_class_allow_dynamic_sysbus_dev() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/core')
-rw-r--r--hw/core/machine.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/hw/core/machine.c b/hw/core/machine.c
index a50f2d5f0a..40def78183 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -530,20 +530,31 @@ void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type)
QAPI_LIST_PREPEND(mc->allowed_dynamic_sysbus_devices, g_strdup(type));
}
-static void validate_sysbus_device(SysBusDevice *sbdev, void *opaque)
+bool device_is_dynamic_sysbus(MachineClass *mc, DeviceState *dev)
{
- MachineState *machine = opaque;
- MachineClass *mc = MACHINE_GET_CLASS(machine);
bool allowed = false;
strList *wl;
+ Object *obj = OBJECT(dev);
+
+ if (!object_dynamic_cast(obj, TYPE_SYS_BUS_DEVICE)) {
+ return false;
+ }
for (wl = mc->allowed_dynamic_sysbus_devices;
!allowed && wl;
wl = wl->next) {
- allowed |= !!object_dynamic_cast(OBJECT(sbdev), wl->value);
+ allowed |= !!object_dynamic_cast(obj, wl->value);
}
- if (!allowed) {
+ 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);