[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-arm] [PATCH v6 1/6] qdev: get_child_bus(): Use QOM lookup if avail
From: |
Peter Crosthwaite |
Subject: |
[Qemu-arm] [PATCH v6 1/6] qdev: get_child_bus(): Use QOM lookup if available |
Date: |
Sat, 19 Dec 2015 21:43:33 -0800 |
qbus_realize() adds busses as a QOM child of the device in addition to
adding it to the qdev bus list. Change get_child_bus() to use the QOM
child if it is available. This takes priority over the bus-list, but
the child object is checked for type correctness.
This prepares support for aliasing of buses. The use case is SoCs,
where a SoC container needs to present buses to the board level, but
the buses are implemented by controller IP we already model as self
contained qbus-containing devices.
Signed-off-by: Peter Crosthwaite <address@hidden>
---
Currently qbus_realize() ignores errors from object_property_add_child,
so it is hard to guarantee that the QOM linkage is reliable. If it were
the case that that object_property_add_child was supposed to be error
asserting, we could remove the old bus-list strcmp iterator altogether.
hw/core/qdev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index b3ad467..c96c464 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -581,6 +581,12 @@ void qdev_pass_gpios(DeviceState *dev, DeviceState
*container,
BusState *qdev_get_child_bus(DeviceState *dev, const char *name)
{
BusState *bus;
+ Object *child = object_resolve_path_component(OBJECT(dev), name);
+
+ bus = (BusState *)object_dynamic_cast(child, TYPE_BUS);
+ if (bus) {
+ return bus;
+ }
QLIST_FOREACH(bus, &dev->child_bus, sibling) {
if (strcmp(name, bus->name) == 0) {
--
1.9.1
- [Qemu-arm] [PATCH v6 0/6] Connect the SPI devices to ZynqMP, Peter Crosthwaite, 2015/12/20
- [Qemu-arm] [PATCH v6 1/6] qdev: get_child_bus(): Use QOM lookup if available,
Peter Crosthwaite <=
- [Qemu-arm] [PATCH v6 2/6] m25p80.c: Add sst25wf080 SPI flash device, Peter Crosthwaite, 2015/12/20
- [Qemu-arm] [PATCH v6 4/6] xilinx_spips: Separate the state struct into a header, Peter Crosthwaite, 2015/12/20
- [Qemu-arm] [PATCH v6 3/6] ssi: Move ssi.h into a separate directory, Peter Crosthwaite, 2015/12/20
- [Qemu-arm] [PATCH v6 5/6] xlnx-zynqmp: Connect the SPI devices, Peter Crosthwaite, 2015/12/20
- [Qemu-arm] [PATCH v6 6/6] xlnx-ep108: Connect the SPI Flash, Peter Crosthwaite, 2015/12/20