[PATCH 0/3] KVM: arm64: Handle CCSIDR associativity mismatches

From: Akihiko Odaki
Date: Thu Dec 01 2022 - 05:50:58 EST


M2 MacBook Air has mismatched CCSIDR associativity bits, which makes the
bits a KVM vCPU sees inconsistent when migrating.

It also makes QEMU fail restoring the vCPU registers because QEMU saves
and restores all of the registers including CCSIDRs, and if the vCPU
migrated among physical CPUs between saving and restoring, it tries to
restore CCSIDR values that mismatch with the current physical CPU, which
causes EFAULT.

Trap CCSIDRs if there are CCSIDR value msimatches, and override the
associativity bits when handling the trap.

Akihiko Odaki (3):
KVM: arm64: Make CCSIDRs consistent
arm64: errata: Check for mismatched cache associativity
KVM: arm64: Handle CCSIDR associativity mismatches

arch/arm64/include/asm/cache.h | 3 ++
arch/arm64/include/asm/cpu.h | 1 +
arch/arm64/include/asm/cpufeature.h | 8 +++++
arch/arm64/include/asm/kvm_emulate.h | 10 ++++--
arch/arm64/include/asm/sysreg.h | 7 ++++
arch/arm64/kernel/cacheinfo.c | 4 +--
arch/arm64/kernel/cpu_errata.c | 52 ++++++++++++++++++++++++++++
arch/arm64/kernel/cpufeature.c | 4 +++
arch/arm64/kernel/cpuinfo.c | 30 ++++++++++++++++
arch/arm64/kvm/sys_regs.c | 50 ++++++++++++++------------
arch/arm64/tools/cpucaps | 1 +
11 files changed, 144 insertions(+), 26 deletions(-)

--
2.38.1