]> git.ipfire.org Git - thirdparty/linux.git/commit
KVM: arm64: Allow userspace to change the implementation ID registers
authorSebastian Ott <sebott@redhat.com>
Tue, 25 Feb 2025 00:54:00 +0000 (16:54 -0800)
committerOliver Upton <oliver.upton@linux.dev>
Wed, 26 Feb 2025 09:32:16 +0000 (01:32 -0800)
commit3adaee78306148da5df5d3d655e9a90bf18e9513
tree1506fb13c2ded167c7bd16f0e98a444e081888d5
parentd0d81e03e6292b411452501ef0b3583b5ea884f7
KVM: arm64: Allow userspace to change the implementation ID registers

KVM's treatment of the ID registers that describe the implementation
(MIDR, REVIDR, and AIDR) is interesting, to say the least. On the
userspace-facing end of it, KVM presents the values of the boot CPU on
all vCPUs and treats them as invariant. On the guest side of things KVM
presents the hardware values of the local CPU, which can change during
CPU migration in a big-little system.

While one may call this fragile, there is at least some degree of
predictability around it. For example, if a VMM wanted to present
big-little to a guest, it could affine vCPUs accordingly to the correct
clusters.

All of this makes a giant mess out of adding support for making these
implementation ID registers writable. Avoid breaking the rather subtle
ABI around the old way of doing things by requiring opt-in from
userspace to make the registers writable.

When the cap is enabled, allow userspace to set MIDR, REVIDR, and AIDR
to any non-reserved value and present those values consistently across
all vCPUs.

Signed-off-by: Sebastian Ott <sebott@redhat.com>
[oliver: changelog, capability]
Link: https://lore.kernel.org/r/20250225005401.679536-5-oliver.upton@linux.dev
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Documentation/virt/kvm/api.rst
arch/arm64/include/asm/kvm_host.h
arch/arm64/kvm/arm.c
arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h
arch/arm64/kvm/sys_regs.c
include/uapi/linux/kvm.h