KVM: arm64: Make vCPU feature flags consistent VM-wide
authorOliver Upton <oliver.upton@linux.dev>
Fri, 9 Jun 2023 19:00:46 +0000 (19:00 +0000)
committerOliver Upton <oliver.upton@linux.dev>
Mon, 12 Jun 2023 23:08:33 +0000 (23:08 +0000)
commit2251e9ff1573a266102f40e507f0b8dc5861f3e4
tree8f6e8edd82f4c8e6bb827c6066b7fed7adf03655
parente3c1c0cae31ec9ebfdffeaa2c86ddeba6cf5c74c
KVM: arm64: Make vCPU feature flags consistent VM-wide

To date KVM has allowed userspace to construct asymmetric VMs where
particular features may only be supported on a subset of vCPUs. This
wasn't really the intened usage pattern, and it is a total pain in the
ass to keep working in the kernel. What's more, this is at odds with CPU
features in host userspace, where asymmetric features are largely hidden
or disabled.

It's time to put an end to the whole game. Require all vCPUs in the VM
to have the same feature set, rejecting deviants in the
KVM_ARM_VCPU_INIT ioctl. Preserve some of the vestiges of per-vCPU
feature flags in case we need to reinstate the old behavior for some
limited configurations. Yes, this is a sign of cowardice around a
user-visibile change.

Hoist all of the 32-bit limitations into kvm_vcpu_init_check_features()
to avoid nested attempts to acquire the config_lock, which won't end
well.

Link: https://lore.kernel.org/r/20230609190054.1542113-4-oliver.upton@linux.dev
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/include/asm/kvm_emulate.h
arch/arm64/include/asm/kvm_host.h
arch/arm64/kvm/arm.c
arch/arm64/kvm/reset.c