From: Richard Henderson <richard.henderson@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v2 06/10] target/arm: Use arm_hcr_el2_eff more places
Date: Thu, 6 Dec 2018 07:32:49 -0600 [thread overview]
Message-ID: <f5e828de-24d5-73a2-27e3-dac101926faa@linaro.org> (raw)
In-Reply-To: <CAFEAcA9-jB-RhEPb4CnnrCZ9y+SWu_1Ec6GYw7dyQyrVi3fd7w@mail.gmail.com>
On 12/6/18 7:06 AM, Peter Maydell wrote:
> On Mon, 3 Dec 2018 at 20:38, Richard Henderson
> <richard.henderson@linaro.org> wrote:
>>
>> Since arm_hcr_el2_eff includes a check against
>> arm_is_secure_below_el3, we can often remove a
>> nearby check against secure state.
>>
>> In some cases, sort the call to arm_hcr_el2_eff
>> to the end of a short-circuit logical sequence.
>>
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>> ---
>
>
>> @@ -8797,6 +8795,8 @@ static inline uint32_t regime_sctlr(CPUARMState *env, ARMMMUIdx mmu_idx)
>> static inline bool regime_translation_disabled(CPUARMState *env,
>> ARMMMUIdx mmu_idx)
>> {
>> + uint64_t hcr_el2;
>> +
>> if (arm_feature(env, ARM_FEATURE_M)) {
>> switch (env->v7m.mpu_ctrl[regime_is_secure(env, mmu_idx)] &
>> (R_V7M_MPU_CTRL_ENABLE_MASK | R_V7M_MPU_CTRL_HFNMIENA_MASK)) {
>> @@ -8815,19 +8815,21 @@ static inline bool regime_translation_disabled(CPUARMState *env,
>> }
>> }
>>
>> + hcr_el2 = arm_hcr_el2_eff(env);
>
> Changing this in this function makes me nervous, because
> arm_hcr_el2_eff() looks at the current CPU state via
> arm_is_secure_below_el3() rather than at the security state
> of the translation regime we're asking about. I think
> it probably doesn't change behaviour, but I'm finding
> it hard to reason about...
Oops, I missed that we weren't talking about "current" here.
I can either just revert this function for now, or introduce a new
arm_hcr_el2_eff_ns that does not take secure into effect, but does adjust all
of the other flags within HCR relative to its own contents.
>> - if (!secure && cur_el == 1 && (env->cp15.hcr_el2 & HCR_TSC)) {
>> + if (!secure && cur_el == 1 && (arm_hcr_el2_eff(env) & HCR_TSC)) {
>
> Why can't we drop the !secure check here?
Either I missed it, or it was premature optimization of the form "well, it's
already computed into a local variable..."
r~
next prev parent reply other threads:[~2018-12-06 13:33 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-03 20:38 [Qemu-devel] [PATCH v2 00/10] target/arm: LOR, HPD, AA32HPD Richard Henderson
2018-12-03 20:38 ` [Qemu-devel] [PATCH v2 01/10] target/arm: Move id_aa64mmfr* to ARMISARegisters Richard Henderson
2018-12-06 12:10 ` Peter Maydell
2018-12-03 20:38 ` [Qemu-devel] [PATCH v2 02/10] target/arm: Add HCR_EL2 bits up to ARMv8.5 Richard Henderson
2018-12-06 11:15 ` Peter Maydell
2018-12-06 12:10 ` Peter Maydell
2018-12-03 20:38 ` [Qemu-devel] [PATCH v2 03/10] target/arm: Add SCR_EL3 " Richard Henderson
2018-12-06 12:10 ` Peter Maydell
2018-12-03 20:38 ` [Qemu-devel] [PATCH v2 04/10] target/arm: Fix HCR_EL2.TGE check in arm_phys_excp_target_el Richard Henderson
2018-12-06 12:11 ` Peter Maydell
2018-12-03 20:38 ` [Qemu-devel] [PATCH v2 05/10] target/arm: Introduce arm_hcr_el2_eff Richard Henderson
2018-12-06 12:09 ` Peter Maydell
2018-12-06 17:23 ` Richard Henderson
2018-12-03 20:38 ` [Qemu-devel] [PATCH v2 06/10] target/arm: Use arm_hcr_el2_eff more places Richard Henderson
2018-12-06 13:06 ` Peter Maydell
2018-12-06 13:32 ` Richard Henderson [this message]
2018-12-06 13:50 ` Peter Maydell
2018-12-03 20:38 ` [Qemu-devel] [PATCH v2 07/10] target/arm: Tidy scr_write Richard Henderson
2018-12-06 13:23 ` Peter Maydell
2018-12-03 20:38 ` [Qemu-devel] [PATCH v2 08/10] target/arm: Implement the ARMv8.1-LOR extension Richard Henderson
2018-12-06 13:49 ` Peter Maydell
2018-12-06 13:58 ` Richard Henderson
2018-12-06 16:25 ` Richard Henderson
2018-12-03 20:38 ` [Qemu-devel] [PATCH v2 09/10] target/arm: Implement the ARMv8.1-HPD extension Richard Henderson
2018-12-03 20:38 ` [Qemu-devel] [PATCH v2 10/10] target/arm: Implement the ARMv8.2-AA32HPD extension Richard Henderson
2018-12-06 14:03 ` [Qemu-devel] [PATCH v2 00/10] target/arm: LOR, HPD, AA32HPD 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=f5e828de-24d5-73a2-27e3-dac101926faa@linaro.org \
--to=richard.henderson@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).