[PATCH 3/3] KVM: arm64: timer: Consolidate NV configuration of virtual timers

Marc Zyngier maz at kernel.org
Fri Jan 31 00:46:11 PST 2025


On Thu, 30 Jan 2025 21:41:04 +0000,
Oliver Upton <oliver.upton at linux.dev> wrote:
> 
> > +void kvm_timer_vcpu_nv_init(struct kvm_vcpu *vcpu)
> > +{
> > +	/*
> > +	 * A vcpu running at EL2 is in charge of the offset applied to
> > +	 * the virtual timer, so use the physical VM offset, and point
> > +	 * the vcpu offset to CNTVOFF_EL2.
> > +	 *
> > +	 * The virtual offset behaviour is "interesting", as it always
> > +	 * applies when HCR_EL2.E2H==0, but only when accessed from EL1 when
> > +	 * HCR_EL2.E2H==1. Apply it to the HV timer when E2H==0.
> > +	 */
> 
> I'm definitely being pedantic, but all the talk of an HV timer when
> E2H==0 isn't sitting well with me. Since a programmable E2H has gone
> out the window there isn't such thing as an HV timer when E2H==0, as
> FEAT_VHE isn't implemented for the VM.

Ah, that's a very good point!

> And along those lines, accesses to CNTHV_*_EL2 registers should undef
> when FEAT_VHE isn't implemented for the VM but I don't think we have any
> enforcement of that.

Indeed. Let me fix this and add the required UNDEF behaviour.

Thanks,

	M.

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



More information about the linux-arm-kernel mailing list