[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 10/40] target/arm: Copy dtb_compatible from ARMCPUClass
From: |
Richard Henderson |
Subject: |
[RFC PATCH 10/40] target/arm: Copy dtb_compatible from ARMCPUClass |
Date: |
Tue, 3 Jan 2023 10:16:16 -0800 |
Move the default initialization of dtb_compatible to arm_cpu_class_init,
and copy back to the instance in arm_cpu_init. Further class overrides
will come in a future patch.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/cpu-qom.h | 3 +++
target/arm/cpu.c | 15 ++++++++++-----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/target/arm/cpu-qom.h b/target/arm/cpu-qom.h
index 057978b9db..5509ef9d85 100644
--- a/target/arm/cpu-qom.h
+++ b/target/arm/cpu-qom.h
@@ -71,6 +71,9 @@ struct ARMCPUClass {
const ARMCPUInfo *info;
DeviceRealize parent_realize;
ResettablePhases parent_phases;
+
+ /* 'compatible' string for this CPU for Linux device trees */
+ const char *dtb_compatible;
};
void register_cp_regs_for_features(ARMCPU *cpu);
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index a6c6916f36..1bc45b2b25 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -1181,6 +1181,7 @@ uint64_t arm_cpu_mp_affinity(int idx, uint8_t clustersz)
static void arm_cpu_initfn(Object *obj)
{
ARMCPU *cpu = ARM_CPU(obj);
+ ARMCPUClass *acc = ARM_CPU_GET_CLASS(cpu);
cpu_set_cpustate_pointers(cpu);
cpu->cp_regs = g_hash_table_new_full(g_direct_hash, g_direct_equal,
@@ -1189,6 +1190,8 @@ static void arm_cpu_initfn(Object *obj)
QLIST_INIT(&cpu->pre_el_change_hooks);
QLIST_INIT(&cpu->el_change_hooks);
+ cpu->dtb_compatible = acc->dtb_compatible;
+
#ifdef CONFIG_USER_ONLY
# ifdef TARGET_AARCH64
/*
@@ -1220,11 +1223,6 @@ static void arm_cpu_initfn(Object *obj)
"pmu-interrupt", 1);
#endif
- /* DTB consumers generally don't in fact care what the 'compatible'
- * string is, so always provide some string and trust that a hypothetical
- * picky DTB consumer will also provide a helpful error message.
- */
- cpu->dtb_compatible = "qemu,unknown";
cpu->psci_version = QEMU_PSCI_VERSION_0_1; /* By default assume PSCI v0.1
*/
cpu->kvm_target = QEMU_KVM_ARM_TARGET_NONE;
@@ -2243,6 +2241,13 @@ static void arm_cpu_class_init(ObjectClass *oc, void
*data)
#ifdef CONFIG_TCG
cc->tcg_ops = &arm_tcg_ops;
#endif /* CONFIG_TCG */
+
+ /*
+ * DTB consumers generally don't in fact care what the 'compatible'
+ * string is, so always provide some string and trust that a hypothetical
+ * picky DTB consumer will also provide a helpful error message.
+ */
+ acc->dtb_compatible = "qemu,unknown";
}
static void arm_cpu_leaf_class_init(ObjectClass *oc, void *data)
--
2.34.1
- [RFC PATCH 18/40] target/arm: Create cpreg definition functions with GHashTable arg, (continued)
- [RFC PATCH 18/40] target/arm: Create cpreg definition functions with GHashTable arg, Richard Henderson, 2023/01/03
- [RFC PATCH 05/40] target/arm: Create arm_cpu_register_parent, Richard Henderson, 2023/01/03
- [RFC PATCH 07/40] target/arm: Create TYPE_ARM_V7M_CPU, Richard Henderson, 2023/01/03
- [RFC PATCH 02/40] qom: Introduce class_late_init, Richard Henderson, 2023/01/03
- [RFC PATCH 08/40] target/arm: Pass ARMCPUClass to ARMCPUInfo.class_init, Richard Henderson, 2023/01/03
- [RFC PATCH 14/40] target/arm: Rename arm_cpu_mp_affinity, Richard Henderson, 2023/01/03
- [RFC PATCH 10/40] target/arm: Copy dtb_compatible from ARMCPUClass,
Richard Henderson <=
- [RFC PATCH 13/40] hw/arm/bcm2836: Set mp-affinity property in realize, Richard Henderson, 2023/01/03
- [RFC PATCH 15/40] target/arm: Create arm_cpu_mp_affinity, Richard Henderson, 2023/01/03
- [RFC PATCH 26/40] target/arm: Rename 'cpu' to 'acc' in class init functions, Richard Henderson, 2023/01/03
- [RFC PATCH 19/40] target/arm: Move most cpu initialization to the class, Richard Henderson, 2023/01/03
- [RFC PATCH 21/40] target/arm: Remove aarch64 check from aarch64_host_object_init, Richard Henderson, 2023/01/03