From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 13/28] target/arm: Add is_secure parameter to do_ats_write
Date: Mon, 10 Oct 2022 15:27:15 +0100 [thread overview]
Message-ID: <20221010142730.502083-14-peter.maydell@linaro.org> (raw)
In-Reply-To: <20221010142730.502083-1-peter.maydell@linaro.org>
From: Richard Henderson <richard.henderson@linaro.org>
Use get_phys_addr_with_secure directly. For a-profile, this is the
one place where the value of is_secure may not equal arm_is_secure(env).
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20221001162318.153420-10-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/arm/helper.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 8d82c147623..fd4663a9467 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -3191,7 +3191,8 @@ static CPAccessResult ats_access(CPUARMState *env, const ARMCPRegInfo *ri,
#ifdef CONFIG_TCG
static uint64_t do_ats_write(CPUARMState *env, uint64_t value,
- MMUAccessType access_type, ARMMMUIdx mmu_idx)
+ MMUAccessType access_type, ARMMMUIdx mmu_idx,
+ bool is_secure)
{
bool ret;
uint64_t par64;
@@ -3199,7 +3200,8 @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value,
ARMMMUFaultInfo fi = {};
GetPhysAddrResult res = {};
- ret = get_phys_addr(env, value, access_type, mmu_idx, &res, &fi);
+ ret = get_phys_addr_with_secure(env, value, access_type, mmu_idx,
+ is_secure, &res, &fi);
/*
* ATS operations only do S1 or S1+S2 translations, so we never
@@ -3371,6 +3373,7 @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
switch (el) {
case 3:
mmu_idx = ARMMMUIdx_SE3;
+ secure = true;
break;
case 2:
g_assert(!secure); /* ARMv8.4-SecEL2 is 64-bit only */
@@ -3392,6 +3395,7 @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
switch (el) {
case 3:
mmu_idx = ARMMMUIdx_SE10_0;
+ secure = true;
break;
case 2:
g_assert(!secure); /* ARMv8.4-SecEL2 is 64-bit only */
@@ -3407,16 +3411,18 @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
case 4:
/* stage 1+2 NonSecure PL1: ATS12NSOPR, ATS12NSOPW */
mmu_idx = ARMMMUIdx_E10_1;
+ secure = false;
break;
case 6:
/* stage 1+2 NonSecure PL0: ATS12NSOUR, ATS12NSOUW */
mmu_idx = ARMMMUIdx_E10_0;
+ secure = false;
break;
default:
g_assert_not_reached();
}
- par64 = do_ats_write(env, value, access_type, mmu_idx);
+ par64 = do_ats_write(env, value, access_type, mmu_idx, secure);
A32_BANKED_CURRENT_REG_SET(env, par, par64);
#else
@@ -3432,7 +3438,8 @@ static void ats1h_write(CPUARMState *env, const ARMCPRegInfo *ri,
MMUAccessType access_type = ri->opc2 & 1 ? MMU_DATA_STORE : MMU_DATA_LOAD;
uint64_t par64;
- par64 = do_ats_write(env, value, access_type, ARMMMUIdx_E2);
+ /* There is no SecureEL2 for AArch32. */
+ par64 = do_ats_write(env, value, access_type, ARMMMUIdx_E2, false);
A32_BANKED_CURRENT_REG_SET(env, par, par64);
#else
@@ -3475,6 +3482,7 @@ static void ats_write64(CPUARMState *env, const ARMCPRegInfo *ri,
break;
case 6: /* AT S1E3R, AT S1E3W */
mmu_idx = ARMMMUIdx_SE3;
+ secure = true;
break;
default:
g_assert_not_reached();
@@ -3493,7 +3501,8 @@ static void ats_write64(CPUARMState *env, const ARMCPRegInfo *ri,
g_assert_not_reached();
}
- env->cp15.par_el[1] = do_ats_write(env, value, access_type, mmu_idx);
+ env->cp15.par_el[1] = do_ats_write(env, value, access_type,
+ mmu_idx, secure);
#else
/* Handled by hardware accelerator. */
g_assert_not_reached();
--
2.25.1
next prev parent reply other threads:[~2022-10-10 14:47 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-10 14:27 [PULL 00/28] target-arm queue Peter Maydell
2022-10-10 14:27 ` [PULL 01/28] target/arm/kvm: Retry KVM_CREATE_VM call if it fails EINTR Peter Maydell
2022-10-10 14:27 ` [PULL 02/28] target/arm: allow setting SCR_EL3.EnTP2 when FEAT_SME is implemented Peter Maydell
2022-10-10 14:27 ` [PULL 03/28] docs/nuvoton: Update URL for images Peter Maydell
2022-10-10 14:27 ` [PULL 04/28] target/arm: Split s2walk_secure from ipa_secure in get_phys_addr Peter Maydell
2022-10-10 14:27 ` [PULL 05/28] target/arm: Make the final stage1+2 write to secure be unconditional Peter Maydell
2022-10-10 14:27 ` [PULL 06/28] target/arm: Add is_secure parameter to get_phys_addr_lpae Peter Maydell
2022-10-10 14:27 ` [PULL 07/28] target/arm: Fix S2 disabled check in S1_ptw_translate Peter Maydell
2022-10-10 14:27 ` [PULL 08/28] target/arm: Add is_secure parameter to regime_translation_disabled Peter Maydell
2022-10-10 14:27 ` [PULL 09/28] target/arm: Split out get_phys_addr_with_secure Peter Maydell
2022-10-10 14:27 ` [PULL 10/28] target/arm: Add is_secure parameter to v7m_read_half_insn Peter Maydell
2022-10-10 14:27 ` [PULL 11/28] target/arm: Add TBFLAG_M32.SECURE Peter Maydell
2022-10-10 14:27 ` [PULL 12/28] target/arm: Merge regime_is_secure into get_phys_addr Peter Maydell
2022-10-10 14:27 ` Peter Maydell [this message]
2022-10-10 14:27 ` [PULL 14/28] target/arm: Fold secure and non-secure a-profile mmu indexes Peter Maydell
2022-10-10 14:27 ` [PULL 15/28] target/arm: Reorg regime_translation_disabled Peter Maydell
2022-10-10 14:27 ` [PULL 16/28] target/arm: Drop secure check for HCR.TGE vs SCTLR_EL1.M Peter Maydell
2022-10-10 14:27 ` [PULL 17/28] target/arm: Introduce arm_hcr_el2_eff_secstate Peter Maydell
2022-10-10 14:27 ` [PULL 18/28] target/arm: Hoist read of *is_secure in S1_ptw_translate Peter Maydell
2022-10-10 14:27 ` [PULL 19/28] target/arm: Remove env argument from combined_attrs_fwb Peter Maydell
2022-10-10 14:27 ` [PULL 20/28] target/arm: Pass HCR to attribute subroutines Peter Maydell
2022-10-10 14:27 ` [PULL 21/28] target/arm: Fix ATS12NSO* from S PL1 Peter Maydell
2022-10-10 14:27 ` [PULL 22/28] target/arm: Split out get_phys_addr_disabled Peter Maydell
2022-10-10 14:27 ` [PULL 23/28] target/arm: Fix cacheattr in get_phys_addr_disabled Peter Maydell
2022-10-10 14:27 ` [PULL 24/28] target/arm: Use tlb_set_page_full Peter Maydell
2022-10-10 14:27 ` [PULL 25/28] hw/arm/boot: set CPTR_EL3.ESM and SCR_EL3.EnTP2 when booting Linux with EL3 Peter Maydell
2022-10-10 14:27 ` [PULL 26/28] target/arm: Don't allow guest to use unimplemented granule sizes Peter Maydell
2022-10-10 14:27 ` [PULL 27/28] target/arm: Use ARMGranuleSize in ARMVAParameters Peter Maydell
2022-10-10 14:27 ` [PULL 28/28] docs/system/arm/emulation.rst: Report FEAT_GTG support Peter Maydell
2022-10-12 21:25 ` [PULL 00/28] target-arm queue Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221010142730.502083-14-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).