qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH 11/40] target/arm: Copy features from ARMCPUClass


From: Richard Henderson
Subject: Re: [RFC PATCH 11/40] target/arm: Copy features from ARMCPUClass
Date: Thu, 5 Jan 2023 18:19:23 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

On 1/5/23 14:04, Philippe Mathieu-Daudé wrote:
On 3/1/23 19:16, Richard Henderson wrote:
Create a features member in ARMCPUClass and copy to the instance in
arm_cpu_init.  Settings of this value will come in a future patch.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
  target/arm/cpu-qom.h | 18 ++++++++++++++++++
  target/arm/cpu.c     |  1 +
  2 files changed, 19 insertions(+)

diff --git a/target/arm/cpu-qom.h b/target/arm/cpu-qom.h
index 5509ef9d85..ac58cc3a87 100644
--- a/target/arm/cpu-qom.h
+++ b/target/arm/cpu-qom.h
@@ -74,8 +74,26 @@ struct ARMCPUClass {
      /* 'compatible' string for this CPU for Linux device trees */
      const char *dtb_compatible;
+
+    /* Internal CPU feature flags.  */
+    uint64_t features;
  };
+static inline int arm_class_feature(ARMCPUClass *acc, int feature)
+{
+    return (acc->features & (1ULL << feature)) != 0;
+}
+
+static inline void set_class_feature(ARMCPUClass *acc, int feature)
+{
+    acc->features |= 1ULL << feature;
+}
+
+static inline void unset_class_feature(ARMCPUClass *acc, int feature)
+{
+    acc->features &= ~(1ULL << feature);
+}

These helpers are not used until patch #19 "target/arm: Move most cpu
initialization to the class".

I know, but I thought it clearer to introduce them with the field.


r~


  void register_cp_regs_for_features(ARMCPU *cpu);
  void init_cpreg_list(ARMCPU *cpu);
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 1bc45b2b25..d64b86b6a5 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -1191,6 +1191,7 @@ static void arm_cpu_initfn(Object *obj)
      QLIST_INIT(&cpu->el_change_hooks);
      cpu->dtb_compatible = acc->dtb_compatible;
+    cpu->env.features = acc->features;
  #ifdef CONFIG_USER_ONLY
  # ifdef TARGET_AARCH64





reply via email to

[Prev in Thread] Current Thread [Next in Thread]