[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <90e53cc7-039f-5abc-f94c-cf53a1602a2a@redhat.com>
Date: Wed, 29 May 2024 17:51:01 +0200 (CEST)
From: Sebastian Ott <sebott@...hat.com>
To: Eric Auger <eauger@...hat.com>
cc: linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.linux.dev,
linux-kernel@...r.kernel.org, Marc Zyngier <maz@...nel.org>,
Oliver Upton <oliver.upton@...ux.dev>, James Morse <james.morse@....com>,
Suzuki K Poulose <suzuki.poulose@....com>,
Catalin Marinas <catalin.marinas@....com>, Will Deacon <will@...nel.org>
Subject: Re: [PATCH v3 2/6] KVM: arm64: maintain per VM value for CTR_EL0
Hej Eric,
On Wed, 29 May 2024, Eric Auger wrote:
>> static int set_clidr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
>> 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;
> nit: you may update the function doc comment which the extra handling of
> CTR_EL0.
Hm, there's no extra handling of CTR_EL0 it just uses the emulated value.
>> @@ -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").
Sebastian
Powered by blists - more mailing lists