All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: qemu-devel@nongnu.org
Cc: figlesia@xilinx.com, peter.maydell@linaro.org,
	sstabellini@kernel.org, edgar.iglesias@xilinx.com,
	sai.pavan.boddu@xilinx.com, frasse.iglesias@gmail.com,
	alistair@alistair23.me, richard.henderson@linaro.org,
	frederic.konrad@adacore.com, qemu-arm@nongnu.org,
	philmd@redhat.com, luc.michel@greensocs.com
Subject: [PATCH v1 07/11] hw/arm: versal: Embedd the APUs into the SoC type
Date: Mon, 27 Apr 2020 20:16:45 +0200	[thread overview]
Message-ID: <20200427181649.26851-8-edgar.iglesias@gmail.com> (raw)
In-Reply-To: <20200427181649.26851-1-edgar.iglesias@gmail.com>

From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>

Embedd the APUs into the SoC type.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 hw/arm/xlnx-versal-virt.c    |  4 ++--
 hw/arm/xlnx-versal.c         | 19 +++++--------------
 include/hw/arm/xlnx-versal.h |  2 +-
 3 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
index 8a608074d1..d7be1ad494 100644
--- a/hw/arm/xlnx-versal-virt.c
+++ b/hw/arm/xlnx-versal-virt.c
@@ -469,9 +469,9 @@ static void versal_virt_init(MachineState *machine)
     s->binfo.get_dtb = versal_virt_get_dtb;
     s->binfo.modify_dtb = versal_virt_modify_dtb;
     if (machine->kernel_filename) {
-        arm_load_kernel(s->soc.fpd.apu.cpu[0], machine, &s->binfo);
+        arm_load_kernel(&s->soc.fpd.apu.cpu[0], machine, &s->binfo);
     } else {
-        AddressSpace *as = arm_boot_address_space(s->soc.fpd.apu.cpu[0],
+        AddressSpace *as = arm_boot_address_space(&s->soc.fpd.apu.cpu[0],
                                                   &s->binfo);
         /* Some boot-loaders (e.g u-boot) don't like blobs at address 0 (NULL).
          * Offset things by 4K.  */
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
index ebd2dc51be..c8a296e2e0 100644
--- a/hw/arm/xlnx-versal.c
+++ b/hw/arm/xlnx-versal.c
@@ -31,19 +31,11 @@ static void versal_create_apu_cpus(Versal *s)
 
     for (i = 0; i < ARRAY_SIZE(s->fpd.apu.cpu); i++) {
         Object *obj;
-        char *name;
-
-        obj = object_new(XLNX_VERSAL_ACPU_TYPE);
-        if (!obj) {
-            error_report("Unable to create apu.cpu[%d] of type %s",
-                         i, XLNX_VERSAL_ACPU_TYPE);
-            exit(EXIT_FAILURE);
-        }
-
-        name = g_strdup_printf("apu-cpu[%d]", i);
-        object_property_add_child(OBJECT(s), name, obj, &error_fatal);
-        g_free(name);
 
+        object_initialize_child(OBJECT(s), "apu-cpu[*]",
+                                &s->fpd.apu.cpu[i], sizeof(s->fpd.apu.cpu[i]),
+                                XLNX_VERSAL_ACPU_TYPE, &error_abort, NULL);
+        obj = OBJECT(&s->fpd.apu.cpu[i]);
         object_property_set_int(obj, s->cfg.psci_conduit,
                                 "psci-conduit", &error_abort);
         if (i) {
@@ -57,7 +49,6 @@ static void versal_create_apu_cpus(Versal *s)
         object_property_set_link(obj, OBJECT(&s->fpd.apu.mr), "memory",
                                  &error_abort);
         object_property_set_bool(obj, true, "realized", &error_fatal);
-        s->fpd.apu.cpu[i] = ARM_CPU(obj);
     }
 }
 
@@ -95,7 +86,7 @@ static void versal_create_apu_gic(Versal *s, qemu_irq *pic)
     }
 
     for (i = 0; i < nr_apu_cpus; i++) {
-        DeviceState *cpudev = DEVICE(s->fpd.apu.cpu[i]);
+        DeviceState *cpudev = DEVICE(&s->fpd.apu.cpu[i]);
         int ppibase = XLNX_VERSAL_NR_IRQS + i * GIC_INTERNAL + GIC_NR_SGIS;
         qemu_irq maint_irq;
         int ti;
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
index 94b7826fd4..426b66449d 100644
--- a/include/hw/arm/xlnx-versal.h
+++ b/include/hw/arm/xlnx-versal.h
@@ -36,7 +36,7 @@ typedef struct Versal {
     struct {
         struct {
             MemoryRegion mr;
-            ARMCPU *cpu[XLNX_VERSAL_NR_ACPUS];
+            ARMCPU cpu[XLNX_VERSAL_NR_ACPUS];
             GICv3State gic;
         } apu;
     } fpd;
-- 
2.20.1



  parent reply	other threads:[~2020-04-27 18:21 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-27 18:16 [PATCH v1 00/11] hw/arm: versal: Add SD and the RTC Edgar E. Iglesias
2020-04-27 18:16 ` [PATCH v1 01/11] hw/arm: versal: Remove inclusion of arm_gicv3_common.h Edgar E. Iglesias
2020-04-27 20:08   ` Alistair Francis
2020-04-29  7:23   ` Luc Michel
2020-04-27 18:16 ` [PATCH v1 02/11] hw/arm: versal: Move misplaced comment Edgar E. Iglesias
2020-04-27 20:08   ` Alistair Francis
2020-04-28  7:46   ` Philippe Mathieu-Daudé
2020-04-29  7:23   ` Luc Michel
2020-04-27 18:16 ` [PATCH v1 03/11] hw/arm: versal-virt: Fix typo xlnx-ve -> xlnx-versal Edgar E. Iglesias
2020-04-27 22:18   ` Alistair Francis
2020-04-28  7:46   ` Philippe Mathieu-Daudé
2020-04-29  7:24   ` Luc Michel
2020-04-27 18:16 ` [PATCH v1 04/11] hw/arm: versal: Embedd the UARTs into the SoC type Edgar E. Iglesias
2020-04-27 22:16   ` Alistair Francis
2020-04-28  7:47   ` Philippe Mathieu-Daudé
2020-04-29  7:27   ` Luc Michel
2020-04-27 18:16 ` [PATCH v1 05/11] hw/arm: versal: Embedd the GEMs " Edgar E. Iglesias
2020-04-27 22:17   ` Alistair Francis
2020-04-28  7:48   ` Philippe Mathieu-Daudé
2020-04-29  7:27   ` Luc Michel
2020-04-27 18:16 ` [PATCH v1 06/11] hw/arm: versal: Embedd the ADMAs " Edgar E. Iglesias
2020-04-27 22:18   ` Alistair Francis
2020-04-28  7:49   ` Philippe Mathieu-Daudé
2020-04-29  7:28   ` Luc Michel
2020-04-27 18:16 ` Edgar E. Iglesias [this message]
2020-04-27 22:20   ` [PATCH v1 07/11] hw/arm: versal: Embedd the APUs " Alistair Francis
2020-04-28  7:50   ` Philippe Mathieu-Daudé
2020-04-29  7:28   ` Luc Michel
2020-04-27 18:16 ` [PATCH v1 08/11] hw/arm: versal: Add support for SD Edgar E. Iglesias
2020-04-27 22:24   ` Alistair Francis
2020-04-28  7:51   ` Philippe Mathieu-Daudé
2020-04-29  7:28   ` Luc Michel
2020-04-27 18:16 ` [PATCH v1 09/11] hw/arm: versal: Add support for the RTC Edgar E. Iglesias
2020-04-28  8:01   ` Philippe Mathieu-Daudé
2020-04-28 17:51   ` Alistair Francis
2020-04-29  7:28   ` Luc Michel
2020-04-27 18:16 ` [PATCH v1 10/11] hw/arm: versal-virt: Add support for SD Edgar E. Iglesias
2020-04-28 17:54   ` Alistair Francis
2020-04-29  7:36   ` Luc Michel
2020-04-27 18:16 ` [PATCH v1 11/11] hw/arm: versal-virt: Add support for the RTC Edgar E. Iglesias
2020-04-28 17:55   ` Alistair Francis
2020-04-29  7:57   ` Luc Michel
2020-05-04 10:13 ` [PATCH v1 00/11] hw/arm: versal: Add SD and " 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=20200427181649.26851-8-edgar.iglesias@gmail.com \
    --to=edgar.iglesias@gmail.com \
    --cc=alistair@alistair23.me \
    --cc=edgar.iglesias@xilinx.com \
    --cc=figlesia@xilinx.com \
    --cc=frasse.iglesias@gmail.com \
    --cc=frederic.konrad@adacore.com \
    --cc=luc.michel@greensocs.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=sai.pavan.boddu@xilinx.com \
    --cc=sstabellini@kernel.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.