[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 28/35] target/arm/ptw: Load stage-2 tables from realm physical spa
From: |
Peter Maydell |
Subject: |
[PULL 28/35] target/arm/ptw: Load stage-2 tables from realm physical space |
Date: |
Thu, 24 Aug 2023 10:28:29 +0100 |
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
In realm state, stage-2 translation tables are fetched from the realm
physical address space (R_PGRQD).
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20230809123706.1842548-2-jean-philippe@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/arm/ptw.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index 07832eb8f76..7a69968dd76 100644
--- a/target/arm/ptw.c
+++ b/target/arm/ptw.c
@@ -157,22 +157,32 @@ static ARMMMUIdx ptw_idx_for_stage_2(CPUARMState *env,
ARMMMUIdx stage2idx)
/*
* We're OK to check the current state of the CPU here because
- * (1) we always invalidate all TLBs when the SCR_EL3.NS bit changes
+ * (1) we always invalidate all TLBs when the SCR_EL3.NS or SCR_EL3.NSE bit
+ * changes.
* (2) there's no way to do a lookup that cares about Stage 2 for a
* different security state to the current one for AArch64, and AArch32
* never has a secure EL2. (AArch32 ATS12NSO[UP][RW] allow EL3 to do
* an NS stage 1+2 lookup while the NS bit is 0.)
*/
- if (!arm_is_secure_below_el3(env) || !arm_el_is_aa64(env, 3)) {
+ if (!arm_el_is_aa64(env, 3)) {
return ARMMMUIdx_Phys_NS;
}
- if (stage2idx == ARMMMUIdx_Stage2_S) {
- s2walk_secure = !(env->cp15.vstcr_el2 & VSTCR_SW);
- } else {
- s2walk_secure = !(env->cp15.vtcr_el2 & VTCR_NSW);
- }
- return s2walk_secure ? ARMMMUIdx_Phys_S : ARMMMUIdx_Phys_NS;
+ switch (arm_security_space_below_el3(env)) {
+ case ARMSS_NonSecure:
+ return ARMMMUIdx_Phys_NS;
+ case ARMSS_Realm:
+ return ARMMMUIdx_Phys_Realm;
+ case ARMSS_Secure:
+ if (stage2idx == ARMMMUIdx_Stage2_S) {
+ s2walk_secure = !(env->cp15.vstcr_el2 & VSTCR_SW);
+ } else {
+ s2walk_secure = !(env->cp15.vtcr_el2 & VTCR_NSW);
+ }
+ return s2walk_secure ? ARMMMUIdx_Phys_S : ARMMMUIdx_Phys_NS;
+ default:
+ g_assert_not_reached();
+ }
}
static bool regime_translation_big_endian(CPUARMState *env, ARMMMUIdx mmu_idx)
--
2.34.1
- [PULL 00/35] target-arm queue, Peter Maydell, 2023/08/24
- [PULL 05/35] qtest: irq_intercept_[out/in]: return FAIL if no intercepts are installed, Peter Maydell, 2023/08/24
- [PULL 03/35] qtest: implement named interception of out-GPIO, Peter Maydell, 2023/08/24
- [PULL 06/35] qtest: microbit-test: add tests for nRF51 DETECT, Peter Maydell, 2023/08/24
- [PULL 01/35] hw/gpio/nrf51: implement DETECT signal, Peter Maydell, 2023/08/24
- [PULL 02/35] qtest: factor out qtest_install_gpio_out_intercept, Peter Maydell, 2023/08/24
- [PULL 04/35] qtest: bail from irq_intercept_in if name is specified, Peter Maydell, 2023/08/24
- [PULL 28/35] target/arm/ptw: Load stage-2 tables from realm physical space,
Peter Maydell <=
- [PULL 13/35] target/arm/ptw: Don't set fi->s1ptw for UnsuppAtomicUpdate fault, Peter Maydell, 2023/08/24
- [PULL 24/35] target/arm/ptw: Set attributes correctly for MMU disabled data accesses, Peter Maydell, 2023/08/24
- [PULL 09/35] mips: Report an error when KVM_VM_MIPS_VZ is unavailable, Peter Maydell, 2023/08/24
- [PULL 16/35] target/arm/ptw: Pass ptw into get_phys_addr_pmsa*() and get_phys_addr_disabled(), Peter Maydell, 2023/08/24
- [PULL 11/35] accel/kvm: Free as when an error occurred, Peter Maydell, 2023/08/24
- [PULL 15/35] target/arm/ptw: Set s1ns bit in fault info more consistently, Peter Maydell, 2023/08/24
- [PULL 10/35] accel/kvm: Use negative KVM type for error propagation, Peter Maydell, 2023/08/24
- [PULL 32/35] target/arm/helper: Check SCR_EL3.{NSE, NS} encoding for AT instructions, Peter Maydell, 2023/08/24
- [PULL 35/35] target/arm: Fix 64-bit SSRA, Peter Maydell, 2023/08/24
- [PULL 30/35] target/arm: Skip granule protection checks for AT instructions, Peter Maydell, 2023/08/24