Re: [PATCH v20 05/14] KVM: arm64: Set PSTATE.EXLOCK when entering an exception
From: Leonardo Bras
Date: Thu Sep 03 2026 - 12:46:11 EST
On Thu, Sep 03, 2026 at 05:20:32PM +0100, Mark Brown wrote:
> > > + // 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.
Oh, right, to be clear:
I am not questioning the usefulness of the comment here.
It's more about "new |= function()" thing, as it's not immediately clear
what is being set unless I read the comment or read the function, as in the
case "if (function()) new |= bit" I may not immediately see the condition
but I know whatever it can be, it will only decide if I do or don't set
this given bit.
Thanks!
Leo