From bc99c43940ae5da55f6558acd5ffab301d7fb8b6 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 17 Dec 2024 09:38:07 +0100 Subject: [PATCH] 5.4-stable patches added patches: kvm-arm64-ignore-pmcntenset_el0-while-checking-for-overflow-status.patch --- ...0-while-checking-for-overflow-status.patch | 43 +++++++++++++++++++ queue-5.4/series | 1 + 2 files changed, 44 insertions(+) create mode 100644 queue-5.4/kvm-arm64-ignore-pmcntenset_el0-while-checking-for-overflow-status.patch diff --git a/queue-5.4/kvm-arm64-ignore-pmcntenset_el0-while-checking-for-overflow-status.patch b/queue-5.4/kvm-arm64-ignore-pmcntenset_el0-while-checking-for-overflow-status.patch new file mode 100644 index 00000000000..1aa35726a9f --- /dev/null +++ b/queue-5.4/kvm-arm64-ignore-pmcntenset_el0-while-checking-for-overflow-status.patch @@ -0,0 +1,43 @@ +From 54bbee190d42166209185d89070c58a343bf514b Mon Sep 17 00:00:00 2001 +From: Raghavendra Rao Ananta +Date: Tue, 19 Nov 2024 16:52:29 -0800 +Subject: KVM: arm64: Ignore PMCNTENSET_EL0 while checking for overflow status + +From: Raghavendra Rao Ananta + +commit 54bbee190d42166209185d89070c58a343bf514b upstream. + +DDI0487K.a D13.3.1 describes the PMU overflow condition, which evaluates +to true if any counter's global enable (PMCR_EL0.E), overflow flag +(PMOVSSET_EL0[n]), and interrupt enable (PMINTENSET_EL1[n]) are all 1. +Of note, this does not require a counter to be enabled +(i.e. PMCNTENSET_EL0[n] = 1) to generate an overflow. + +Align kvm_pmu_overflow_status() with the reality of the architecture +and stop using PMCNTENSET_EL0 as part of the overflow condition. The +bug was discovered while running an SBSA PMU test [*], which only sets +PMCR.E, PMOVSSET<0>, PMINTENSET<0>, and expects an overflow interrupt. + +Cc: stable@vger.kernel.org +Fixes: 76d883c4e640 ("arm64: KVM: Add access handler for PMOVSSET and PMOVSCLR register") +Link: https://github.com/ARM-software/sbsa-acs/blob/master/test_pool/pmu/operating_system/test_pmu001.c +Signed-off-by: Raghavendra Rao Ananta +[ oliver: massaged changelog ] +Reviewed-by: Marc Zyngier +Link: https://lore.kernel.org/r/20241120005230.2335682-2-oliver.upton@linux.dev +Signed-off-by: Oliver Upton +Signed-off-by: Greg Kroah-Hartman +--- + virt/kvm/arm/pmu.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/virt/kvm/arm/pmu.c ++++ b/virt/kvm/arm/pmu.c +@@ -357,7 +357,6 @@ static u64 kvm_pmu_overflow_status(struc + + if ((__vcpu_sys_reg(vcpu, PMCR_EL0) & ARMV8_PMU_PMCR_E)) { + reg = __vcpu_sys_reg(vcpu, PMOVSSET_EL0); +- reg &= __vcpu_sys_reg(vcpu, PMCNTENSET_EL0); + reg &= __vcpu_sys_reg(vcpu, PMINTENSET_EL1); + reg &= kvm_pmu_valid_counter_mask(vcpu); + } diff --git a/queue-5.4/series b/queue-5.4/series index 45c874d551e..6b2a044015f 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -18,3 +18,4 @@ acpica-events-evxfregn-don-t-release-the-contextmute.patch blk-iocost-clamp-inuse-and-skip-noops-in-__propagate.patch blk-iocost-fix-weight-updates-of-inner-active-iocgs.patch blk-iocost-avoid-using-clamp-on-inuse-in-__propagate.patch +kvm-arm64-ignore-pmcntenset_el0-while-checking-for-overflow-status.patch -- 2.47.3