All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alistair Francis <alistair.francis@xilinx.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, crosthwaitepeter@gmail.com,
	alistair.francis@xilinx.com
Subject: [Qemu-devel] [PATCH v7 1/6] qdev: get_child_bus(): Use QOM lookup if available
Date: Fri, 15 Jan 2016 14:38:10 -0800	[thread overview]
Message-ID: <de67cc151dcaa355946bca494306edec4199ba4f.1452896266.git.alistair.francis@xilinx.com> (raw)
In-Reply-To: <cover.1452896266.git.alistair.francis@xilinx.com>

From: Peter Crosthwaite <crosthwaitepeter@gmail.com>

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 <crosthwaite.peter@gmail.com>
Acked-by: Alistair Francis <alistair.francis@xilinx.com>
---
 hw/core/qdev.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 2c7101d..75d1227 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -580,6 +580,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) {
-- 
2.5.0

  reply	other threads:[~2016-01-15 22:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-15 22:38 [Qemu-devel] [PATCH v7 0/6] Connect the SPI devices to Xilinx's ZynqMP Alistair Francis
2016-01-15 22:38 ` Alistair Francis [this message]
2016-01-15 22:47   ` [Qemu-devel] [PATCH v7 1/6] qdev: get_child_bus(): Use QOM lookup if available Peter Crosthwaite
2016-01-16  0:00     ` Alistair Francis
2016-01-15 22:38 ` [Qemu-devel] [PATCH v7 2/6] m25p80.c: Add sst25wf080 SPI flash device Alistair Francis
2016-01-15 22:38 ` [Qemu-devel] [PATCH v7 3/6] ssi: Move ssi.h into a separate directory Alistair Francis
2016-01-15 22:38 ` [Qemu-devel] [PATCH v7 4/6] xilinx_spips: Separate the state struct into a header Alistair Francis
2016-01-15 22:38 ` [Qemu-devel] [PATCH v7 6/6] xlnx-ep108: Connect the SPI Flash Alistair Francis
2016-01-18 11:27   ` Peter Maydell
2016-01-18 16:49     ` Alistair Francis
     [not found] ` <17c4670f77e262588befd4ff0f3bab3b89156214.1452896266.git.alistair.francis@xilinx.com>
2016-01-18 11:18   ` [Qemu-devel] [PATCH v7 5/6] xlnx-zynqmp: Connect the SPI devices Peter Maydell
2016-01-18 11:31 ` [Qemu-devel] [PATCH v7 0/6] Connect the SPI devices to Xilinx's ZynqMP Peter Maydell

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=de67cc151dcaa355946bca494306edec4199ba4f.1452896266.git.alistair.francis@xilinx.com \
    --to=alistair.francis@xilinx.com \
    --cc=crosthwaitepeter@gmail.com \
    --cc=peter.maydell@linaro.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.