Re: [PATCH v20 05/14] KVM: arm64: Set PSTATE.EXLOCK when entering an exception
From: Leonardo Bras
Date: Thu Sep 03 2026 - 11:58:15 EST
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?
The rest of the code seems correct based on R_WTXBY.
[...]
>
> + // 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.
In any case, FWIW:
Reviewed-by: Leonardo Bras <leo.bras@xxxxxxx>
Thanks!
Leo