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

Philippe Mathieu-Daudé posted 1 patch 3 days, 10 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250925032151.73250-1-philmd@linaro.org
Maintainers: Peter Maydell <peter.maydell@linaro.org>
target/arm/helper.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] target/arm: Replace magic GIC values by proper definitions
Posted by Philippe Mathieu-Daudé 3 days, 10 hours ago
Prefer the FIELD_DP64() macro and self-describing GIC
definitions over magic values.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/arm/helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/arm/helper.c b/target/arm/helper.c
index c44294711f8..da8aa7b9d08 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -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;
 }
-- 
2.51.0


Re: [PATCH] target/arm: Replace magic GIC values by proper definitions
Posted by Peter Maydell 2 days, 4 hours ago
On Thu, 25 Sept 2025 at 04:21, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> Prefer the FIELD_DP64() macro and self-describing GIC
> definitions over magic values.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---




Applied to target-arm.next, thanks.

-- PMM
Re: [PATCH] target/arm: Replace magic GIC values by proper definitions
Posted by Richard Henderson 2 days, 18 hours ago
On 9/24/25 20:21, Philippe Mathieu-Daudé wrote:
> Prefer the FIELD_DP64() macro and self-describing GIC
> definitions over magic values.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   target/arm/helper.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target/arm/helper.c b/target/arm/helper.c
> index c44294711f8..da8aa7b9d08 100644
> --- a/target/arm/helper.c
> +++ b/target/arm/helper.c
> @@ -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;
>   }

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~