xemu/target/arm/tcg
Peter Maydell 056c5c90c1 Revert "target/arm: Fix usage of MMU indexes when EL3 is AArch32"
This reverts commit 4c2c047469.

This commit tried to fix a problem with our usage of MMU indexes when
EL3 is AArch32, using what it described as a "more complicated
approach" where we share the same MMU index values for Secure PL1&0
and NonSecure PL1&0. In theory this should work, but the change
didn't account for (at least) two things:

(1) The design change means we need to flush the TLBs at any point
where the CPU state flips from one to the other.  We already flush
the TLB when SCR.NS is changed, but we don't flush the TLB when we
take an exception from NS PL1&0 into Mon or when we return from Mon
to NS PL1&0, and the commit didn't add any code to do that.

(2) The ATS12NS* address translate instructions allow Mon code (which
is Secure) to do a stage 1+2 page table walk for NS.  I thought this
was OK because do_ats_write() does a page table walk which doesn't
use the TLBs, so because it can pass both the MMU index and also an
ARMSecuritySpace argument we can tell the table walk that we want NS
stage1+2, not S.  But that means that all the code within the ptw
that needs to find e.g.  the regime EL cannot do so only with an
mmu_idx -- all these functions like regime_sctlr(), regime_el(), etc
would need to pass both an mmu_idx and the security_space, so they
can tell whether this is a translation regime controlled by EL1 or
EL3 (and so whether to look at SCTLR.S or SCTLR.NS, etc).

In particular, because regime_el() wasn't updated to look at the
ARMSecuritySpace it would return 1 even when the CPU was in Monitor
mode (and the controlling EL is 3).  This meant that page table walks
in Monitor mode would look at the wrong SCTLR, TCR, etc and would
generally fault when they should not.

Rather than trying to make the complicated changes needed to rescue
the design of 4c2c047469, we revert it in order to instead take the
route that that commit describes as "the most straightforward" fix,
where we add new MMU indexes EL30_0, EL30_3, EL30_3_PAN to correspond
to "Secure PL1&0 at PL0", "Secure PL1&0 at PL1", and "Secure PL1&0 at
PL1 with PAN".

