[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 18/28] target/arm: Hoist read of *is_secure in S1_ptw_translate
From: |
Peter Maydell |
Subject: |
[PULL 18/28] target/arm: Hoist read of *is_secure in S1_ptw_translate |
Date: |
Mon, 10 Oct 2022 15:27:20 +0100 |
From: Richard Henderson <richard.henderson@linaro.org>
Rename the argument to is_secure_ptr, and introduce a
local variable is_secure with the value. We only write
back to the pointer toward the end of the function.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20221001162318.153420-15-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/arm/ptw.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index b3e0db19369..b40b4586f87 100644
--- a/target/arm/ptw.c
+++ b/target/arm/ptw.c
@@ -207,24 +207,25 @@ static bool ptw_attrs_are_device(CPUARMState *env,
ARMCacheAttrs cacheattrs)
/* Translate a S1 pagetable walk through S2 if needed. */
static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx,
- hwaddr addr, bool *is_secure,
+ hwaddr addr, bool *is_secure_ptr,
ARMMMUFaultInfo *fi)
{
- ARMMMUIdx s2_mmu_idx = *is_secure ? ARMMMUIdx_Stage2_S : ARMMMUIdx_Stage2;
+ bool is_secure = *is_secure_ptr;
+ ARMMMUIdx s2_mmu_idx = is_secure ? ARMMMUIdx_Stage2_S : ARMMMUIdx_Stage2;
if (arm_mmu_idx_is_stage1_of_2(mmu_idx) &&
- !regime_translation_disabled(env, s2_mmu_idx, *is_secure)) {
+ !regime_translation_disabled(env, s2_mmu_idx, is_secure)) {
GetPhysAddrResult s2 = {};
int ret;
ret = get_phys_addr_lpae(env, addr, MMU_DATA_LOAD, s2_mmu_idx,
- *is_secure, false, &s2, fi);
+ is_secure, false, &s2, fi);
if (ret) {
assert(fi->type != ARMFault_None);
fi->s2addr = addr;
fi->stage2 = true;
fi->s1ptw = true;
- fi->s1ns = !*is_secure;
+ fi->s1ns = !is_secure;
return ~0;
}
if ((arm_hcr_el2_eff(env) & HCR_PTW) &&
@@ -237,19 +238,20 @@ static hwaddr S1_ptw_translate(CPUARMState *env,
ARMMMUIdx mmu_idx,
fi->s2addr = addr;
fi->stage2 = true;
fi->s1ptw = true;
- fi->s1ns = !*is_secure;
+ fi->s1ns = !is_secure;
return ~0;
}
if (arm_is_secure_below_el3(env)) {
/* Check if page table walk is to secure or non-secure PA space. */
- if (*is_secure) {
- *is_secure = !(env->cp15.vstcr_el2 & VSTCR_SW);
+ if (is_secure) {
+ is_secure = !(env->cp15.vstcr_el2 & VSTCR_SW);
} else {
- *is_secure = !(env->cp15.vtcr_el2 & VTCR_NSW);
+ is_secure = !(env->cp15.vtcr_el2 & VTCR_NSW);
}
+ *is_secure_ptr = is_secure;
} else {
- assert(!*is_secure);
+ assert(!is_secure);
}
addr = s2.phys;
--
2.25.1
- [PULL 10/28] target/arm: Add is_secure parameter to v7m_read_half_insn, (continued)
- [PULL 10/28] target/arm: Add is_secure parameter to v7m_read_half_insn, Peter Maydell, 2022/10/10
- [PULL 11/28] target/arm: Add TBFLAG_M32.SECURE, Peter Maydell, 2022/10/10
- [PULL 16/28] target/arm: Drop secure check for HCR.TGE vs SCTLR_EL1.M, Peter Maydell, 2022/10/10
- [PULL 23/28] target/arm: Fix cacheattr in get_phys_addr_disabled, Peter Maydell, 2022/10/10
- [PULL 12/28] target/arm: Merge regime_is_secure into get_phys_addr, Peter Maydell, 2022/10/10
- [PULL 13/28] target/arm: Add is_secure parameter to do_ats_write, Peter Maydell, 2022/10/10
- [PULL 14/28] target/arm: Fold secure and non-secure a-profile mmu indexes, Peter Maydell, 2022/10/10
- [PULL 15/28] target/arm: Reorg regime_translation_disabled, Peter Maydell, 2022/10/10
- [PULL 17/28] target/arm: Introduce arm_hcr_el2_eff_secstate, Peter Maydell, 2022/10/10
- [PULL 19/28] target/arm: Remove env argument from combined_attrs_fwb, Peter Maydell, 2022/10/10
- [PULL 18/28] target/arm: Hoist read of *is_secure in S1_ptw_translate,
Peter Maydell <=
- [PULL 21/28] target/arm: Fix ATS12NSO* from S PL1, Peter Maydell, 2022/10/10
- [PULL 20/28] target/arm: Pass HCR to attribute subroutines., Peter Maydell, 2022/10/10
- [PULL 22/28] target/arm: Split out get_phys_addr_disabled, Peter Maydell, 2022/10/10
- [PULL 25/28] hw/arm/boot: set CPTR_EL3.ESM and SCR_EL3.EnTP2 when booting Linux with EL3, Peter Maydell, 2022/10/10
- [PULL 24/28] target/arm: Use tlb_set_page_full, Peter Maydell, 2022/10/10
- [PULL 26/28] target/arm: Don't allow guest to use unimplemented granule sizes, Peter Maydell, 2022/10/10
- [PULL 27/28] target/arm: Use ARMGranuleSize in ARMVAParameters, Peter Maydell, 2022/10/10
- [PULL 28/28] docs/system/arm/emulation.rst: Report FEAT_GTG support, Peter Maydell, 2022/10/10
- Re: [PULL 00/28] target-arm queue, Stefan Hajnoczi, 2022/10/12