All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Cédric Le Goater" <clg@kaod.org>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Gavin Shan" <gshan@redhat.com>
Subject: [PULL 05/17] hw/arm/aspeed: Introduce aspeed_soc_cpu_type() helper
Date: Thu,  1 Feb 2024 15:12:41 +0100	[thread overview]
Message-ID: <20240201141253.806055-6-clg@kaod.org> (raw)
In-Reply-To: <20240201141253.806055-1-clg@kaod.org>

From: Philippe Mathieu-Daudé <philmd@linaro.org>

In order to alter AspeedSoCClass::cpu_type in the next
commit, introduce the aspeed_soc_cpu_type() helper to
retrieve the per-SoC CPU type from AspeedSoCClass.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 include/hw/arm/aspeed_soc.h | 1 +
 hw/arm/aspeed_ast10x0.c     | 2 +-
 hw/arm/aspeed_ast2400.c     | 3 ++-
 hw/arm/aspeed_ast2600.c     | 3 ++-
 hw/arm/aspeed_soc_common.c  | 5 +++++
 5 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
index cb832bc1ee14..a060a5991874 100644
--- a/include/hw/arm/aspeed_soc.h
+++ b/include/hw/arm/aspeed_soc.h
@@ -143,6 +143,7 @@ struct AspeedSoCClass {
     qemu_irq (*get_irq)(AspeedSoCState *s, int dev);
 };
 
+const char *aspeed_soc_cpu_type(AspeedSoCClass *sc);
 
 enum {
     ASPEED_DEV_SPI_BOOT,
diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c
index 8becb146a8df..dca601a3f9b6 100644
--- a/hw/arm/aspeed_ast10x0.c
+++ b/hw/arm/aspeed_ast10x0.c
@@ -211,7 +211,7 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
     /* AST1030 CPU Core */
     armv7m = DEVICE(&a->armv7m);
     qdev_prop_set_uint32(armv7m, "num-irq", 256);
-    qdev_prop_set_string(armv7m, "cpu-type", sc->cpu_type);
+    qdev_prop_set_string(armv7m, "cpu-type", aspeed_soc_cpu_type(sc));
     qdev_connect_clock_in(armv7m, "cpuclk", s->sysclk);
     object_property_set_link(OBJECT(&a->armv7m), "memory",
                              OBJECT(s->memory), &error_abort);
diff --git a/hw/arm/aspeed_ast2400.c b/hw/arm/aspeed_ast2400.c
index ad76035528fd..3baf95916d46 100644
--- a/hw/arm/aspeed_ast2400.c
+++ b/hw/arm/aspeed_ast2400.c
@@ -156,7 +156,8 @@ static void aspeed_ast2400_soc_init(Object *obj)
     }
 
     for (i = 0; i < sc->num_cpus; i++) {
-        object_initialize_child(obj, "cpu[*]", &a->cpu[i], sc->cpu_type);
+        object_initialize_child(obj, "cpu[*]", &a->cpu[i],
+                                aspeed_soc_cpu_type(sc));
     }
 
     snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname);
diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c
index 386a88d4e0f9..b264433cf095 100644
--- a/hw/arm/aspeed_ast2600.c
+++ b/hw/arm/aspeed_ast2600.c
@@ -158,7 +158,8 @@ static void aspeed_soc_ast2600_init(Object *obj)
     }
 
     for (i = 0; i < sc->num_cpus; i++) {
-        object_initialize_child(obj, "cpu[*]", &a->cpu[i], sc->cpu_type);
+        object_initialize_child(obj, "cpu[*]", &a->cpu[i],
+                                aspeed_soc_cpu_type(sc));
     }
 
     snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname);
diff --git a/hw/arm/aspeed_soc_common.c b/hw/arm/aspeed_soc_common.c
index 828f61093bfa..36ca189ce960 100644
--- a/hw/arm/aspeed_soc_common.c
+++ b/hw/arm/aspeed_soc_common.c
@@ -18,6 +18,11 @@
 #include "hw/char/serial.h"
 
 
+const char *aspeed_soc_cpu_type(AspeedSoCClass *sc)
+{
+    return sc->cpu_type;
+}
+
 qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int dev)
 {
     return ASPEED_SOC_GET_CLASS(s)->get_irq(s, dev);
-- 
2.43.0



  parent reply	other threads:[~2024-02-01 14:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-01 14:12 [PULL v2 00/17] aspeed queue Cédric Le Goater
2024-02-01 14:12 ` [PULL 01/17] tests/avocado/machine_aspeed.py: Update buildroot images to 2023.11 Cédric Le Goater
2024-02-01 14:12 ` [PULL 02/17] hw/arm/aspeed: Remove dead code Cédric Le Goater
2024-02-01 14:12 ` [PULL 03/17] hw/arm/aspeed: Set default CPU count using aspeed_soc_num_cpus() Cédric Le Goater
2024-02-01 14:12 ` [PULL 04/17] hw/arm/aspeed: Init CPU defaults in a common helper Cédric Le Goater
2024-02-01 14:12 ` Cédric Le Goater [this message]
2024-02-01 14:12 ` [PULL 06/17] hw/arm/aspeed: Check for CPU types in machine_run_board_init() Cédric Le Goater
2024-02-01 14:12 ` [PULL 07/17] hw/fsi: Introduce IBM's Local bus Cédric Le Goater
2024-02-01 14:12 ` [PULL 08/17] hw/fsi: Introduce IBM's scratchpad device Cédric Le Goater
2024-02-01 14:12 ` [PULL 09/17] hw/fsi: Introduce IBM's FSI Bus Cédric Le Goater
2024-02-01 14:12 ` [PULL 10/17] hw/fsi: Introduce IBM's fsi-slave model Cédric Le Goater
2024-02-01 14:12 ` [PULL 11/17] hw/fsi: Introduce IBM's cfam Cédric Le Goater
2024-02-01 14:12 ` [PULL 12/17] hw/fsi: Introduce IBM's FSI master Cédric Le Goater
2024-02-01 14:12 ` [PULL 13/17] hw/fsi: Aspeed APB2OPB & On-chip peripheral bus Cédric Le Goater
2024-02-01 14:12 ` [PULL 14/17] hw/arm: Hook up FSI module in AST2600 Cédric Le Goater
2024-02-01 14:12 ` [PULL 15/17] hw/fsi: Added qtest Cédric Le Goater
2024-02-01 14:12 ` [PULL 16/17] hw/fsi: Added FSI documentation Cédric Le Goater
2024-02-01 14:12 ` [PULL 17/17] hw/fsi: Update MAINTAINER list Cédric Le Goater
2024-02-02 13:50 ` [PULL v2 00/17] aspeed queue Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2024-01-26 13:31 [PULL " Cédric Le Goater
2024-01-26 13:32 ` [PULL 05/17] hw/arm/aspeed: Introduce aspeed_soc_cpu_type() helper Cédric Le Goater

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=20240201141253.806055-6-clg@kaod.org \
    --to=clg@kaod.org \
    --cc=gshan@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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.