Re: [PATCH v20 05/14] KVM: arm64: Set PSTATE.EXLOCK when entering an exception
From: Mark Brown
Date: Thu Sep 03 2026 - 13:15:19 EST
On Thu, Sep 03, 2026 at 03:25:09PM +0100, Leonardo Bras wrote:
> On Tue, Sep 01, 2026 at 10:47:03PM +0100, Mark Brown wrote:
> [...]
> > + /* When taking an exception to a higher EL EXLOCK is cleared. */
> > + if ((mode | PSR_MODE_THREAD_BIT) != target_mode)
> > + return 0;
> "Higher" is mentioned here, but the comparison is a "!=", so I suppose
> here we trust the fact that we always have "mode <= target_mode", and only
> 2 possible target exception levels (EL2h and EL1h).
> It's a nit, but maybe a "<" here would be more clear?
Sure.
> > + // PSTATE.EXLOCK is set to 0 upon any exception to a higher
> > + // EL, or to GCSCR_ELx.EXLOCKEN for an exception to the same
> > + // exception level. See ARM DDI 0487 R_WTXBY.
> > + new |= compute_exlock(vcpu, mode, target_mode);
> Same nit: am I really setting one bit here? or could be
> more stuff depending on the parameters? Having an "if (cond) new |= bit"
> seems more clear to what is being done, without needing to read the comment
> above.
The goal with the comment is to explain the rule that the code is
implementing in a style similar to all the other field updates in the
same function.
Attachment:
signature.asc
Description: PGP signature