diff options
| author | Richard Henderson <richard.henderson@linaro.org> | 2025-09-25 17:11:31 -0700 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2025-10-07 11:26:10 +0100 |
| commit | 59bcd13b64bf54b35acac8a364b569964d7e0461 (patch) | |
| tree | 299df1f25914aa5410e7b5fdc0889f2b2d7f11fc /target/arm/ptw.c | |
| parent | ee45f4b4e9e58be886bb48b31ca58c2273f3630a (diff) | |
| download | focaccia-qemu-59bcd13b64bf54b35acac8a364b569964d7e0461.tar.gz focaccia-qemu-59bcd13b64bf54b35acac8a364b569964d7e0461.zip | |
target/arm: Implement SPAD, NSPAD, RLPAD
These bits disable all access to a particular address space. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-id: 20250926001134.295547-8-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target/arm/ptw.c')
| -rw-r--r-- | target/arm/ptw.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 56a3cd8fa0..36917be83e 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -387,7 +387,25 @@ static bool granule_protection_check(CPUARMState *env, uint64_t paddress, l0gptsz = 30 + FIELD_EX64(gpccr, GPCCR, L0GPTSZ); /* - * GPC Priority 2: Secure, Realm or Root address exceeds PPS. + * GPC Priority 2: Access to Secure, NonSecure or Realm is prevented + * by one of the GPCCR_EL3 address space disable bits (R_TCWMD). + * All of these bits are checked vs aa64_rme_gpc2 in gpccr_write. + */ + { + static const uint8_t disable_masks[4] = { + [ARMSS_Secure] = R_GPCCR_SPAD_MASK, + [ARMSS_NonSecure] = R_GPCCR_NSPAD_MASK, + [ARMSS_Root] = 0, + [ARMSS_Realm] = R_GPCCR_RLPAD_MASK, + }; + + if (gpccr & disable_masks[pspace]) { + goto fault_fail; + } + } + + /* + * GPC Priority 3: Secure, Realm or Root address exceeds PPS. * R_CPDSB: A NonSecure physical address input exceeding PPS * does not experience any fault. */ @@ -398,7 +416,7 @@ static bool granule_protection_check(CPUARMState *env, uint64_t paddress, goto fault_size; } - /* GPC Priority 3: the base address of GPTBR_EL3 exceeds PPS. */ + /* GPC Priority 4: the base address of GPTBR_EL3 exceeds PPS. */ tableaddr = env->cp15.gptbr_el3 << 12; if (tableaddr & ~pps_mask) { goto fault_size; @@ -502,6 +520,7 @@ static bool granule_protection_check(CPUARMState *env, uint64_t paddress, goto fault_walk; /* reserved */ } + fault_fail: fi->gpcf = GPCF_Fail; goto fault_common; fault_eabt: |