From: Richard Henderson <richard.henderson@linaro.org>
To: LIU Zhiwei <zhiwei_liu@c-sky.com>,
qemu-devel@nongnu.org, qemu-arm@nongnu.org
Cc: peter.maydell@linaro.org
Subject: Re: [PATCH 1/1] target/arm: adjust CPTR_EL2 according to HCR_EL2.E2H
Date: Thu, 13 Aug 2020 13:56:03 -0700 [thread overview]
Message-ID: <23e615df-8e29-6e4c-a1bd-5f8ba414f471@linaro.org> (raw)
In-Reply-To: <20200811060749.159-1-zhiwei_liu@c-sky.com>
On 8/10/20 11:07 PM, LIU Zhiwei wrote:
> if (el <= 2 && !arm_is_secure_below_el3(env)) {
> - if (env->cp15.cptr_el[2] & CPTR_TZ) {
> - return 2;
> - }
> - if (env->cp15.cptr_el[2] & CPTR_TFP) {
> - return 0;
> + if ((arm_hcr_el2_eff(env) & HCR_E2H) == HCR_E2H) {
> + int zen = extract32(env->cp15.cptr_el[2], 16, 2);
> + switch (zen) {
> + case 0:
> + case 2:
> + return 2;
> + case 1:
> + if ((arm_hcr_el2_eff(env) & HCR_TGE) == HCR_TGE) {
Since the outer if checks that we're in non-secure state, and (by nature of
sve) we know we're in aarch64 mode, then we don't need to use arm_hcr_el2_eff
and can just use env->cp15.hcr_el2.
Add a comment
> /* Since we exclude secure first, we may read HCR_EL2 directly. */
like we do in vae1_tlbmask.
You do not need to write
if ((x & bit) == bit)
just use
if (x & bit)
here.
With those changes,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
prev parent reply other threads:[~2020-08-13 20:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-11 6:07 [PATCH 1/1] target/arm: adjust CPTR_EL2 according to HCR_EL2.E2H LIU Zhiwei
2020-08-13 20:56 ` Richard Henderson [this message]
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=23e615df-8e29-6e4c-a1bd-5f8ba414f471@linaro.org \
--to=richard.henderson@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=zhiwei_liu@c-sky.com \
/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).