summaryrefslogtreecommitdiffstats
path: root/hw/virtio/virtio-mmio.c
diff options
context:
space:
mode:
authorPeter Maydell2016-07-14 18:32:53 +0200
committerPeter Maydell2016-07-14 18:32:53 +0200
commit14c7d99333e4a474c65bdae6f99aa8837e8078e6 (patch)
tree32c8874413f0ab109176d649557e1eb63c053805 /hw/virtio/virtio-mmio.c
parentMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream-fwcfg' into s... (diff)
parentast2400: externalize revision numbers (diff)
downloadqemu-14c7d99333e4a474c65bdae6f99aa8837e8078e6.tar.gz
qemu-14c7d99333e4a474c65bdae6f99aa8837e8078e6.tar.xz
qemu-14c7d99333e4a474c65bdae6f99aa8837e8078e6.zip
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20160714' into staging
target-arm queue: * add virtio-mmio transport base address to device path (avoid an assertion failure with multiple virtio-scsi-devices) * revert hw/ptimer commit 5a50307 which causes regressions on SPARC guests * use Neon to accelerate zero-page checking on AArch64 hosts * set the MPIDR for TCG to match how KVM does it (and fit with GICv2/GICv3 restrictions on SGI target lists) * add some missing AArch32 TLBI hypervisor TLB operations * m25p80: Fix QIOR/DIOR handling for Winbond * hw/misc: fix typo in Aspeed SCU hw-strap2 property name * ast2400: pretend DMAs are done for U-boot * ast2400: some minor code cleanups # gpg: Signature made Thu 14 Jul 2016 17:21:30 BST # gpg: using RSA key 0x3C2525ED14360CDE # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" # gpg: aka "Peter Maydell <pmaydell@gmail.com>" # gpg: aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83 15CF 3C25 25ED 1436 0CDE * remotes/pmaydell/tags/pull-target-arm-20160714: ast2400: externalize revision numbers ast2400: pretend DMAs are done for U-boot ast2400: replace aspeed_smc_is_implemented() hw/misc: fix typo in Aspeed SCU hw-strap2 property name m25p80: Fix QIOR/DIOR handling for Winbond target-arm: Add missed AArch32 TLBI sytem registers hw/arm/virt: tcg: adjust MPIDR like KVM gic: provide defines for v2/v3 targetlist sizes target-arm: Use Neon for zero checking Revert "hw/ptimer: Perform counter wrap around if timer already expired" virtio-mmio: format transport base address in BusClass.get_dev_path Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/virtio/virtio-mmio.c')
-rw-r--r--hw/virtio/virtio-mmio.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
index eb84b74532..13798b3cb8 100644
--- a/hw/virtio/virtio-mmio.c
+++ b/hw/virtio/virtio-mmio.c
@@ -91,6 +91,7 @@ typedef struct {
VirtioBusState bus;
bool ioeventfd_disabled;
bool ioeventfd_started;
+ bool format_transport_address;
} VirtIOMMIOProxy;
static bool virtio_mmio_ioeventfd_started(DeviceState *d)
@@ -469,6 +470,12 @@ assign_error:
/* virtio-mmio device */
+static Property virtio_mmio_properties[] = {
+ DEFINE_PROP_BOOL("format_transport_address", VirtIOMMIOProxy,
+ format_transport_address, true),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void virtio_mmio_realizefn(DeviceState *d, Error **errp)
{
VirtIOMMIOProxy *proxy = VIRTIO_MMIO(d);
@@ -489,6 +496,7 @@ static void virtio_mmio_class_init(ObjectClass *klass, void *data)
dc->realize = virtio_mmio_realizefn;
dc->reset = virtio_mmio_reset;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
+ dc->props = virtio_mmio_properties;
}
static const TypeInfo virtio_mmio_info = {
@@ -500,6 +508,46 @@ static const TypeInfo virtio_mmio_info = {
/* virtio-mmio-bus. */
+static char *virtio_mmio_bus_get_dev_path(DeviceState *dev)
+{
+ BusState *virtio_mmio_bus;
+ VirtIOMMIOProxy *virtio_mmio_proxy;
+ char *proxy_path;
+ SysBusDevice *proxy_sbd;
+ char *path;
+
+ virtio_mmio_bus = qdev_get_parent_bus(dev);
+ virtio_mmio_proxy = VIRTIO_MMIO(virtio_mmio_bus->parent);
+ proxy_path = qdev_get_dev_path(DEVICE(virtio_mmio_proxy));
+
+ /*
+ * If @format_transport_address is false, then we just perform the same as
+ * virtio_bus_get_dev_path(): we delegate the address formatting for the
+ * device on the virtio-mmio bus to the bus that the virtio-mmio proxy
+ * (i.e., the device that implements the virtio-mmio bus) resides on. In
+ * this case the base address of the virtio-mmio transport will be
+ * invisible.
+ */
+ if (!virtio_mmio_proxy->format_transport_address) {
+ return proxy_path;
+ }
+
+ /* Otherwise, we append the base address of the transport. */
+ proxy_sbd = SYS_BUS_DEVICE(virtio_mmio_proxy);
+ assert(proxy_sbd->num_mmio == 1);
+ assert(proxy_sbd->mmio[0].memory == &virtio_mmio_proxy->iomem);
+
+ if (proxy_path) {
+ path = g_strdup_printf("%s/virtio-mmio@" TARGET_FMT_plx, proxy_path,
+ proxy_sbd->mmio[0].addr);
+ } else {
+ path = g_strdup_printf("virtio-mmio@" TARGET_FMT_plx,
+ proxy_sbd->mmio[0].addr);
+ }
+ g_free(proxy_path);
+ return path;
+}
+
static void virtio_mmio_bus_class_init(ObjectClass *klass, void *data)
{
BusClass *bus_class = BUS_CLASS(klass);
@@ -516,6 +564,7 @@ static void virtio_mmio_bus_class_init(ObjectClass *klass, void *data)
k->ioeventfd_assign = virtio_mmio_ioeventfd_assign;
k->has_variable_vring_alignment = true;
bus_class->max_dev = 1;
+ bus_class->get_dev_path = virtio_mmio_bus_get_dev_path;
}
static const TypeInfo virtio_mmio_bus_info = {