hw/ppc/e500plat: Only try to add valid dynamic sysbus devices to platform bus
commite7e0d52dc6cbce267757697f9730d5d8d2a916c1
authorPeter Maydell <peter.maydell@linaro.org>
Thu, 25 Mar 2021 15:33:10 +0000 (25 15:33 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 6 Apr 2021 10:49:14 +0000 (6 11:49 +0100)
tree55e1cc7fae918dcf20b6d7ab532a3f5b324a8d66
parent37fce4dde15f7f7891be89972629d96f851f9815
hw/ppc/e500plat: Only try to add valid dynamic sysbus devices to platform bus

The e500plat machine device plug callback currently calls
platform_bus_link_device() for any sysbus device.  This is overly
broad, because platform_bus_link_device() will unconditionally grab
the IRQs and MMIOs of the device it is passed, whether it was
intended for the platform bus or not.  Restrict hotpluggability of
sysbus devices to only those devices on the dynamic sysbus allowlist.

We were mostly getting away with this because the board creates the
platform bus as the last device it creates, and so the hotplug
callback did not do anything for all the sysbus devices created by
the board itself.  However if the user plugged in a device which
itself uses a sysbus device internally we would have mishandled this
and probably asserted. An example of this is:
 qemu-system-ppc64 -M ppce500 -device macio-oldworld

This isn't a sensible command because the macio-oldworld device
is really specific to the 'g3beige' machine, but we now fail
with a reasonable error message rather than asserting:
qemu-system-ppc64: Device heathrow is not supported by this machine yet.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-id: 20210325153310.9131-5-peter.maydell@linaro.org
hw/ppc/e500plat.c