Re: [PATCH v3 2/6] KVM: arm64: maintain per VM value for CTR_EL0

From: Sebastian Ott
Date: Thu May 30 2024 - 07:24:10 EST


On Wed, 29 May 2024, Eric Auger wrote:
On 5/29/24 17:51, Sebastian Ott wrote:
On Wed, 29 May 2024, Eric Auger wrote:
@@ -3557,6 +3557,13 @@ void kvm_reset_sys_regs(struct kvm_vcpu *vcpu)
     struct kvm *kvm = vcpu->kvm;
     unsigned long i;

+    if (!kvm_vcpu_initialized(vcpu))
at this stage of the reading, why is the above check needed?

To make sure that a later call to this function doesn't overwrite
the value provided by userspace. (See e016333745c "KVM: arm64: Only
reset vCPU-scoped feature ID regs once").
but isn't it overwritten through the .reset=reset_ctr() that is
populated in next patch?

No, this is done via reset_vcpu_ftr_id_reg() and also guarded by
kvm_vcpu_initialized().

Sebastian