qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	"QEMU Developers" <qemu-devel@nongnu.org>
Subject: Re: [PATCH v3 14/20] target/arm: Set PAN bit as required on exception entry
Date: Sat, 8 Feb 2020 09:27:37 +0000	[thread overview]
Message-ID: <5bebe5c3-7dd0-bcdd-546d-32bc392d0f18@linaro.org> (raw)
In-Reply-To: <848885b6-ee56-d38d-e77e-5bf17a2af3e2@linaro.org>

On 2/8/20 8:45 AM, Richard Henderson wrote:
> On 2/7/20 6:01 PM, Peter Maydell wrote:
>>> +        /* CPSR.PAN is preserved unless target is EL1 and SCTLR.SPAN == 0. */
>>> +        if (cpu_isar_feature(aa64_pan, env_archcpu(env))
>>> +            && new_el == 1
>>> +            && !(env->cp15.sctlr_el[1] & SCTLR_SPAN)) {
>>> +            env->uncached_cpsr |= CPSR_PAN;
>>> +        }
>> This doesn't catch the "taking exception to EL3 and AArch32 is EL3"
>> case, which is also supposed to honour SCTLR.SPAN.
>>
>> Given where this code is, we know we're taking an exception to
>> AArch32 and that we're not going to Hyp mode, so in fact every
>> case where we get here is one where we should honour SCTLR.SPAN
>> and I think we can just drop the "new_el == 1" part of the condition.
> 
> Presumably that becomes env->cp15.sctlr_el[new_el] as well, so that we get the
> secure version of the sctlr.

Actually, there's another clause that I missed before:

  # When the target of the exception is EL3, from Non-secure
  # state, this bit is set to 0 regardless
  # of the value of the Secure SCTLR.SPAN bit.

See G8.2.33.  Will fix for v4.


r~


  reply	other threads:[~2020-02-08  9:28 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-03 14:46 [PATCH v3 00/20] target/arm: Implement PAN, ATS1E1, UAO Richard Henderson
2020-02-03 14:46 ` [PATCH v3 01/20] target/arm: Add arm_mmu_idx_is_stage1_of_2 Richard Henderson
2020-02-03 14:46 ` [PATCH v3 02/20] target/arm: Add mmu_idx for EL1 and EL2 w/ PAN enabled Richard Henderson
2020-02-03 14:46 ` [PATCH v3 03/20] target/arm: Add isar_feature tests for PAN + ATS1E1 Richard Henderson
2020-02-03 14:47 ` [PATCH v3 04/20] target/arm: Move LOR regdefs to file scope Richard Henderson
2020-02-03 14:47 ` [PATCH v3 05/20] target/arm: Split out aarch32_cpsr_valid_mask Richard Henderson
2020-02-07 17:26   ` Peter Maydell
2020-02-03 14:47 ` [PATCH v3 06/20] target/arm: Replace CPSR_ERET_MASK with aarch32_cpsr_valid_mask Richard Henderson
2020-02-07 17:32   ` Peter Maydell
2020-02-03 14:47 ` [PATCH v3 07/20] target/arm: Use aarch32_cpsr_valid_mask in helper_exception_return Richard Henderson
2020-02-07 17:33   ` Peter Maydell
2020-02-03 14:47 ` [PATCH v3 08/20] target/arm: Remove CPSR_RESERVED Richard Henderson
2020-02-07 17:36   ` Peter Maydell
2020-02-08  8:26     ` Richard Henderson
2020-02-03 14:47 ` [PATCH v3 09/20] target/arm: Tidy msr_mask Richard Henderson
2020-02-07 17:40   ` Peter Maydell
2020-02-08  8:29     ` Richard Henderson
2020-02-03 14:47 ` [PATCH v3 10/20] target/arm: Introduce aarch64_pstate_valid_mask Richard Henderson
2020-02-07 17:43   ` Peter Maydell
2020-02-03 14:47 ` [PATCH v3 11/20] target/arm: Update MSR access for PAN Richard Henderson
2020-02-07 17:49   ` Peter Maydell
2020-02-03 14:47 ` [PATCH v3 12/20] target/arm: Update arm_mmu_idx_el " Richard Henderson
2020-02-03 14:47 ` [PATCH v3 13/20] target/arm: Enforce PAN semantics in get_S1prot Richard Henderson
2020-02-03 14:47 ` [PATCH v3 14/20] target/arm: Set PAN bit as required on exception entry Richard Henderson
2020-02-07 18:01   ` Peter Maydell
2020-02-08  8:45     ` Richard Henderson
2020-02-08  9:27       ` Richard Henderson [this message]
2020-02-03 14:47 ` [PATCH v3 15/20] target/arm: Implement ATS1E1 system registers Richard Henderson
2020-02-03 14:47 ` [PATCH v3 16/20] target/arm: Enable ARMv8.2-ATS1E1 in -cpu max Richard Henderson
2020-02-03 14:47 ` [PATCH v3 17/20] target/arm: Add ID_AA64MMFR2_EL1 Richard Henderson
2020-02-03 14:47 ` [PATCH v3 18/20] target/arm: Update MSR access to UAO Richard Henderson
2020-02-07 17:52   ` Peter Maydell
2020-02-03 14:47 ` [PATCH v3 19/20] target/arm: Implement UAO semantics Richard Henderson
2020-02-03 14:47 ` [PATCH v3 20/20] target/arm: Enable ARMv8.2-UAO in -cpu max Richard Henderson

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=5bebe5c3-7dd0-bcdd-546d-32bc392d0f18@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=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).