On Thu, 28 Dec 2023 at 00:42, Richard Henderson <richard.hender...@linaro.org> wrote: > > On 12/18/23 22:32, Peter Maydell wrote: > > Mark up the cpreginfo structs to indicate offsets for system > > registers from VNCR_EL2, as defined in table D8-66 in rule R_CSRPQ in > > the Arm ARM. This commit covers offsets 0x100 to 0x160. > > > > Many (but not all) of the registers in this range have _EL12 aliases, > > and the slot in memory is shared between the _EL12 version of the > > register and the _EL1 version. Where we programmatically generate > > the regdef for the _EL12 register, arrange that its > > nv2_redirect_offset is set up correctly to do this. > > > > Signed-off-by: Peter Maydell <peter.mayd...@linaro.org> > > --- > > target/arm/debug_helper.c | 1 + > > target/arm/helper.c | 22 ++++++++++++++++++++++ > > 2 files changed, 23 insertions(+) > > Reviewed-by: Richard Henderson <richard.hender...@linaro.org> > > > + /* > > + * If the _EL1 register is redirected to memory by FEAT_NV2, > > + * then it shares the offset with the _EL12 register, > > + * and which one is redirected depends on HCR_EL2.NV1. > > + */ > > + if (new_reg->nv2_redirect_offset) { > > + assert(new_reg->nv2_redirect_offset & NV2_REDIR_NV1); > > + new_reg->nv2_redirect_offset &= ~NV2_REDIR_NV1; > > + new_reg->nv2_redirect_offset |= NV2_REDIR_NO_NV1; > > + } > > Could use xor to flip both bits at once.
Could do, but explicit clear-then-set seems a bit more readable to me, and since this is only happening once at startup there's no efficiency concern here. thanks -- PMM