[PATCH v19 05/14] KVM: arm64: Set PSTATE.EXLOCK when entering an exception

Mark Brown broonie at kernel.org
Fri Aug 21 16:01:20 PDT 2026


On Fri, Aug 21, 2026 at 03:15:26PM +0100, Wei-Lin Chang wrote:
> On Wed, Aug 12, 2026 at 08:12:04PM +0100, Mark Brown wrote:

> > +static unsigned long compute_exlock(struct kvm_vcpu *vcpu,
> > +				    unsigned long mode,
> > +				    unsigned long target_mode)
> > +{

> > +	/* When taking an exception to a higher EL EXLOCK is cleared. */
> > +	if ((mode | PSR_MODE_THREAD_BIT) != target_mode)
> > +		return 0;

> This is essentially doing an EL comparison, which is also done in
> kvm_check_illegal_exlock_return() later. Would it be clearer if we
> follow the EL comparison pattern there? exlock_el_from_spsr() can have
> more use too.

Yeah, I wasn't super happy there - it's partly a question of what's to
hand and already in use in each location.  The rest of this code is
using mode.  I think given your valid concerns about the naming around
parsing out the EL in kvm_check_illegal_exlock_return() it's easier to
go the other way, make that code look more like this and hence sidestep
the naming issue.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20260822/c14b030d/attachment.sig>


More information about the linux-arm-kernel mailing list