Skip to contentSkip to conversation

target/arm: Replace magic GIC values by proper definitions

PATCH Applied Philippe Mathieu-Daudé 3 participants 3 messages Sep 25, 2025 – Sep 26, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/arm: Replace magic GIC values by proper definitions

Prefer the FIELD_DP64() macro and self-describing GIC definitions over magic values.

---
 target/arm/helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/arm/helper.c +2 -2
index c44294711f8..da8aa7b9d08 100644
@@ -5184,7 +5184,7 @@ static uint64_t id_pfr1_read(CPUARMState *env, const ARMCPRegInfo *ri)
     uint64_t pfr1 = GET_IDREG(&cpu->isar, ID_PFR1);
 
     if (env->gicv3state) {
-        pfr1 |= 1 << 28;
+        pfr1 = FIELD_DP64(pfr1, ID_PFR1, GIC, 1);
     }
     return pfr1;
 }
@@ -5195,7 +5195,7 @@ static uint64_t id_aa64pfr0_read(CPUARMState *env, const ARMCPRegInfo *ri)
     uint64_t pfr0 = GET_IDREG(&cpu->isar, ID_AA64PFR0);
 
     if (env->gicv3state) {
-        pfr0 |= 1 << 24;
+        pfr0 = FIELD_DP64(pfr0, ID_AA64PFR0, GIC, 1);
     }
     return pfr0;
 }
Signature · 1 line
2.51.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 22 lines · Philippe Mathieu-Daudé

Prefer the FIELD_DP64() macro and self-describing GIC definitions over magic values.

---
  target/arm/helper.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
target/arm/helper.c +1 -1
index c44294711f8..da8aa7b9d08 100644
@@ -5184,7 +5184,7 @@ static uint64_t id_pfr1_read(CPUARMState *env, const ARMCPRegInfo *ri)
      uint64_t pfr1 = GET_IDREG(&cpu->isar, ID_PFR1);
 
      if (env->gicv3state) {
-        pfr1 |= 1 << 28;
+        pfr1 = FIELD_DP64(pfr1, ID_PFR1, GIC, 1);
      }
      return pfr1;
  }

target/arm/helper.c static uint64_t id_aa64pfr0_read(CPUARMState *env, const ARMCPRegInfo *ri) · line 5201

Quoted 8 lines
target/arm/helper.c +1 -1
@@ -5195,7 +5195,7 @@ static uint64_t id_aa64pfr0_read(CPUARMState *env, const ARMCPRegInfo *ri)
      uint64_t pfr0 = GET_IDREG(&cpu->isar, ID_AA64PFR0);
 
      if (env->gicv3state) {
-        pfr0 |= 1 << 24;
+        pfr0 = FIELD_DP64(pfr0, ID_AA64PFR0, GIC, 1);
      }
      return pfr0;
  }

r~