diff options
author | Reiji Watanabe <reijiw@google.com> | 2022-03-28 20:19:23 -0700 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2022-04-06 12:29:45 +0100 |
commit | 26bf74bd9f6ff0f1545b4f0c92a37c232d076014 (patch) | |
tree | 759d1aa56c57f78817cca50264eb2ddd015dc941 /tools/testing/selftests/kvm/Makefile | |
parent | c707663e81ef48d279719e97fd86acef835a2671 (diff) | |
download | linux-26bf74bd9f6ff0f1545b4f0c92a37c232d076014.tar.bz2 |
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: 66e94d5cafd4 ("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
Diffstat (limited to 'tools/testing/selftests/kvm/Makefile')
0 files changed, 0 insertions, 0 deletions