[PATCH] KVM: arm64: Add helper to identify a nested context
Oliver Upton
oliver.upton at linux.dev
Sat May 31 10:52:07 PDT 2025
On Sat, May 31, 2025 at 05:49:01PM +0100, Marc Zyngier wrote:
> A common idiom in the KVM code is to check if we are currently
> dealing with a "nested" context, defined as having NV enabled,
> but being in the EL1&0 translation regime.
>
> This is usually expressed as:
>
> if (vcpu_has_nv(vcpu) && !is_hyp_ctxt(vcpu) ... )
>
> which is a mouthful and a bit hard to read, specially when followed
> by additional conditions.
>
> Introduce a new helper that encapsulate these two terms, allowing
> the above to be written as
>
> if (is_nested_context(vcpu) ... )
>
> which is both shorter and easier to read, and makes more obvious
> the potential for simplification on some code paths.
>
> Signed-off-by: Marc Zyngier <maz at kernel.org>
Thanks! I'll probably pick this up as a prefix on my abort routing
series if that's OK with you.
Best,
Oliver
More information about the linux-arm-kernel
mailing list