All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "arm64: KVM: pmu: Fix AArch32 cycle counter access" has been added to the 4.8-stable tree
@ 2016-11-21 10:56 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-11-21 10:56 UTC (permalink / raw)
  To: wei, gregkh, marc.zyngier; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    arm64: KVM: pmu: Fix AArch32 cycle counter access

to the 4.8-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     arm64-kvm-pmu-fix-aarch32-cycle-counter-access.patch
and it can be found in the queue-4.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 9e3f7a29694049edd728e2400ab57ad7553e5aa9 Mon Sep 17 00:00:00 2001
From: Wei Huang <wei@redhat.com>
Date: Wed, 16 Nov 2016 09:20:57 +0000
Subject: arm64: KVM: pmu: Fix AArch32 cycle counter access

From: Wei Huang <wei@redhat.com>

commit 9e3f7a29694049edd728e2400ab57ad7553e5aa9 upstream.

We're missing the handling code for the cycle counter accessed
from a 32bit guest, leading to unexpected results.

Signed-off-by: Wei Huang <wei@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/kvm/sys_regs.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -602,8 +602,14 @@ static bool access_pmu_evcntr(struct kvm
 
 			idx = ARMV8_PMU_CYCLE_IDX;
 		} else {
-			BUG();
+			return false;
 		}
+	} else if (r->CRn == 0 && r->CRm == 9) {
+		/* PMCCNTR */
+		if (pmu_access_event_counter_el0_disabled(vcpu))
+			return false;
+
+		idx = ARMV8_PMU_CYCLE_IDX;
 	} else if (r->CRn == 14 && (r->CRm & 12) == 8) {
 		/* PMEVCNTRn_EL0 */
 		if (pmu_access_event_counter_el0_disabled(vcpu))
@@ -611,7 +617,7 @@ static bool access_pmu_evcntr(struct kvm
 
 		idx = ((r->CRm & 3) << 3) | (r->Op2 & 7);
 	} else {
-		BUG();
+		return false;
 	}
 
 	if (!pmu_counter_idx_valid(vcpu, idx))


Patches currently in stable-queue which might be from wei@redhat.com are

queue-4.8/arm64-kvm-pmu-fix-aarch32-cycle-counter-access.patch
queue-4.8/kvm-arm64-fix-the-issues-when-guest-pmccfiltr-is-configured.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-11-21 10:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-21 10:56 Patch "arm64: KVM: pmu: Fix AArch32 cycle counter access" has been added to the 4.8-stable tree gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.