This revert will re-expose the "spurious alignment faults in
Secure PL0" issue #2326; we'll fix it again in the next commit.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Thomas Huth <thuth@redhat.com>
Message-id: 20241101142845.1712482-2-peter.maydell@linaro.org
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2024-11-05 10:09:58 +00:00
..
a32-uncond.decode target/arm: move translate modules to tcg/ 2023-02-27 13:27:04 +00:00
a32.decode target/arm: move translate modules to tcg/ 2023-02-27 13:27:04 +00:00
a64.decode target/arm: Convert scalar [US]QSHRN, [US]QRSHRN, SQSHRUN to decodetree 2024-09-19 12:58:58 +01:00
arm_ldst.h target/arm: Move translate-a32.h, arm_ldst.h, sve_ldst_internal.h to tcg/ 2023-05-12 15:43:36 +01:00
cpu-v7m.c target/arm: Implement TCGCPUOps.tlb_fill_align 2024-10-13 11:27:06 -07:00
cpu32.c target/arm: Enable FEAT_Debugv8p8 for -cpu max 2024-07-01 15:40:53 +01:00
cpu64.c target/arm: Correct ID_AA64ISAR1_EL1 value for neoverse-v1 2024-09-19 13:17:21 +01:00
crypto_helper.c crypto: Create sm4_subword 2023-09-11 11:45:55 +10:00
gengvec.c target/arm: Convert VQSHL, VQSHLU to gvec 2024-09-19 12:58:58 +01:00
gengvec64.c target/arm: Inline scalar SUQADD and USQADD 2024-05-30 15:24:39 +01:00
helper-a64.c target/arm: Fix arithmetic underflow in SETM instruction 2024-10-29 15:04:47 +00:00
helper-a64.h target/arm: Fix BTI versus CF_PCREL 2024-08-09 17:37:54 +01:00
helper-mve.h target/arm: Move helper-{a64,mve,sme,sve}.h to tcg/ 2023-05-12 15:43:37 +01:00
helper-sme.h target/arm: Pass env pointer through to sme_bfmopa helper 2024-09-05 13:12:35 +01:00
helper-sve.h target/arm: Move helper-{a64,mve,sme,sve}.h to tcg/ 2023-05-12 15:43:37 +01:00
hflags.c Revert "target/arm: Fix usage of MMU indexes when EL3 is AArch32" 2024-11-05 10:09:58 +00:00
iwmmxt_helper.c target/arm: move helpers to tcg/ 2023-02-27 13:27:04 +00:00
m-nocp.decode target/arm: move translate modules to tcg/ 2023-02-27 13:27:04 +00:00
m_helper.c target/arm: Pass MemOp to get_phys_addr 2024-10-13 11:27:06 -07:00
meson.build target/arm: Split out gengvec64.c 2024-05-28 14:29:01 +01:00
mte_helper.c target/arm: Make some MTE helpers widely available 2024-07-05 12:35:11 +01:00
mte_helper.h target/arm: Make some MTE helpers widely available 2024-07-05 12:35:11 +01:00
mve.decode target/arm: move translate modules to tcg/ 2023-02-27 13:27:04 +00:00
mve_helper.c target/arm: Rename FPCR_ QC, NZCV macros to FPSR_ 2024-07-11 11:41:33 +01:00
neon-dp.decode target/arm: Convert VQSHL, VQSHLU to gvec 2024-09-19 12:58:58 +01:00
neon-ls.decode target/arm: move translate modules to tcg/ 2023-02-27 13:27:04 +00:00
neon-shared.decode target/arm: move translate modules to tcg/ 2023-02-27 13:27:04 +00:00
neon_helper.c target/arm: Widen NeonGenNarrowEnvFn return to 64 bits 2024-09-19 12:58:58 +01:00
op_helper.c target/arm: Implement FEAT WFxT and enable for '-cpu max' 2024-05-30 16:35:17 +01:00
pauth_helper.c target/arm: Move feature test functions to their own header 2023-10-27 11:44:32 +01:00
psci.c target/arm: Expose arm_cpu_mp_affinity() in 'multiprocessing.h' header 2024-01-26 11:30:48 +00:00
sme-fa64.decode target/arm: move translate modules to tcg/ 2023-02-27 13:27:04 +00:00
sme.decode target/arm: move translate modules to tcg/ 2023-02-27 13:27:04 +00:00
sme_helper.c target/arm: Prepare bfdotadd() callers for FEAT_EBF support 2024-09-05 13:12:36 +01:00
sve.decode target/arm: Demultiplex AESE and AESMC 2023-07-08 07:30:18 +01:00
sve_helper.c target/arm: Use set/clear_helper_retaddr in SVE and SME helpers 2024-07-23 10:56:04 +10:00
sve_ldst_internal.h target/arm: Move translate-a32.h, arm_ldst.h, sve_ldst_internal.h to tcg/ 2023-05-12 15:43:36 +01:00
t16.decode target/arm: move translate modules to tcg/ 2023-02-27 13:27:04 +00:00
t32.decode target/arm: Use PLD, PLDW, PLI not NOP for t32 2024-05-28 14:23:52 +01:00
tlb_helper.c target/arm: Implement TCGCPUOps.tlb_fill_align 2024-10-13 11:27:06 -07:00
translate-a32.h target/arm: Implement store_cpu_field_low32() macro 2024-07-11 11:41:33 +01:00
translate-a64.c Revert "target/arm: Fix usage of MMU indexes when EL3 is AArch32" 2024-11-05 10:09:58 +00:00
translate-a64.h target/arm: Inline scalar SUQADD and USQADD 2024-05-30 15:24:39 +01:00
translate-m-nocp.c target/arm: Rename FPCR_ QC, NZCV macros to FPSR_ 2024-07-11 11:41:33 +01:00
translate-mve.c tcg: Rename cpu_env to tcg_env 2023-10-03 08:01:02 -07:00
translate-neon.c target/arm: Widen NeonGenNarrowEnvFn return to 64 bits 2024-09-19 12:58:58 +01:00
translate-sme.c target/arm: Enable FEAT_EBF16 in the "max" CPU 2024-09-05 13:12:36 +01:00
translate-sve.c target/arm: Replace tcg_gen_dupi_vec with constants in translate-sve.c 2024-09-19 12:58:56 +01:00
translate-vfp.c target/arm: Correct names of VFP VFNMA and VFNMS insns 2024-09-05 13:12:37 +01:00
translate.c Revert "target/arm: Fix usage of MMU indexes when EL3 is AArch32" 2024-11-05 10:09:58 +00:00
translate.h Revert "target/arm: Fix usage of MMU indexes when EL3 is AArch32" 2024-11-05 10:09:58 +00:00
vec_helper.c target/arm: Implement FPCR.EBF=1 semantics for bfdotadd() 2024-09-05 13:12:36 +01:00
vec_internal.h target/arm: Prepare bfdotadd() callers for FEAT_EBF support 2024-09-05 13:12:36 +01:00
vfp-uncond.decode target/arm: move translate modules to tcg/ 2023-02-27 13:27:04 +00:00
vfp.decode target/arm: Correct names of VFP VFNMA and VFNMS insns 2024-09-05 13:12:37 +01:00