static int set_clidr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,nit: you may update the function doc comment which the extra handling of
u64 val)
{
- u64 ctr_el0 = read_sanitised_ftr_reg(SYS_CTR_EL0);
u64 idc = !CLIDR_LOC(val) || (!CLIDR_LOUIS(val) && !CLIDR_LOUU(val));
+ u64 ctr_el0 = vcpu->kvm->arch.ctr_el0;
if ((val & CLIDR_EL1_RES0) || (!(ctr_el0 & CTR_EL0_IDC) && idc))
return -EINVAL;
CTR_EL0.
@@ -3557,6 +3557,13 @@ void kvm_reset_sys_regs(struct kvm_vcpu *vcpu)at this stage of the reading, why is the above check needed?
struct kvm *kvm = vcpu->kvm;
unsigned long i;
+ if (!kvm_vcpu_initialized(vcpu))