[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 12/13] hw/arm/bcm2836: Hardcode correct CPU type
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 12/13] hw/arm/bcm2836: Hardcode correct CPU type |
Date: |
Mon, 19 Mar 2018 18:34:14 +0000 |
Now we have separate types for BCM2386 and BCM2387, we might as well
just hard-code the CPU type they use rather than having it passed
through as an object property. This then lets us put the initialization
of the CPU object in init rather than realize.
Note that this change means that it's no longer possible on
the command line to use -cpu to ask for a different kind of
CPU than the SoC supports. This was never a supported thing to
do anyway; we were just not sanity-checking the command line.
This does require us to only build the bcm2837 object on
TARGET_AARCH64 configs, since otherwise it won't instantiate
due to the missing cortex-a53 device and "make check" will fail.
Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Andrew Baumann <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-id: address@hidden
---
hw/arm/bcm2836.c | 24 +++++++++++++++---------
hw/arm/raspi.c | 2 --
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
index d775a33969..3e7e8ca791 100644
--- a/hw/arm/bcm2836.c
+++ b/hw/arm/bcm2836.c
@@ -25,23 +25,38 @@
struct BCM283XInfo {
const char *name;
+ const char *cpu_type;
int clusterid;
};
static const BCM283XInfo bcm283x_socs[] = {
{
.name = TYPE_BCM2836,
+ .cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"),
.clusterid = 0xf,
},
+#ifdef TARGET_AARCH64
{
.name = TYPE_BCM2837,
+ .cpu_type = ARM_CPU_TYPE_NAME("cortex-a53"),
.clusterid = 0x0,
},
+#endif
};
static void bcm2836_init(Object *obj)
{
BCM283XState *s = BCM283X(obj);
+ BCM283XClass *bc = BCM283X_GET_CLASS(obj);
+ const BCM283XInfo *info = bc->info;
+ int n;
+
+ for (n = 0; n < BCM283X_NCPUS; n++) {
+ object_initialize(&s->cpus[n], sizeof(s->cpus[n]),
+ info->cpu_type);
+ object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpus[n]),
+ &error_abort);
+ }
object_initialize(&s->control, sizeof(s->control), TYPE_BCM2836_CONTROL);
object_property_add_child(obj, "control", OBJECT(&s->control), NULL);
@@ -69,14 +84,6 @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
/* common peripherals from bcm2835 */
- obj = OBJECT(dev);
- for (n = 0; n < BCM283X_NCPUS; n++) {
- object_initialize(&s->cpus[n], sizeof(s->cpus[n]),
- s->cpu_type);
- object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpus[n]),
- &error_abort);
- }
-
obj = object_property_get_link(OBJECT(dev), "ram", &err);
if (obj == NULL) {
error_setg(errp, "%s: required ram link not found: %s",
@@ -166,7 +173,6 @@ static void bcm2836_realize(DeviceState *dev, Error **errp)
}
static Property bcm2836_props[] = {
- DEFINE_PROP_STRING("cpu-type", BCM283XState, cpu_type),
DEFINE_PROP_UINT32("enabled-cpus", BCM283XState, enabled_cpus,
BCM283X_NCPUS),
DEFINE_PROP_END_OF_LIST()
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index f588720138..ae15997669 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -150,8 +150,6 @@ static void raspi_init(MachineState *machine, int version)
/* Setup the SOC */
object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(&s->ram),
&error_abort);
- object_property_set_str(OBJECT(&s->soc), machine->cpu_type, "cpu-type",
- &error_abort);
object_property_set_int(OBJECT(&s->soc), smp_cpus, "enabled-cpus",
&error_abort);
int board_rev = version == 3 ? 0xa02082 : 0xa21041;
--
2.16.2
- [Qemu-devel] [PULL 02/13] dump: Update correct kdump phys_base field for AArch64, (continued)
- [Qemu-devel] [PULL 02/13] dump: Update correct kdump phys_base field for AArch64, Peter Maydell, 2018/03/19
- [Qemu-devel] [PULL 03/13] char: i.MX: Simplify imx_update(), Peter Maydell, 2018/03/19
- [Qemu-devel] [PULL 05/13] hw/arm/raspi: Don't do board-setup or secure-boot for raspi3, Peter Maydell, 2018/03/19
- [Qemu-devel] [PULL 04/13] char: i.MX: Add support for "TX complete" interrupt, Peter Maydell, 2018/03/19
- [Qemu-devel] [PULL 06/13] hw/arm/boot: assert that secure_boot and secure_board_setup are false for AArch64, Peter Maydell, 2018/03/19
- [Qemu-devel] [PULL 07/13] hw/arm/boot: If booting a kernel in EL2, set SCR_EL3.HCE, Peter Maydell, 2018/03/19
- [Qemu-devel] [PULL 08/13] hw/arm/bcm2386: Fix parent type of bcm2386, Peter Maydell, 2018/03/19
- [Qemu-devel] [PULL 09/13] hw/arm/bcm2836: Rename bcm2836 type/struct to bcm283x, Peter Maydell, 2018/03/19
- [Qemu-devel] [PULL 10/13] hw/arm/bcm2836: Create proper bcm2837 device, Peter Maydell, 2018/03/19
- [Qemu-devel] [PULL 11/13] hw/arm/bcm2836: Use correct affinity values for BCM2837, Peter Maydell, 2018/03/19
- [Qemu-devel] [PULL 12/13] hw/arm/bcm2836: Hardcode correct CPU type,
Peter Maydell <=
- [Qemu-devel] [PULL 13/13] hw/arm/raspi: Provide spin-loop code for AArch64 CPUs, Peter Maydell, 2018/03/19
- Re: [Qemu-devel] [PULL 00/13] target-arm queue, Peter Maydell, 2018/03/20