@samitouri / QOSamiQemu / commits / cd28d3e796

target/arm: migrate Granule Protection traps to registerfields

Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 20260422125250.1303100-10-alex.bennee@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Alex Bennée committed Apr 22, 2026 at 13:52 UTC cd28d3e7967993a8e6f2e81caf5669ac404c833b
1 file changed +27 -3
target/arm/syndrome.h
+27 -3
@@ -462,12 +462,36 @@ static inline uint32_t syn_bxjtrap(int cv, int cond, int rm)
462 return res;
463 }
464
465 +/*
466 + * ISS encoding for a Granule Protection Check exception
467 + *
468 + * These are only reported to EL3
469 + */
470 +FIELD(GPC_ISS, xFSC, 0, 6)
471 +FIELD(GPC_ISS, WnR, 6, 1) /* Write not Read */
472 +FIELD(GPC_ISS, S1PTW, 7, 1)
473 +FIELD(GPC_ISS, CM, 8, 1)
474 +FIELD(GPC_ISS, VNCR, 13, 1)
475 +FIELD(GPC_ISS, GPCSC, 14, 6)
476 +FIELD(GPC_ISS, InD, 20, 1) /* Instruction not Data access */
477 +FIELD(GPC_ISS, S2PTW, 21, 1)
478 +
479 static inline uint32_t syn_gpc(int s2ptw, int ind, int gpcsc, int vncr,
480 int cm, int s1ptw, int wnr, int fsc)
481 {
468 - return (EC_GPC << ARM_EL_EC_SHIFT) | ARM_EL_IL | (s2ptw << 21)
469 - | (ind << 20) | (gpcsc << 14) | (vncr << 13) | (cm << 8)
470 - | (s1ptw << 7) | (wnr << 6) | fsc;
482 + uint32_t res = syn_set_ec(0, EC_GPC);
483 + res = FIELD_DP32(res, SYNDROME, IL, 1);
484 +
485 + res = FIELD_DP32(res, GPC_ISS, S2PTW, s2ptw);
486 + res = FIELD_DP32(res, GPC_ISS, InD, ind);
487 + res = FIELD_DP32(res, GPC_ISS, GPCSC, gpcsc);
488 + res = FIELD_DP32(res, GPC_ISS, VNCR, vncr);
489 + res = FIELD_DP32(res, GPC_ISS, CM, cm);
490 + res = FIELD_DP32(res, GPC_ISS, S1PTW, s1ptw);
491 + res = FIELD_DP32(res, GPC_ISS, WnR, wnr);
492 + res = FIELD_DP32(res, GPC_ISS, xFSC, fsc);
493 +
494 + return res;
495 }
496
497 static inline uint32_t syn_insn_abort(int same_el, int ea, int s1ptw, int fsc)