aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2013-10-18 13:19:05 -0400
committerChristoffer Dall <christoffer.dall@linaro.org>2013-10-22 11:00:06 -0400
commit9cbb6d969cb6561de45d917b8bb9281cb374bb35 (patch)
tree9605395f3422d5507350e697f6dda20ae17b73f6
parent2d1d841bd44e24b58a3d3cc4fa793670aaa38fbf (diff)
ARM: KVM: fix L2CTLR to be per-cluster
The L2CTLR register contains the number of CPUs in this cluster. Make sure the register content is actually relevant to the vcpu that is being configured by computing the number of cores that are part of its cluster. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
-rw-r--r--arch/arm/kvm/coproc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/arm/kvm/coproc.c b/arch/arm/kvm/coproc.c
index 631e6bd0e05f..78c0885d6501 100644
--- a/arch/arm/kvm/coproc.c
+++ b/arch/arm/kvm/coproc.c
@@ -124,6 +124,10 @@ static void reset_l2ctlr(struct kvm_vcpu *vcpu, const struct coproc_reg *r)
124 asm volatile("mrc p15, 1, %0, c9, c0, 2\n" : "=r" (l2ctlr)); 124 asm volatile("mrc p15, 1, %0, c9, c0, 2\n" : "=r" (l2ctlr));
125 l2ctlr &= ~(3 << 24); 125 l2ctlr &= ~(3 << 24);
126 ncores = atomic_read(&vcpu->kvm->online_vcpus) - 1; 126 ncores = atomic_read(&vcpu->kvm->online_vcpus) - 1;
127 /* How many cores in the current cluster and the next ones */
128 ncores -= (vcpu->vcpu_id & ~3);
129 /* Cap it to the maximum number of cores in a single cluster */
130 ncores = min(ncores, 3U);
127 l2ctlr |= (ncores & 3) << 24; 131 l2ctlr |= (ncores & 3) << 24;
128 132
129 vcpu->arch.cp15[c9_L2CTLR] = l2ctlr; 133 vcpu->arch.cp15[c9_L2CTLR] = l2ctlr;