From: "Alex Bennée" <alex.bennee@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH 07/14] target/arm: Honour SDCR.TDCC and SCR.TERR in AArch32 EL3 non-Monitor modes
Date: Wed, 05 Feb 2025 14:40:47 +0000 [thread overview]
Message-ID: <87seos8nf4.fsf@draig.linaro.org> (raw)
In-Reply-To: <20250130182309.717346-8-peter.maydell@linaro.org> (Peter Maydell's message of "Thu, 30 Jan 2025 18:23:02 +0000")
Peter Maydell <peter.maydell@linaro.org> writes:
> There are not many traps in AArch32 which should trap to Monitor
> mode, but these trap bits should trap not just lower ELs to Monitor
> mode but also the non-Monitor modes running at EL3 (i.e. Secure
> System, Secure Undef, etc).
>
> We get this wrong because the relevant access functions implement the
> AArch64-style logic of
> if (el < 3 && trap_bit_set) {
> return CP_ACCESS_TRAP_EL3;
> }
> which won't trap the non-Monitor modes at EL3.
>
> Correct this error by using arm_is_el3_or_mon() instead, which
> returns true when the CPU is at AArch64 EL3 or AArch32 Monitor mode.
> (Since the new callsites are compiled also for the linux-user mode,
> we need to provide a dummy implementation for CONFIG_USER_ONLY.)
>
> This affects only:
> * trapping of ERRIDR via SCR.TERR
> * trapping of the debug channel registers via SDCR.TDCC
> * trapping of GICv3 registers via SCR.IRQ and SCR.FIQ
> (which we already used arm_is_el3_or_mon() for)
>
> This patch changes the handling of SCR.TERR and SDCR.TDCC. This
> patch only changes guest-visible behaviour for "-cpu max" on
> the qemu-system-arm binary, because SCR.TERR
> and SDCR.TDCC (and indeed the entire SDCR register) only arrived
> in Armv8, and the only guest CPU we support which has any v8
> features and also starts in AArch32 EL3 is the 32-bit 'max'.
>
> Other uses of CP_ACCESS_TRAP_EL3 don't need changing:
>
> * uses in code paths that can't happen when EL3 is AArch32:
> access_trap_aa32s_el1, cpacr_access, cptr_access, nsacr_access
> * uses which are in accessfns for AArch64-only registers:
> gt_stimer_access, gt_cntpoff_access, access_hxen, access_tpidr2,
> access_smpri, access_smprimap, access_lor_ns, access_pauth,
> access_mte, access_tfsr_el2, access_scxtnum, access_fgt
> * trap bits which exist only in the AArch64 version of the
> trap register, not the AArch32 one:
> access_tpm, pmreg_access, access_dbgvcr32, access_tdra,
> access_tda, access_tdosa (TPM, TDA and TDOSA exist only in
> MDCR_EL3, not in SDCR, and we enforce this in sdcr_write())
>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2025-02-05 14:41 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-30 18:22 [PATCH 00/14] target/arm: Clean up some corner cases of sysreg traps Peter Maydell
2025-01-30 18:22 ` [PATCH 01/14] target/arm: Report correct syndrome for UNDEFINED CNTPS_*_EL1 from EL2 and NS EL1 Peter Maydell
2025-02-05 8:59 ` Alex Bennée
2025-02-10 18:44 ` Richard Henderson
2025-01-30 18:22 ` [PATCH 02/14] target/arm: Report correct syndrome for UNDEFINED AT ops with wrong NSE, NS Peter Maydell
2025-02-10 18:46 ` Richard Henderson
2025-01-30 18:22 ` [PATCH 03/14] target/arm: Report correct syndrome for UNDEFINED S1E2 AT ops at EL3 Peter Maydell
2025-02-10 18:58 ` Richard Henderson
2025-01-30 18:22 ` [PATCH 04/14] target/arm: Report correct syndrome for UNDEFINED LOR sysregs when NS=0 Peter Maydell
2025-02-05 12:05 ` Alex Bennée
2025-02-10 18:59 ` Richard Henderson
2025-01-30 18:23 ` [PATCH 05/14] target/arm: Make CP_ACCESS_TRAPs to AArch32 EL3 be Monitor traps Peter Maydell
2025-02-05 12:51 ` Alex Bennée
2025-02-05 14:39 ` Peter Maydell
2025-02-10 19:13 ` Richard Henderson
2025-01-30 18:23 ` [PATCH 06/14] hw/intc/arm_gicv3_cpuif: Don't downgrade monitor traps for AArch32 EL3 Peter Maydell
2025-02-05 14:29 ` Alex Bennée
2025-02-10 19:15 ` Richard Henderson
2025-01-30 18:23 ` [PATCH 07/14] target/arm: Honour SDCR.TDCC and SCR.TERR in AArch32 EL3 non-Monitor modes Peter Maydell
2025-02-05 14:40 ` Alex Bennée [this message]
2025-02-10 19:20 ` Richard Henderson
2025-01-30 18:23 ` [PATCH 08/14] hw/intc/arm_gicv3_cpuif(): Remove redundant tests of is_a64() Peter Maydell
2025-02-05 14:42 ` Alex Bennée
2025-02-10 19:23 ` Richard Henderson
2025-01-30 18:23 ` [PATCH 09/14] target/arm: Support CP_ACCESS_TRAP_EL1 as a CPAccessResult Peter Maydell
2025-02-10 19:26 ` Richard Henderson
2025-01-30 18:23 ` [PATCH 10/14] target/arm: Use CP_ACCESS_TRAP_EL1 for traps that are always to EL1 Peter Maydell
2025-02-10 19:29 ` Richard Henderson
2025-01-30 18:23 ` [PATCH 11/14] target/arm: Use TRAP_UNCATEGORIZED for XScale CPAR traps Peter Maydell
2025-02-01 7:31 ` Philippe Mathieu-Daudé
2025-02-10 19:30 ` Richard Henderson
2025-01-30 18:23 ` [PATCH 12/14] target/arm: Remove CP_ACCESS_TRAP handling Peter Maydell
2025-02-10 19:34 ` Richard Henderson
2025-02-11 9:51 ` Peter Maydell
2025-01-30 18:23 ` [PATCH 13/14] target/arm: Rename CP_ACCESS_TRAP_UNCATEGORIZED to CP_ACCESS_UNDEFINED Peter Maydell
2025-02-01 7:32 ` Philippe Mathieu-Daudé
2025-02-10 19:36 ` Richard Henderson
2025-01-30 18:23 ` [PATCH 14/14] target/arm: Correct errors in WFI/WFE trapping Peter Maydell
2025-02-10 19:53 ` Richard Henderson
2025-02-10 10:27 ` [PATCH 00/14] target/arm: Clean up some corner cases of sysreg traps Peter Maydell
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=87seos8nf4.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.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).