[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 12/39] target/arm: Add is_secure parameter to v8m_security_lookup
From: |
Peter Maydell |
Subject: |
[PULL 12/39] target/arm: Add is_secure parameter to v8m_security_lookup |
Date: |
Thu, 22 Sep 2022 17:35:09 +0100 |
From: Richard Henderson <richard.henderson@linaro.org>
Remove the use of regime_is_secure from v8m_security_lookup,
passing the new parameter to the lookup instead.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220822152741.1617527-12-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/arm/internals.h | 2 +-
target/arm/m_helper.c | 9 ++++++---
target/arm/ptw.c | 9 +++++----
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/target/arm/internals.h b/target/arm/internals.h
index f8b22d3ab0b..e97f5c3d47e 100644
--- a/target/arm/internals.h
+++ b/target/arm/internals.h
@@ -1123,7 +1123,7 @@ typedef struct V8M_SAttributes {
void v8m_security_lookup(CPUARMState *env, uint32_t address,
MMUAccessType access_type, ARMMMUIdx mmu_idx,
- V8M_SAttributes *sattrs);
+ bool secure, V8M_SAttributes *sattrs);
/* Cacheability and shareability attributes for a memory access */
typedef struct ARMCacheAttrs {
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
index 01263990dc3..45fbf195590 100644
--- a/target/arm/m_helper.c
+++ b/target/arm/m_helper.c
@@ -689,7 +689,8 @@ static bool arm_v7m_load_vector(ARMCPU *cpu, int exc, bool
targets_secure,
if (arm_feature(env, ARM_FEATURE_M_SECURITY)) {
V8M_SAttributes sattrs = {};
- v8m_security_lookup(env, addr, MMU_DATA_LOAD, mmu_idx, &sattrs);
+ v8m_security_lookup(env, addr, MMU_DATA_LOAD, mmu_idx,
+ targets_secure, &sattrs);
if (sattrs.ns) {
attrs.secure = false;
} else if (!targets_secure) {
@@ -2002,7 +2003,8 @@ static bool v7m_read_half_insn(ARMCPU *cpu, ARMMMUIdx
mmu_idx,
ARMMMUFaultInfo fi = {};
MemTxResult txres;
- v8m_security_lookup(env, addr, MMU_INST_FETCH, mmu_idx, &sattrs);
+ v8m_security_lookup(env, addr, MMU_INST_FETCH, mmu_idx,
+ regime_is_secure(env, mmu_idx), &sattrs);
if (!sattrs.nsc || sattrs.ns) {
/*
* This must be the second half of the insn, and it straddles a
@@ -2826,7 +2828,8 @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr,
uint32_t op)
}
if (env->v7m.secure) {
- v8m_security_lookup(env, addr, MMU_DATA_LOAD, mmu_idx, &sattrs);
+ v8m_security_lookup(env, addr, MMU_DATA_LOAD, mmu_idx,
+ targetsec, &sattrs);
nsr = sattrs.ns && r;
nsrw = sattrs.ns && rw;
} else {
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index bb3c709f8f5..74d2f63359f 100644
--- a/target/arm/ptw.c
+++ b/target/arm/ptw.c
@@ -1857,8 +1857,8 @@ static bool v8m_is_sau_exempt(CPUARMState *env,
}
void v8m_security_lookup(CPUARMState *env, uint32_t address,
- MMUAccessType access_type, ARMMMUIdx mmu_idx,
- V8M_SAttributes *sattrs)
+ MMUAccessType access_type, ARMMMUIdx mmu_idx,
+ bool is_secure, V8M_SAttributes *sattrs)
{
/*
* Look up the security attributes for this address. Compare the
@@ -1886,7 +1886,7 @@ void v8m_security_lookup(CPUARMState *env, uint32_t
address,
}
if (idau_exempt || v8m_is_sau_exempt(env, address, access_type)) {
- sattrs->ns = !regime_is_secure(env, mmu_idx);
+ sattrs->ns = !is_secure;
return;
}
@@ -1975,7 +1975,8 @@ static bool get_phys_addr_pmsav8(CPUARMState *env,
uint32_t address,
bool ret;
if (arm_feature(env, ARM_FEATURE_M_SECURITY)) {
- v8m_security_lookup(env, address, access_type, mmu_idx, &sattrs);
+ v8m_security_lookup(env, address, access_type, mmu_idx,
+ secure, &sattrs);
if (access_type == MMU_INST_FETCH) {
/*
* Instruction fetches always use the MMU bank and the
--
2.25.1
- [PULL 27/39] hw/ppc/pnv: Avoid dynamic stack allocation, (continued)
- [PULL 27/39] hw/ppc/pnv: Avoid dynamic stack allocation, Peter Maydell, 2022/09/22
- [PULL 38/39] configure: Check mkdir result directly, not via $?, Peter Maydell, 2022/09/22
- [PULL 34/39] configure: Remove unused meson_args variable, Peter Maydell, 2022/09/22
- [PULL 39/39] configure: Avoid use of 'local' as it is non-POSIX, Peter Maydell, 2022/09/22
- [PULL 33/39] configure: Remove unused python_version variable, Peter Maydell, 2022/09/22
- [PULL 02/39] target/arm: Fix alignment for VLD4.32, Peter Maydell, 2022/09/22
- [PULL 11/39] target/arm: Remove is_subpage argument to pmsav8_mpu_lookup, Peter Maydell, 2022/09/22
- [PULL 08/39] target/arm: Use GetPhysAddrResult in get_phys_addr_pmsav7, Peter Maydell, 2022/09/22
- [PULL 04/39] target/arm: Use GetPhysAddrResult in get_phys_addr_lpae, Peter Maydell, 2022/09/22
- [PULL 09/39] target/arm: Use GetPhysAddrResult in get_phys_addr_pmsav8, Peter Maydell, 2022/09/22
- [PULL 12/39] target/arm: Add is_secure parameter to v8m_security_lookup,
Peter Maydell <=
- [PULL 16/39] target/arm: Add secure parameter to get_phys_addr_pmsav8, Peter Maydell, 2022/09/22
- [PULL 01/39] hw/net/can: fix Xilinx ZynqMP CAN RX FIFO logic, Peter Maydell, 2022/09/22
- [PULL 31/39] ui/curses: Avoid dynamic stack allocation, Peter Maydell, 2022/09/22
- [PULL 10/39] target/arm: Use GetPhysAddrResult in pmsav8_mpu_lookup, Peter Maydell, 2022/09/22
- [PULL 32/39] tests/unit/test-vmstate: Avoid dynamic stack allocation, Peter Maydell, 2022/09/22
- [PULL 21/39] hw/net/lan9118: Signal TSFL_INT flag when TX FIFO reaches specified level, Peter Maydell, 2022/09/22
- [PULL 23/39] chardev/baum: Use definitions to avoid dynamic stack allocation, Peter Maydell, 2022/09/22
- [PULL 28/39] hw/intc/xics: Avoid dynamic stack allocation, Peter Maydell, 2022/09/22
- [PULL 18/39] target/arm: Add secure parameter to get_phys_addr_pmsav7, Peter Maydell, 2022/09/22
- [PULL 30/39] hw/usb/hcd-ohci: Use definition to avoid dynamic stack allocation, Peter Maydell, 2022/09/22