[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 16/18] hw/arm/fsl-imx7: Replace object_initialize(ARMCPU) by obje
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 16/18] hw/arm/fsl-imx7: Replace object_initialize(ARMCPU) by object_new() |
Date: |
Tue, 10 Jan 2023 17:44:04 +0100 |
Replace the ARMCPU field in FslIMX7State by a reference to
an allocated ARMCPU. Instead of initializing the field with
object_initialize(), allocate it with object_new().
As we don't access ARMCPU internal fields or size, we can
move from arm_ss[] to the more generic softmmu_ss[] the followin
units:
- fsl-imx7.c
- mcimx7d-sabre.c
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/arm/fsl-imx7.c | 6 +++---
hw/arm/mcimx7d-sabre.c | 2 +-
hw/arm/meson.build | 2 +-
include/hw/arm/fsl-imx7.h | 4 ++--
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
index 6115677d43..634ed299cc 100644
--- a/hw/arm/fsl-imx7.c
+++ b/hw/arm/fsl-imx7.c
@@ -38,8 +38,8 @@ static void fsl_imx7_init(Object *obj)
for (i = 0; i < MIN(ms->smp.cpus, FSL_IMX7_NUM_CPUS); i++) {
snprintf(name, NAME_SIZE, "cpu%d", i);
- object_initialize_child(obj, name, &s->cpu[i],
- ARM_CPU_TYPE_NAME("cortex-a7"));
+ s->cpu[i] = ARM_CPU(object_new(ARM_CPU_TYPE_NAME("cortex-a7")));
+ object_property_add_child(obj, name, OBJECT(s->cpu[i]));
}
/*
@@ -157,7 +157,7 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
}
for (i = 0; i < smp_cpus; i++) {
- o = OBJECT(&s->cpu[i]);
+ o = OBJECT(s->cpu[i]);
/* On uniprocessor, the CBAR is set to 0 */
if (smp_cpus > 1) {
diff --git a/hw/arm/mcimx7d-sabre.c b/hw/arm/mcimx7d-sabre.c
index 6182b15f19..ad46bf79c6 100644
--- a/hw/arm/mcimx7d-sabre.c
+++ b/hw/arm/mcimx7d-sabre.c
@@ -61,7 +61,7 @@ static void mcimx7d_sabre_init(MachineState *machine)
}
if (!qtest_enabled()) {
- arm_load_kernel(&s->cpu[0], machine, &boot_info);
+ arm_load_kernel(s->cpu[0], machine, &boot_info);
}
}
diff --git a/hw/arm/meson.build b/hw/arm/meson.build
index b244db5962..53ce301cbe 100644
--- a/hw/arm/meson.build
+++ b/hw/arm/meson.build
@@ -27,7 +27,6 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
'aspeed_ast2600.c',
'aspeed_ast10x0.c',
'fby35.c'))
-arm_ss.add(when: 'CONFIG_FSL_IMX7', if_true: files('fsl-imx7.c',
'mcimx7d-sabre.c'))
arm_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmuv3.c'))
arm_ss.add(when: 'CONFIG_FSL_IMX6UL', if_true: files('fsl-imx6ul.c',
'mcimx6ul-evk.c'))
@@ -41,6 +40,7 @@ softmmu_ss.add(when: 'CONFIG_EMCRAFT_SF2', if_true:
files('msf2-som.c'))
softmmu_ss.add(when: 'CONFIG_EXYNOS4', if_true: files('exynos4_boards.c'))
softmmu_ss.add(when: 'CONFIG_FSL_IMX25', if_true: files('fsl-imx25.c',
'imx25_pdk.c'))
softmmu_ss.add(when: 'CONFIG_FSL_IMX31', if_true: files('fsl-imx31.c',
'kzm.c'))
+softmmu_ss.add(when: 'CONFIG_FSL_IMX7', if_true: files('fsl-imx7.c',
'mcimx7d-sabre.c'))
softmmu_ss.add(when: 'CONFIG_GUMSTIX', if_true: files('gumstix.c'))
softmmu_ss.add(when: 'CONFIG_HIGHBANK', if_true: files('highbank.c'))
softmmu_ss.add(when: 'CONFIG_INTEGRATOR', if_true: files('integratorcp.c'))
diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h
index ed8c1ec813..97c9731db3 100644
--- a/include/hw/arm/fsl-imx7.h
+++ b/include/hw/arm/fsl-imx7.h
@@ -38,7 +38,7 @@
#include "hw/net/imx_fec.h"
#include "hw/pci-host/designware.h"
#include "hw/usb/chipidea.h"
-#include "target/arm/cpu.h"
+#include "hw/arm/cpu.h"
#include "qom/object.h"
#define TYPE_FSL_IMX7 "fsl-imx7"
@@ -65,7 +65,7 @@ struct FslIMX7State {
DeviceState parent_obj;
/*< public >*/
- ARMCPU cpu[FSL_IMX7_NUM_CPUS];
+ ARMCPU *cpu[FSL_IMX7_NUM_CPUS];
A15MPPrivState a7mpcore;
IMXGPTState gpt[FSL_IMX7_NUM_GPTS];
IMXGPIOState gpio[FSL_IMX7_NUM_GPIOS];
--
2.38.1
- [PATCH 08/18] hw/arm: Move units to softmmu[] by replacing "{target -> hw}/arm/cpu.h", (continued)
- [PATCH 13/18] hw/arm/fsl-imx: Correct GPIO/GPT index in QOM tree, Philippe Mathieu-Daudé, 2023/01/10
- [PATCH 14/18] hw/arm/fsl-imx25: Replace object_initialize(ARMCPU) by object_new(), Philippe Mathieu-Daudé, 2023/01/10
- [PATCH 15/18] hw/arm/fsl-imx31: Replace object_initialize(ARMCPU) by object_new(), Philippe Mathieu-Daudé, 2023/01/10
- [PATCH 16/18] hw/arm/fsl-imx7: Replace object_initialize(ARMCPU) by object_new(),
Philippe Mathieu-Daudé <=
- [PATCH 17/18] hw/arm/fsl-imx6: Replace object_initialize(ARMCPU) by object_new(), Philippe Mathieu-Daudé, 2023/01/10
- [PATCH 18/18] hw/arm/allwinner: Replace object_initialize(ARMCPU) by object_new(), Philippe Mathieu-Daudé, 2023/01/10