qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: qemu-devel@nongnu.org, atar4qemu@gmail.com
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Subject: [Qemu-devel] [PATCHv3 06/13] sparc32_dma: use object link instead of qdev property to pass IOMMU reference
Date: Sat, 14 Oct 2017 19:38:55 +0100	[thread overview]
Message-ID: <1508006342-5304-7-git-send-email-mark.cave-ayland@ilande.co.uk> (raw)
In-Reply-To: <1508006342-5304-1-git-send-email-mark.cave-ayland@ilande.co.uk>

This enables us to remove the last remaining (opaque) qdev property. Whilst we
are here, also update iommu_init() to use TYPE_SUN4M_IOMMU instead of a
hardcoded string.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/dma/sparc32_dma.c |   13 +++++--------
 hw/sparc/sun4m.c     |    4 ++--
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/hw/dma/sparc32_dma.c b/hw/dma/sparc32_dma.c
index ae8fa06..c56a2ba 100644
--- a/hw/dma/sparc32_dma.c
+++ b/hw/dma/sparc32_dma.c
@@ -263,24 +263,21 @@ static void sparc32_dma_device_init(Object *obj)
 
     sysbus_init_mmio(sbd, &s->iomem);
 
+    object_property_add_link(OBJECT(dev), "iommu", TYPE_SUN4M_IOMMU,
+                             (Object **) &s->iommu,
+                             qdev_prop_allow_set_link_before_realize,
+                             0, NULL);
+
     qdev_init_gpio_in(dev, dma_set_irq, 1);
     qdev_init_gpio_out(dev, s->gpio, 2);
 }
 
-static Property sparc32_dma_device_properties[] = {
-    DEFINE_PROP_PTR("iommu_opaque", DMADeviceState, iommu),
-    DEFINE_PROP_END_OF_LIST(),
-};
-
 static void sparc32_dma_device_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->reset = sparc32_dma_device_reset;
     dc->vmsd = &vmstate_sparc32_dma_device;
-    dc->props = sparc32_dma_device_properties;
-    /* Reason: pointer property "iommu_opaque" */
-    dc->user_creatable = false;
 }
 
 static const TypeInfo sparc32_dma_device_info = {
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 4f2ed4b..12d36b5 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -297,7 +297,7 @@ static void *iommu_init(hwaddr addr, uint32_t version, qemu_irq irq)
     DeviceState *dev;
     SysBusDevice *s;
 
-    dev = qdev_create(NULL, "iommu");
+    dev = qdev_create(NULL, TYPE_SUN4M_IOMMU);
     qdev_prop_set_uint32(dev, "version", version);
     qdev_init_nofail(dev);
     s = SYS_BUS_DEVICE(dev);
@@ -313,7 +313,7 @@ static void *sparc32_dma_init(hwaddr daddr, void *iommu, int is_ledma)
     SysBusDevice *s;
 
     dev = qdev_create(NULL, is_ledma ? "sparc32-ledma" : "sparc32-espdma");
-    qdev_prop_set_ptr(dev, "iommu_opaque", iommu);
+    object_property_set_link(OBJECT(dev), OBJECT(iommu), "iommu", &error_abort);
     qdev_init_nofail(dev);
     s = SYS_BUS_DEVICE(dev);
     sysbus_mmio_map(s, 0, daddr);
-- 
1.7.10.4

  parent reply	other threads:[~2017-10-14 18:39 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-14 18:38 [Qemu-devel] [PATCHv3 00/13] sun4m: sparc32_dma tidy-ups Mark Cave-Ayland
2017-10-14 18:38 ` [Qemu-devel] [PATCHv3 01/13] sparc32_dma: rename SPARC32_DMA type to SPARC32_DMA_DEVICE Mark Cave-Ayland
2017-10-19  4:26   ` Philippe Mathieu-Daudé
2017-10-20 12:39     ` Mark Cave-Ayland
2017-10-27 16:25       ` Philippe Mathieu-Daudé
2017-10-14 18:38 ` [Qemu-devel] [PATCHv3 02/13] sparc32_dma: split esp and le into separate DMA devices Mark Cave-Ayland
2017-10-19  4:33   ` Philippe Mathieu-Daudé
2017-10-20 12:41     ` Mark Cave-Ayland
2017-10-27 16:26       ` Philippe Mathieu-Daudé
2017-10-14 18:38 ` [Qemu-devel] [PATCHv3 03/13] sparc32_dma: move type declarations from sparc32_dma.c to sparc32_dma.h Mark Cave-Ayland
2017-10-14 18:38 ` [Qemu-devel] [PATCHv3 04/13] sun4m: move DMA device wiring from sparc32_dma_init() to sun4m_hw_init() Mark Cave-Ayland
2017-10-14 18:38 ` [Qemu-devel] [PATCHv3 05/13] sun4m_iommu: move TYPE_SUN4M_IOMMU declaration to sun4m.h Mark Cave-Ayland
2017-10-19  4:37   ` Philippe Mathieu-Daudé
2017-10-20 12:47     ` Mark Cave-Ayland
2017-10-14 18:38 ` Mark Cave-Ayland [this message]
2017-10-19  4:38   ` [Qemu-devel] [PATCHv3 06/13] sparc32_dma: use object link instead of qdev property to pass IOMMU reference Philippe Mathieu-Daudé
2017-10-14 18:38 ` [Qemu-devel] [PATCHv3 07/13] esp: move TYPE_ESP and SysBusESPState from esp.c to esp.h Mark Cave-Ayland
2017-10-25 10:42   ` Peter Maydell
2017-10-14 18:38 ` [Qemu-devel] [PATCHv3 08/13] sparc32_dma: make esp device child of espdma device Mark Cave-Ayland
2017-10-14 18:38 ` [Qemu-devel] [PATCHv3 09/13] lance: move TYPE_LANCE and SysBusPCNetState from lance.c to sun4m.h Mark Cave-Ayland
2017-10-25 10:44   ` Peter Maydell
2017-10-14 18:38 ` [Qemu-devel] [PATCHv3 10/13] sparc32_dma: make lance device child of ledma device Mark Cave-Ayland
2017-10-14 18:39 ` [Qemu-devel] [PATCHv3 11/13] sparc32_dma: introduce new SPARC32_DMA type container object Mark Cave-Ayland
2017-10-14 18:39 ` [Qemu-devel] [PATCHv3 12/13] sparc32_dma: remove is_ledma hack and replace with memory region alias Mark Cave-Ayland
2017-10-14 18:39 ` [Qemu-devel] [PATCHv3 13/13] sparc32_dma: add len to esp/le DMA memory tracing Mark Cave-Ayland
2017-10-19  4:45   ` Philippe Mathieu-Daudé
2017-10-14 19:23 ` [Qemu-devel] [PATCHv3 00/13] sun4m: sparc32_dma tidy-ups no-reply
2017-10-15  7:14   ` Mark Cave-Ayland
2017-10-18  9:12 ` Artyom Tarasenko

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=1508006342-5304-7-git-send-email-mark.cave-ayland@ilande.co.uk \
    --to=mark.cave-ayland@ilande.co.uk \
    --cc=atar4qemu@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).