From 07ebb7f7ba5a526d527757aaef3f69b195b462aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= Date: Thu, 4 Mar 2021 14:25:11 -0500 Subject: [PATCH] target/arm: translate NS bit in page-walks 588c6dd113b27b8db393c7264297b9d33261692e --- qemu/target/arm/helper.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/qemu/target/arm/helper.c b/qemu/target/arm/helper.c index 1c8c531d..14f62dcc 100644 --- a/qemu/target/arm/helper.c +++ b/qemu/target/arm/helper.c @@ -10154,6 +10154,18 @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx, fi->s1ptw = true; 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.raw_tcr & VSTCR_SW); + } else { + *is_secure = !(env->cp15.vtcr_el2.raw_tcr & VTCR_NSW); + } + } else { + assert(!*is_secure); + } + addr = s2pa; } return addr;