[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2dcfc174-9384-4746-833d-1442bcfb6d11@redhat.com>
Date: Wed, 29 May 2024 19:35:33 +0200
From: Eric Auger <eauger@...hat.com>
To: Sebastian Ott <sebott@...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
On 5/29/24 17:51, Sebastian Ott wrote:
> 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").
but isn't it overwritten through the .reset=reset_ctr() that is
populated in next patch?
Eric
>
> Sebastian
>
Powered by blists - more mailing lists