From patchwork Wed Jul 1 14:20:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 11636563 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3994D13BD for ; Wed, 1 Jul 2020 14:20:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 21690207F9 for ; Wed, 1 Jul 2020 14:20:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731622AbgGAOU1 (ORCPT ); Wed, 1 Jul 2020 10:20:27 -0400 Received: from foss.arm.com ([217.140.110.172]:44966 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731324AbgGAOU0 (ORCPT ); Wed, 1 Jul 2020 10:20:26 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 60C5E30E; Wed, 1 Jul 2020 07:20:26 -0700 (PDT) Received: from ewhatever.cambridge.arm.com (ewhatever.cambridge.arm.com [10.1.197.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2242C3F73C; Wed, 1 Jul 2020 07:20:24 -0700 (PDT) From: Suzuki K Poulose To: kvm@vger.kernel.org Cc: kvmarm@lists.cs.columbia.edu, andre.przywara@arm.com, linux-arm-kernel@lists.infradead.org, Suzuki K Poulose , Will Deacon , Sami Mujawar Subject: [PATCH] kvmtool: arm64: Report missing support for 32bit guests Date: Wed, 1 Jul 2020 15:20:02 +0100 Message-Id: <20200701142002.51654-1-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 Cc: Will Deacon Reported-by: Sami Mujawar Signed-off-by: Suzuki K Poulose Acked-by: Marc Zyngier --- arm/kvm-cpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arm/kvm-cpu.c b/arm/kvm-cpu.c index 554414f..2acecae 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;