target/arm/ptw: Pass ARMSecurityState to regime_translation_disabled()
Plumb the ARMSecurityState through to regime_translation_disabled() rather than just a bool is_secure. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20230807141514.19075-6-peter.maydell@linaro.org
This commit is contained in:
parent
a5637bec4c
commit
d1289140a0
@ -206,9 +206,10 @@ static uint64_t regime_ttbr(CPUARMState *env, ARMMMUIdx mmu_idx, int ttbrn)
|
|||||||
|
|
||||||
/* Return true if the specified stage of address translation is disabled */
|
/* Return true if the specified stage of address translation is disabled */
|
||||||
static bool regime_translation_disabled(CPUARMState *env, ARMMMUIdx mmu_idx,
|
static bool regime_translation_disabled(CPUARMState *env, ARMMMUIdx mmu_idx,
|
||||||
bool is_secure)
|
ARMSecuritySpace space)
|
||||||
{
|
{
|
||||||
uint64_t hcr_el2;
|
uint64_t hcr_el2;
|
||||||
|
bool is_secure = arm_space_is_secure(space);
|
||||||
|
|
||||||
if (arm_feature(env, ARM_FEATURE_M)) {
|
if (arm_feature(env, ARM_FEATURE_M)) {
|
||||||
switch (env->v7m.mpu_ctrl[is_secure] &
|
switch (env->v7m.mpu_ctrl[is_secure] &
|
||||||
@ -2057,9 +2058,8 @@ static bool get_phys_addr_pmsav5(CPUARMState *env,
|
|||||||
uint32_t base;
|
uint32_t base;
|
||||||
ARMMMUIdx mmu_idx = ptw->in_mmu_idx;
|
ARMMMUIdx mmu_idx = ptw->in_mmu_idx;
|
||||||
bool is_user = regime_is_user(env, mmu_idx);
|
bool is_user = regime_is_user(env, mmu_idx);
|
||||||
bool is_secure = arm_space_is_secure(ptw->in_space);
|
|
||||||
|
|
||||||
if (regime_translation_disabled(env, mmu_idx, is_secure)) {
|
if (regime_translation_disabled(env, mmu_idx, ptw->in_space)) {
|
||||||
/* MPU disabled. */
|
/* MPU disabled. */
|
||||||
result->f.phys_addr = address;
|
result->f.phys_addr = address;
|
||||||
result->f.prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
|
result->f.prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
|
||||||
@ -2231,7 +2231,7 @@ static bool get_phys_addr_pmsav7(CPUARMState *env,
|
|||||||
result->f.lg_page_size = TARGET_PAGE_BITS;
|
result->f.lg_page_size = TARGET_PAGE_BITS;
|
||||||
result->f.prot = 0;
|
result->f.prot = 0;
|
||||||
|
|
||||||
if (regime_translation_disabled(env, mmu_idx, secure) ||
|
if (regime_translation_disabled(env, mmu_idx, ptw->in_space) ||
|
||||||
m_is_ppb_region(env, address)) {
|
m_is_ppb_region(env, address)) {
|
||||||
/*
|
/*
|
||||||
* MPU disabled or M profile PPB access: use default memory map.
|
* MPU disabled or M profile PPB access: use default memory map.
|
||||||
@ -2475,7 +2475,8 @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
|
|||||||
* are done in arm_v7m_load_vector(), which always does a direct
|
* are done in arm_v7m_load_vector(), which always does a direct
|
||||||
* read using address_space_ldl(), rather than going via this function.
|
* read using address_space_ldl(), rather than going via this function.
|
||||||
*/
|
*/
|
||||||
if (regime_translation_disabled(env, mmu_idx, secure)) { /* MPU disabled */
|
if (regime_translation_disabled(env, mmu_idx, arm_secure_to_space(secure))) {
|
||||||
|
/* MPU disabled */
|
||||||
hit = true;
|
hit = true;
|
||||||
} else if (m_is_ppb_region(env, address)) {
|
} else if (m_is_ppb_region(env, address)) {
|
||||||
hit = true;
|
hit = true;
|
||||||
@ -3303,7 +3304,7 @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw,
|
|||||||
*/
|
*/
|
||||||
ptw->in_mmu_idx = mmu_idx = s1_mmu_idx;
|
ptw->in_mmu_idx = mmu_idx = s1_mmu_idx;
|
||||||
if (arm_feature(env, ARM_FEATURE_EL2) &&
|
if (arm_feature(env, ARM_FEATURE_EL2) &&
|
||||||
!regime_translation_disabled(env, ARMMMUIdx_Stage2, is_secure)) {
|
!regime_translation_disabled(env, ARMMMUIdx_Stage2, ptw->in_space)) {
|
||||||
return get_phys_addr_twostage(env, ptw, address, access_type,
|
return get_phys_addr_twostage(env, ptw, address, access_type,
|
||||||
result, fi);
|
result, fi);
|
||||||
}
|
}
|
||||||
@ -3362,7 +3363,7 @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw,
|
|||||||
|
|
||||||
/* Definitely a real MMU, not an MPU */
|
/* Definitely a real MMU, not an MPU */
|
||||||
|
|
||||||
if (regime_translation_disabled(env, mmu_idx, is_secure)) {
|
if (regime_translation_disabled(env, mmu_idx, ptw->in_space)) {
|
||||||
return get_phys_addr_disabled(env, ptw, address, access_type,
|
return get_phys_addr_disabled(env, ptw, address, access_type,
|
||||||
result, fi);
|
result, fi);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user