From: Oliver Upton <oupton@kernel.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: Peter Maydell <peter.maydell@linaro.org>,
qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH] target/arm: Only evaluate SCR_EL3.PIEN if ARM_FEATURE_EL3 is present
Date: Fri, 26 Jun 2026 16:13:57 -0700 [thread overview]
Message-ID: <aj8HtXA7G_EFSrsL@kernel.org> (raw)
In-Reply-To: <854ffb2f-a363-4c69-9a51-95151dfff517@linaro.org>
On Fri, Jun 26, 2026 at 03:55:22PM -0700, Richard Henderson wrote:
> On 6/26/26 13:36, Oliver Upton wrote:
> > Running KVM with (as of writing, out-of-tree) support for FEAT_S2PIE
> > on -cpu max gets stuck in an infinite loop of stage-2 permission faults
> > due to the PTW incorrectly using an effective value of 0 for S2PIR_EL2.
> >
> > Similar to how S1PIE is handled, only use the IMPLEMENTATION SPECIFIC
> > value of 0 for S2PIR_EL2 if EL3 is implemented and PIEN=0.
> >
> > Fixes: a811c5dafb ("target/arm: Implement get_S2prot_indirect")
> > Signed-off-by: Oliver Upton <oupton@kernel.org>
> > ---
> > target/arm/ptw.c | 8 ++++++--
> > 1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/target/arm/ptw.c b/target/arm/ptw.c
> > index 1470de3010..4a7aeb140c 100644
> > --- a/target/arm/ptw.c
> > +++ b/target/arm/ptw.c
> > @@ -1414,9 +1414,13 @@ static int get_S2prot_indirect(CPUARMState *env, GetPhysAddrResult *result,
> > PAGE_READ | PAGE_WRITE },
> > };
> > - uint64_t pir = (env->cp15.scr_el3 & SCR_PIEN ? env->cp15.s2pir_el2 : 0);
> > - int s2pi = extract64(pir, pi_index * 4, 4);
> > + uint64_t pir = env->cp15.s2pir_el2;
> > + int s2pi;
> > + if (arm_feature(env, ARM_FEATURE_EL3) && !(env->cp15.scr_el3 & SCR_PIEN))
> > + pir = 0;
> > +
> > + s2pi = extract64(pir, pi_index * 4, 4);
> > result->f.prot = perm_table[s2pi][2];
> > return perm_table[s2pi][s1_is_el0];
> > }
> >
> > base-commit: 8f1d3b586f1265023f75ea9c227c35d463321aef
>
> Braces required for the IF. Otherwise,
Kernel style, my bad.
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
thanks!
--
Best,
Oliver
prev parent reply other threads:[~2026-06-26 23:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-26 20:36 [PATCH] target/arm: Only evaluate SCR_EL3.PIEN if ARM_FEATURE_EL3 is present Oliver Upton
2026-06-26 22:55 ` Richard Henderson
2026-06-26 23:13 ` Oliver Upton [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=aj8HtXA7G_EFSrsL@kernel.org \
--to=oupton@kernel.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.