linux/arch/arm64/kvm
Reiji Watanabe 26bf74bd9f KVM: arm64: mixed-width check should be skipped for uninitialized vCPUs
KVM allows userspace to configure either all EL1 32bit or 64bit vCPUs
for a guest.  At vCPU reset, vcpu_allowed_register_width() checks
if the vcpu's register width is consistent with all other vCPUs'.
Since the checking is done even against vCPUs that are not initialized
(KVM_ARM_VCPU_INIT has not been done) yet, the uninitialized vCPUs
are erroneously treated as 64bit vCPU, which causes the function to
incorrectly detect a mixed-width VM.

Introduce KVM_ARCH_FLAG_EL1_32BIT and KVM_ARCH_FLAG_REG_WIDTH_CONFIGURED
bits for kvm->arch.flags.  A value of the EL1_32BIT bit indicates that
the guest needs to be configured with all 32bit or 64bit vCPUs, and
a value of the REG_WIDTH_CONFIGURED bit indicates if a value of the
EL1_32BIT bit is valid (already set up). Values in those bits are set at
the first KVM_ARM_VCPU_INIT for the guest based on KVM_ARM_VCPU_EL1_32BIT
configuration for the vCPU.

Check vcpu's register width against those new bits at the vcpu's
KVM_ARM_VCPU_INIT (instead of against other vCPUs' register width).

Fixes: 66e94d5caf ("KVM: arm64: Prevent mixed-width VM creation")
Signed-off-by: Reiji Watanabe <reijiw@google.com>
Reviewed-by: Oliver Upton <oupton@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220329031924.619453-2-reijiw@google.com
2022-04-06 12:29:45 +01:00
..
hyp ARM: 2022-03-24 11:58:57 -07:00
vgic KVM: arm64: vgic: Remove unnecessary type castings 2022-04-06 10:42:55 +01:00
.gitignore KVM: arm64: Generate hyp_constants.h for the host 2021-12-06 08:37:03 +00:00
arch_timer.c KVM: Add helpers to wake/query blocking vCPU 2021-12-08 04:24:54 -05:00
arm.c ARM: 2022-03-24 11:58:57 -07:00
debug.c KVM: arm64: Emulate the OS Lock 2022-02-08 14:23:41 +00:00
fpsimd.c KVM: arm64: Add comments for context flush and sync callbacks 2022-02-08 14:42:59 +00:00
guest.c KVM: arm64: fix typos in comments 2022-03-18 14:04:15 +00:00
handle_exit.c KVM: arm64: fix typos in comments 2022-03-18 14:04:15 +00:00
hypercalls.c KVM: arm64: Allow SMCCC_ARCH_WORKAROUND_3 to be discovered and migrated 2022-02-24 13:58:52 +00:00
inject_fault.c KVM: arm64: Move AArch32 exceptions over to AArch64 sysregs 2020-11-10 11:22:51 +00:00
irq.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 422 2019-06-05 17:37:15 +02:00
Kconfig RISCV: 2022-01-16 16:15:14 +02:00
Makefile KVM: arm64: Align the VMID allocation with the arm64 ASID 2022-02-08 14:57:03 +00:00
mmio.c KVM: arm64: Generalise VM features into a set of flags 2022-03-18 14:02:33 +00:00
mmu.c KVM: arm64: Don't split hugepages outside of MMU write lock 2022-04-06 10:41:05 +01:00
pkvm.c KVM: arm64: Move host EL1 code out of hyp/ directory 2021-12-06 08:37:03 +00:00
pmu-emul.c KVM: arm64: Generalise VM features into a set of flags 2022-03-18 14:02:33 +00:00
pmu.c KVM: arm64: Disable PMU support in protected mode 2021-03-19 12:02:19 +00:00
psci.c KVM: arm64: Drop unneeded minor version check from PSCI v1.x handler 2022-04-06 10:39:39 +01:00
pvtime.c KVM: arm64: Use kvm_write_guest_lock when init stolen time 2020-12-03 19:02:18 +00:00
reset.c KVM: arm64: mixed-width check should be skipped for uninitialized vCPUs 2022-04-06 12:29:45 +01:00
sys_regs.c ARM: 2022-03-24 11:58:57 -07:00
sys_regs.h KVM: arm64: Refactor sys_regs.h,c for nVHE reuse 2021-08-20 11:12:17 +01:00
trace_arm.h KVM: Move arm64's MMU notifier trace events to generic code 2021-04-17 08:30:56 -04:00
trace_handle_exit.h KVM: arm64: Upgrade trace_kvm_arm_set_dreg32() to 64bit 2021-08-20 11:12:18 +01:00
trace.h KVM: arm64: Move virt/kvm/arm to arch/arm64 2020-05-16 15:03:59 +01:00
trng.c KVM: arm64: Implement the TRNG hypervisor call 2021-01-25 22:19:31 +00:00
va_layout.c KVM: arm64: Generate final CTR_EL0 value when running in Protected mode 2021-03-25 11:00:33 +00:00
vgic-sys-reg-v3.c KVM: arm64: Drop is_aarch32 trap attribute 2020-11-10 11:22:52 +00:00
vmid.c KVM: arm64: Make active_vmids invalid on vCPU schedule out 2022-02-08 14:57:04 +00:00