On Thu, 25 Sept 2025 at 14:54, Peter Maydell <[email protected]> wrote: > > On Tue, 16 Sept 2025 at 15:23, Richard Henderson > <[email protected]> wrote: > > > > Reviewed-by: Manos Pitsidianakis <[email protected]> > > Signed-off-by: Richard Henderson <[email protected]> > > --- > > target/arm/cpregs.h | 6 ++++ > > target/arm/gdbstub.c | 5 ++++ > > target/arm/helper.c | 53 +--------------------------------- > > target/arm/tcg/translate-a64.c | 9 ++++++ > > 4 files changed, 21 insertions(+), 52 deletions(-) > > > -/* Test if system register redirection is to occur in the current state. > > */ > > -static bool redirect_for_e2h(CPUARMState *env) > > -{ > > - return arm_current_el(env) == 2 && (arm_hcr_el2_eff(env) & HCR_E2H); > > -} > > > diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c > > index c0fa2137b6..3ef24fb0c3 100644 > > --- a/target/arm/tcg/translate-a64.c > > +++ b/target/arm/tcg/translate-a64.c > > @@ -2573,6 +2573,15 @@ static void handle_sys(DisasContext *s, bool isread, > > } > > } > > > > + if (ri->vhe_redir_to_el2 && s->current_el == 2 && s->e2h) { > > + /* > > + * This one of the FOO_EL1 registers which redirect to FOO_EL2 > > + * from EL2 when HCR_EL2.E2H is set. > > + */ > > + key = ri->vhe_redir_to_el2; > > + ri = redirect_cpreg(s, key, isread); > > + } > > I was looking through the details for this one, and noticed that > R_PHHPL says the redirects from FOO_EL12 to FOO_EL1 apply > when "the PE is executing at EL2 or EL3", so I think our > check on "EL == 2" isn't actually correct.
No, I'm wrong here -- R_PHHPL is for the registers handled in patch 34. This codepath is for E2H redirects as listed in R_JGGMV, and those do only happen at EL2, not at EL3. -- PMM
