From: Richard Henderson <richard.henderson@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH] target/arm: Make the final stage1+2 write to secure be unconditional
Date: Fri, 7 Oct 2022 09:53:37 -0700 [thread overview]
Message-ID: <ed0332cf-5bf0-34ef-3233-de6840439e02@linaro.org> (raw)
In-Reply-To: <CAFEAcA93Urww5F+_gJonUUaLeS-7W8BhYqRgcJT1hcVY3LaUdA@mail.gmail.com>
On 10/7/22 09:20, Peter Maydell wrote:
>> - /* Check if IPA translates to secure or non-secure PA space. */
>> - if (is_secure) {
>> - if (ipa_secure) {
>> - result->attrs.secure =
>> - !(env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW));
>> - } else {
>> - result->attrs.secure =
>> - !((env->cp15.vtcr_el2 & (VTCR_NSA | VTCR_NSW))
>> - || (env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW)));
>> - }
>> - }
>
> If:
> is_secure == true
> ipa_secure == false
> (env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW) is non-zero
> (env->cp15.vtcr_el2 & (VTCR_NSA | VTCR_NSW) is zero
> then the old code sets attrs.secure to true...
No, I think the misalignment of the two lines wrt the !() may have been confusing:
if (true) {
if (false) {
} else {
secure = !((0) || (non-zero))
= !(1)
= 0
}
}
r~
>
>> + /*
>> + * Check if IPA translates to secure or non-secure PA space.
>> + * Note that VSTCR overrides VTCR and {N}SW overrides {N}SA.
>> + */
>> + result->attrs.secure =
>> + (is_secure
>> + && !(env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW))
>> + && (ipa_secure
>> + || !(env->cp15.vtcr_el2 & (VTCR_NSA | VTCR_NSW))));
>
> ...but the new code will set it to false, I think ?
>
> thanks
> -- PMM
next prev parent reply other threads:[~2022-10-07 16:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-07 15:21 [PATCH] target/arm: Make the final stage1+2 write to secure be unconditional Richard Henderson
2022-10-07 16:20 ` Peter Maydell
2022-10-07 16:53 ` Richard Henderson [this message]
2022-10-10 11:59 ` 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=ed0332cf-5bf0-34ef-3233-de6840439e02@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).