Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Marc Zyngier and committed by
Christoffer Dall
9cbb6d96 2d1d841b

+4
+4
arch/arm/kvm/coproc.c
··· 124 124 asm volatile("mrc p15, 1, %0, c9, c0, 2\n" : "=r" (l2ctlr)); 125 125 l2ctlr &= ~(3 << 24); 126 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 131 l2ctlr |= (ncores & 3) << 24; 128 132 129 133 vcpu->arch.cp15[c9_L2CTLR] = l2ctlr;