[PATCH v3 04/15] KVM: arm64: nv: Drop VCPU_HYP_CONTEXT flag

Marc Zyngier maz at kernel.org
Wed Apr 17 00:51:42 PDT 2024


On Tue, 16 Apr 2024 21:06:26 +0100,
Oliver Upton <oliver.upton at linux.dev> wrote:
> 
> On Thu, Mar 21, 2024 at 03:53:45PM +0000, Marc Zyngier wrote:
> > diff --git a/arch/arm64/kvm/hyp/vhe/switch.c b/arch/arm64/kvm/hyp/vhe/switch.c
> > index 1581df6aec87..58415783fd53 100644
> > --- a/arch/arm64/kvm/hyp/vhe/switch.c
> > +++ b/arch/arm64/kvm/hyp/vhe/switch.c
> > @@ -197,7 +197,7 @@ static void early_exit_filter(struct kvm_vcpu *vcpu, u64 *exit_code)
> >  	 * If we were in HYP context on entry, adjust the PSTATE view
> >  	 * so that the usual helpers work correctly.
> >  	 */
> > -	if (unlikely(vcpu_get_flag(vcpu, VCPU_HYP_CONTEXT))) {
> > +	if (unlikely(read_sysreg(hcr_el2) & HCR_NV)) {
> 
> Can this be additionally predicated on vcpu_has_nv() so we condition on
> the NV cpucap and avoid the sysreg read on non-nesting hardware?

Yup, good call. I'll add that.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list