diff options
author | Suzuki K Poulose <suzuki.poulose@arm.com> | 2020-07-01 15:20:02 +0100 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2020-07-03 12:56:57 +0100 |
commit | 351d931f496aeb2e97b8daa44c943d8b59351d07 (patch) | |
tree | 320c5c43943a8ac616f9262ebf187234c25ec7ec | |
parent | fd0a05bd27ddedb9e61f413bea147b1876d610b7 (diff) | |
download | kvmtool-351d931f496aeb2e97b8daa44c943d8b59351d07.tar.gz |
kvmtool: arm64: Report missing support for 32bit guests
When the host doesn't support 32bit guests, the kvmtool fails
without a proper message on what is wrong. i.e,
$ lkvm run -c 1 Image --aarch32
# lkvm run -k Image -m 256 -c 1 --name guest-105618
Fatal: Unable to initialise vcpu
Given that there is no other easy way to check if the host supports 32bit
guests, it is always good to report this by checking the capability, rather
than leaving the users to hunt this down by looking at the code!
After this patch:
$ lkvm run -c 1 Image --aarch32
# lkvm run -k Image -m 256 -c 1 --name guest-105695
Fatal: 32bit guests are not supported
Reported-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20200701142002.51654-1-suzuki.poulose@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
-rw-r--r-- | arm/kvm-cpu.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arm/kvm-cpu.c b/arm/kvm-cpu.c index 554414f8..2acecaec 100644 --- a/arm/kvm-cpu.c +++ b/arm/kvm-cpu.c @@ -46,6 +46,10 @@ struct kvm_cpu *kvm_cpu__arch_init(struct kvm *kvm, unsigned long cpu_id) .features = ARM_VCPU_FEATURE_FLAGS(kvm, cpu_id) }; + if (kvm->cfg.arch.aarch32_guest && + !kvm__supports_extension(kvm, KVM_CAP_ARM_EL1_32BIT)) + die("32bit guests are not supported\n"); + vcpu = calloc(1, sizeof(struct kvm_cpu)); if (!vcpu) return NULL; |