From: Oliver Upton <oliver.upton@linux.dev>
To: Sasha Levin <sashal@kernel.org>
Cc: stable@vger.kernel.org, Marc Zyngier <maz@kernel.org>
Subject: Re: [PATCH 6.15.y 1/5] KVM: arm64: Repaint pmcr_n into nr_pmu_counters
Date: Thu, 14 Aug 2025 14:47:43 -0700 [thread overview]
Message-ID: <aJ5ZfyyCHWXW9XdZ@linux.dev> (raw)
In-Reply-To: <20250813211820.2074887-1-sashal@kernel.org>
Hi Sasha,
Please drop this series, it affects code that is effectively dead prior
to 6.16.
Thanks,
Oliver
On Wed, Aug 13, 2025 at 05:18:16PM -0400, Sasha Levin wrote:
> From: Marc Zyngier <maz@kernel.org>
>
> [ Upstream commit f12b54d7c24388886277598236b3eeea5c68eec4 ]
>
> The pmcr_n field obviously refers to PMCR_EL0.N, but is generally used
> as the number of counters seen by the guest. Rename it accordingly.
>
> Suggested-by: Oliver upton <oliver.upton@linux.dev>
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> Stable-dep-of: c6e35dff58d3 ("KVM: arm64: Check for SYSREGS_ON_CPU before accessing the CPU state")
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> arch/arm64/include/asm/kvm_host.h | 4 ++--
> arch/arm64/kvm/pmu-emul.c | 6 +++---
> arch/arm64/kvm/sys_regs.c | 4 ++--
> 3 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
> index 08ba91e6fb03..bea8ae1b1b02 100644
> --- a/arch/arm64/include/asm/kvm_host.h
> +++ b/arch/arm64/include/asm/kvm_host.h
> @@ -359,8 +359,8 @@ struct kvm_arch {
>
> cpumask_var_t supported_cpus;
>
> - /* PMCR_EL0.N value for the guest */
> - u8 pmcr_n;
> + /* Maximum number of counters for the guest */
> + u8 nr_pmu_counters;
>
> /* Iterator for idreg debugfs */
> u8 idreg_debugfs_iter;
> diff --git a/arch/arm64/kvm/pmu-emul.c b/arch/arm64/kvm/pmu-emul.c
> index a1bc10d7116a..60b5a5e4a6c5 100644
> --- a/arch/arm64/kvm/pmu-emul.c
> +++ b/arch/arm64/kvm/pmu-emul.c
> @@ -280,7 +280,7 @@ static u64 kvm_pmu_hyp_counter_mask(struct kvm_vcpu *vcpu)
> return 0;
>
> hpmn = SYS_FIELD_GET(MDCR_EL2, HPMN, __vcpu_sys_reg(vcpu, MDCR_EL2));
> - n = vcpu->kvm->arch.pmcr_n;
> + n = vcpu->kvm->arch.nr_pmu_counters;
>
> /*
> * Programming HPMN to a value greater than PMCR_EL0.N is
> @@ -1032,7 +1032,7 @@ static void kvm_arm_set_pmu(struct kvm *kvm, struct arm_pmu *arm_pmu)
> lockdep_assert_held(&kvm->arch.config_lock);
>
> kvm->arch.arm_pmu = arm_pmu;
> - kvm->arch.pmcr_n = kvm_arm_pmu_get_max_counters(kvm);
> + kvm->arch.nr_pmu_counters = kvm_arm_pmu_get_max_counters(kvm);
> }
>
> /**
> @@ -1261,7 +1261,7 @@ u64 kvm_vcpu_read_pmcr(struct kvm_vcpu *vcpu)
> {
> u64 pmcr = __vcpu_sys_reg(vcpu, PMCR_EL0);
>
> - return u64_replace_bits(pmcr, vcpu->kvm->arch.pmcr_n, ARMV8_PMU_PMCR_N);
> + return u64_replace_bits(pmcr, vcpu->kvm->arch.nr_pmu_counters, ARMV8_PMU_PMCR_N);
> }
>
> void kvm_pmu_nested_transition(struct kvm_vcpu *vcpu)
> diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> index 5dde9285afc8..554490360ff6 100644
> --- a/arch/arm64/kvm/sys_regs.c
> +++ b/arch/arm64/kvm/sys_regs.c
> @@ -785,7 +785,7 @@ static unsigned int pmu_visibility(const struct kvm_vcpu *vcpu,
> static u64 reset_pmu_reg(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r)
> {
> u64 mask = BIT(ARMV8_PMU_CYCLE_IDX);
> - u8 n = vcpu->kvm->arch.pmcr_n;
> + u8 n = vcpu->kvm->arch.nr_pmu_counters;
>
> if (n)
> mask |= GENMASK(n - 1, 0);
> @@ -1217,7 +1217,7 @@ static int set_pmcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r,
> */
> if (!kvm_vm_has_ran_once(kvm) &&
> new_n <= kvm_arm_pmu_get_max_counters(kvm))
> - kvm->arch.pmcr_n = new_n;
> + kvm->arch.nr_pmu_counters = new_n;
>
> mutex_unlock(&kvm->arch.config_lock);
>
> --
> 2.39.5
>
prev parent reply other threads:[~2025-08-14 21:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-12 16:14 FAILED: patch "[PATCH] KVM: arm64: Check for SYSREGS_ON_CPU before accessing the CPU" failed to apply to 6.15-stable tree gregkh
2025-08-13 21:18 ` [PATCH 6.15.y 1/5] KVM: arm64: Repaint pmcr_n into nr_pmu_counters Sasha Levin
2025-08-13 21:18 ` [PATCH 6.15.y 2/5] KVM: arm64: Fix MDCR_EL2.HPMN reset value Sasha Levin
2025-08-13 21:18 ` [PATCH 6.15.y 3/5] KVM: arm64: Handle out-of-bound write to MDCR_EL2.HPMN Sasha Levin
2025-08-13 21:18 ` [PATCH 6.15.y 4/5] KVM: arm64: Add assignment-specific sysreg accessor Sasha Levin
2025-08-13 21:18 ` [PATCH 6.15.y 5/5] KVM: arm64: Check for SYSREGS_ON_CPU before accessing the CPU state Sasha Levin
2025-08-14 21:47 ` Oliver Upton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aJ5ZfyyCHWXW9XdZ@linux.dev \
--to=oliver.upton@linux.dev \
--cc=maz@kernel.org \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).