[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z9H3yuv96gBPty76@linux.dev>
Date: Wed, 12 Mar 2025 14:08:26 -0700
From: Oliver Upton <oliver.upton@...ux.dev>
To: Akihiko Odaki <akihiko.odaki@...nix.com>
Cc: Marc Zyngier <maz@...nel.org>, Joey Gouly <joey.gouly@....com>,
Suzuki K Poulose <suzuki.poulose@....com>,
Zenghui Yu <yuzenghui@...wei.com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, Andrew Jones <drjones@...hat.com>,
Shannon Zhao <shannon.zhao@...aro.org>,
linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.linux.dev,
linux-kernel@...r.kernel.org, devel@...nix.com
Subject: Re: [PATCH v3 2/6] KVM: arm64: PMU: Assume PMU presence in pmu-emul.c
Hi Akihiko,
On Wed, Mar 12, 2025 at 08:55:56PM +0900, Akihiko Odaki wrote:
[...]
> diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
> index 962f985977c2..fc09eec3fd94 100644
> --- a/arch/arm64/kvm/guest.c
> +++ b/arch/arm64/kvm/guest.c
> @@ -951,6 +951,10 @@ int kvm_arm_vcpu_arch_set_attr(struct kvm_vcpu *vcpu,
>
> switch (attr->group) {
> case KVM_ARM_VCPU_PMU_V3_CTRL:
> + if (!kvm_vcpu_has_pmu(vcpu)) {
> + ret = -ENODEV;
> + break;
> + }
> mutex_lock(&vcpu->kvm->arch.config_lock);
> ret = kvm_arm_pmu_v3_set_attr(vcpu, attr);
> mutex_unlock(&vcpu->kvm->arch.config_lock);
> @@ -976,6 +980,10 @@ int kvm_arm_vcpu_arch_get_attr(struct kvm_vcpu *vcpu,
>
> switch (attr->group) {
> case KVM_ARM_VCPU_PMU_V3_CTRL:
> + if (!kvm_vcpu_has_pmu(vcpu)) {
> + ret = -ENODEV;
> + break;
> + }
> ret = kvm_arm_pmu_v3_get_attr(vcpu, attr);
> break;
> case KVM_ARM_VCPU_TIMER_CTRL:
> @@ -999,6 +1007,10 @@ int kvm_arm_vcpu_arch_has_attr(struct kvm_vcpu *vcpu,
>
> switch (attr->group) {
> case KVM_ARM_VCPU_PMU_V3_CTRL:
> + if (!kvm_vcpu_has_pmu(vcpu)) {
> + ret = -ENXIO;
> + break;
> + }
> ret = kvm_arm_pmu_v3_has_attr(vcpu, attr);
> break;
> case KVM_ARM_VCPU_TIMER_CTRL:
I agree with you for the most part on this patch, but I prefer we keep
the kvm_vcpu_has_pmu() with the ioctl implemementations rather than the
spot at which we demux the ioctl.
Thanks,
Oliver
Powered by blists - more mailing lists