From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D048EC433E0 for ; Wed, 10 Mar 2021 11:16:13 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 0B88E64FE8 for ; Wed, 10 Mar 2021 11:16:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0B88E64FE8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 5404C4B39C; Wed, 10 Mar 2021 06:16:12 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id clqP4c1xVmRJ; Wed, 10 Mar 2021 06:16:11 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id F201D4B618; Wed, 10 Mar 2021 06:16:10 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id D49FE4B614 for ; Wed, 10 Mar 2021 06:16:09 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2Ivez0MEFBwo for ; Wed, 10 Mar 2021 06:16:08 -0500 (EST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id A50C04B60E for ; Wed, 10 Mar 2021 06:16:08 -0500 (EST) Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6FF4A64FCB; Wed, 10 Mar 2021 11:16:07 +0000 (UTC) Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1lJwov-000k4U-8H; Wed, 10 Mar 2021 11:16:05 +0000 MIME-Version: 1.0 Date: Wed, 10 Mar 2021 11:16:05 +0000 From: Marc Zyngier To: Auger Eric Subject: Re: [PATCH v2 1/2] KVM: arm64: Reject VM creation when the default IPA size is unsupported In-Reply-To: References: <20210310104208.3819061-1-maz@kernel.org> <20210310104208.3819061-2-maz@kernel.org> User-Agent: Roundcube Webmail/1.4.11 Message-ID: <8d5468231157016aaf301c2be3b4a12c@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: eric.auger@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, will@kernel.org, drjones@redhat.com, alexandru.elisei@arm.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: kernel-team@android.com, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Will Deacon , kvmarm@lists.cs.columbia.edu X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Hi Eric, On 2021-03-10 10:59, Auger Eric wrote: > Hi Marc, > > On 3/10/21 11:42 AM, Marc Zyngier wrote: >> KVM/arm64 has forever used a 40bit default IPA space, partially >> due to its 32bit heritage (where the only choice is 40bit). >> >> However, there are implementations in the wild that have a *cough* >> much smaller *cough* IPA space, which leads to a misprogramming of >> VTCR_EL2, and a guest that is stuck on its first memory access >> if userspace dares to ask for the default IPA setting (which most >> VMMs do). >> >> Instead, blundly reject the creation of such VM, as we can't >> satisfy the requirements from userspace (with a one-off warning). >> Also clarify the boot warning, and document that the VM creation >> will fail when an unsupported IPA size is probided. >> >> Although this is an ABI change, it doesn't really change much >> for userspace: >> >> - the guest couldn't run before this change, but no error was >> returned. At least userspace knows what is happening. >> >> - a memory slot that was accepted because it did fit the default >> IPA space now doesn't even get a chance to be registered. >> >> The other thing that is left doing is to convince userspace to >> actually use the IPA space setting instead of relying on the >> antiquated default. >> >> Signed-off-by: Marc Zyngier >> --- >> Documentation/virt/kvm/api.rst | 3 +++ >> arch/arm64/kvm/reset.c | 12 ++++++++---- >> 2 files changed, 11 insertions(+), 4 deletions(-) >> >> diff --git a/Documentation/virt/kvm/api.rst >> b/Documentation/virt/kvm/api.rst >> index 1a2b5210cdbf..38e327d4b479 100644 >> --- a/Documentation/virt/kvm/api.rst >> +++ b/Documentation/virt/kvm/api.rst >> @@ -182,6 +182,9 @@ is dependent on the CPU capability and the kernel >> configuration. The limit can >> be retrieved using KVM_CAP_ARM_VM_IPA_SIZE of the KVM_CHECK_EXTENSION >> ioctl() at run-time. >> >> +Creation of the VM will fail if the requested IPA size (whether it is >> +implicit or explicit) is unsupported on the host. >> + >> Please note that configuring the IPA size does not affect the >> capability >> exposed by the guest CPUs in ID_AA64MMFR0_EL1[PARange]. It only >> affects >> size of the address translated by the stage2 level (guest physical to >> diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c >> index 47f3f035f3ea..f1a38405934e 100644 >> --- a/arch/arm64/kvm/reset.c >> +++ b/arch/arm64/kvm/reset.c >> @@ -324,10 +324,9 @@ int kvm_set_ipa_limit(void) >> } >> >> kvm_ipa_limit = id_aa64mmfr0_parange_to_phys_shift(parange); >> - WARN(kvm_ipa_limit < KVM_PHYS_SHIFT, >> - "KVM IPA Size Limit (%d bits) is smaller than default size\n", >> - kvm_ipa_limit); >> - kvm_info("IPA Size Limit: %d bits\n", kvm_ipa_limit); >> + kvm_info("IPA Size Limit: %d bits%s\n", kvm_ipa_limit, >> + ((kvm_ipa_limit < KVM_PHYS_SHIFT) ? >> + " (Reduced IPA size, limited VM/VMM compatibility)" : "")); >> >> return 0; >> } >> @@ -356,6 +355,11 @@ int kvm_arm_setup_stage2(struct kvm *kvm, >> unsigned long type) >> return -EINVAL; >> } else { >> phys_shift = KVM_PHYS_SHIFT; >> + if (phys_shift > kvm_ipa_limit) { >> + pr_warn_once("%s using unsupported default IPA limit, upgrade your >> VMM\n", >> + current->comm, kvm_ipa_limit); > don't you have a trouble with the args here? > > Otherwise looks sensible to me. This is what happens when you do a last minute change and push it out without thinking. My apologies, I'll fix that. M. -- Jazz is not dead. It just smells funny... _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B86BC433E0 for ; Wed, 10 Mar 2021 11:17:58 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8894364FE5 for ; Wed, 10 Mar 2021 11:17:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8894364FE5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:Cc:To:From :Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OlV/LWIPL6VoEyCM+lOlzwaiKb36OUbWqEI8l/6IhNE=; b=YLdwq9MoMG3F46U7R9RTCH6fZ vuEkzBXaDsuCITkCQR1srGELlQJ9uf9NZYE3TvCqms0W9ZnqmiUYry8fkcQm1p1uwZixiAVygOX+m mmVz+a++J/r6MBcIA+kHaYkHvZYXSPZyUJoLZqS+UvaGJzIZYx/7dA30i3PquNTyYEdXqcI6nUrav zVQOnbFei8cjbfCAN8yO24hJDFBTWLpv3u0Zk213GdOC99odlFP44FxRalSWkWmIIy7CE0PIOcPzj Vl2WdtxHPDbK1TVzgC6kClXgmwZf2Tzr9b+DAoxAct691lwAiez6byXlRaDFKDSg31PGI2dvUWB8m zrauX+8Gg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lJwp3-006hN1-Gh; Wed, 10 Mar 2021 11:16:13 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lJwoz-006hMY-0Q for linux-arm-kernel@lists.infradead.org; Wed, 10 Mar 2021 11:16:11 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6FF4A64FCB; Wed, 10 Mar 2021 11:16:07 +0000 (UTC) Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1lJwov-000k4U-8H; Wed, 10 Mar 2021 11:16:05 +0000 MIME-Version: 1.0 Date: Wed, 10 Mar 2021 11:16:05 +0000 From: Marc Zyngier To: Auger Eric Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, James Morse , Julien Thierry , Suzuki K Poulose , Will Deacon , Andrew Jones , Alexandru Elisei , kernel-team@android.com Subject: Re: [PATCH v2 1/2] KVM: arm64: Reject VM creation when the default IPA size is unsupported In-Reply-To: References: <20210310104208.3819061-1-maz@kernel.org> <20210310104208.3819061-2-maz@kernel.org> User-Agent: Roundcube Webmail/1.4.11 Message-ID: <8d5468231157016aaf301c2be3b4a12c@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: eric.auger@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, will@kernel.org, drjones@redhat.com, alexandru.elisei@arm.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210310_111609_472697_B1235A68 X-CRM114-Status: GOOD ( 27.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Eric, On 2021-03-10 10:59, Auger Eric wrote: > Hi Marc, > > On 3/10/21 11:42 AM, Marc Zyngier wrote: >> KVM/arm64 has forever used a 40bit default IPA space, partially >> due to its 32bit heritage (where the only choice is 40bit). >> >> However, there are implementations in the wild that have a *cough* >> much smaller *cough* IPA space, which leads to a misprogramming of >> VTCR_EL2, and a guest that is stuck on its first memory access >> if userspace dares to ask for the default IPA setting (which most >> VMMs do). >> >> Instead, blundly reject the creation of such VM, as we can't >> satisfy the requirements from userspace (with a one-off warning). >> Also clarify the boot warning, and document that the VM creation >> will fail when an unsupported IPA size is probided. >> >> Although this is an ABI change, it doesn't really change much >> for userspace: >> >> - the guest couldn't run before this change, but no error was >> returned. At least userspace knows what is happening. >> >> - a memory slot that was accepted because it did fit the default >> IPA space now doesn't even get a chance to be registered. >> >> The other thing that is left doing is to convince userspace to >> actually use the IPA space setting instead of relying on the >> antiquated default. >> >> Signed-off-by: Marc Zyngier >> --- >> Documentation/virt/kvm/api.rst | 3 +++ >> arch/arm64/kvm/reset.c | 12 ++++++++---- >> 2 files changed, 11 insertions(+), 4 deletions(-) >> >> diff --git a/Documentation/virt/kvm/api.rst >> b/Documentation/virt/kvm/api.rst >> index 1a2b5210cdbf..38e327d4b479 100644 >> --- a/Documentation/virt/kvm/api.rst >> +++ b/Documentation/virt/kvm/api.rst >> @@ -182,6 +182,9 @@ is dependent on the CPU capability and the kernel >> configuration. The limit can >> be retrieved using KVM_CAP_ARM_VM_IPA_SIZE of the KVM_CHECK_EXTENSION >> ioctl() at run-time. >> >> +Creation of the VM will fail if the requested IPA size (whether it is >> +implicit or explicit) is unsupported on the host. >> + >> Please note that configuring the IPA size does not affect the >> capability >> exposed by the guest CPUs in ID_AA64MMFR0_EL1[PARange]. It only >> affects >> size of the address translated by the stage2 level (guest physical to >> diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c >> index 47f3f035f3ea..f1a38405934e 100644 >> --- a/arch/arm64/kvm/reset.c >> +++ b/arch/arm64/kvm/reset.c >> @@ -324,10 +324,9 @@ int kvm_set_ipa_limit(void) >> } >> >> kvm_ipa_limit = id_aa64mmfr0_parange_to_phys_shift(parange); >> - WARN(kvm_ipa_limit < KVM_PHYS_SHIFT, >> - "KVM IPA Size Limit (%d bits) is smaller than default size\n", >> - kvm_ipa_limit); >> - kvm_info("IPA Size Limit: %d bits\n", kvm_ipa_limit); >> + kvm_info("IPA Size Limit: %d bits%s\n", kvm_ipa_limit, >> + ((kvm_ipa_limit < KVM_PHYS_SHIFT) ? >> + " (Reduced IPA size, limited VM/VMM compatibility)" : "")); >> >> return 0; >> } >> @@ -356,6 +355,11 @@ int kvm_arm_setup_stage2(struct kvm *kvm, >> unsigned long type) >> return -EINVAL; >> } else { >> phys_shift = KVM_PHYS_SHIFT; >> + if (phys_shift > kvm_ipa_limit) { >> + pr_warn_once("%s using unsupported default IPA limit, upgrade your >> VMM\n", >> + current->comm, kvm_ipa_limit); > don't you have a trouble with the args here? > > Otherwise looks sensible to me. This is what happens when you do a last minute change and push it out without thinking. My apologies, I'll fix that. M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20CE2C433E0 for ; Wed, 10 Mar 2021 11:16:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CCCBC64FEE for ; Wed, 10 Mar 2021 11:16:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231197AbhCJLQV (ORCPT ); Wed, 10 Mar 2021 06:16:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:50128 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230319AbhCJLQH (ORCPT ); Wed, 10 Mar 2021 06:16:07 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6FF4A64FCB; Wed, 10 Mar 2021 11:16:07 +0000 (UTC) Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1lJwov-000k4U-8H; Wed, 10 Mar 2021 11:16:05 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 10 Mar 2021 11:16:05 +0000 From: Marc Zyngier To: Auger Eric Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, James Morse , Julien Thierry , Suzuki K Poulose , Will Deacon , Andrew Jones , Alexandru Elisei , kernel-team@android.com Subject: Re: [PATCH v2 1/2] KVM: arm64: Reject VM creation when the default IPA size is unsupported In-Reply-To: References: <20210310104208.3819061-1-maz@kernel.org> <20210310104208.3819061-2-maz@kernel.org> User-Agent: Roundcube Webmail/1.4.11 Message-ID: <8d5468231157016aaf301c2be3b4a12c@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: eric.auger@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, will@kernel.org, drjones@redhat.com, alexandru.elisei@arm.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi Eric, On 2021-03-10 10:59, Auger Eric wrote: > Hi Marc, > > On 3/10/21 11:42 AM, Marc Zyngier wrote: >> KVM/arm64 has forever used a 40bit default IPA space, partially >> due to its 32bit heritage (where the only choice is 40bit). >> >> However, there are implementations in the wild that have a *cough* >> much smaller *cough* IPA space, which leads to a misprogramming of >> VTCR_EL2, and a guest that is stuck on its first memory access >> if userspace dares to ask for the default IPA setting (which most >> VMMs do). >> >> Instead, blundly reject the creation of such VM, as we can't >> satisfy the requirements from userspace (with a one-off warning). >> Also clarify the boot warning, and document that the VM creation >> will fail when an unsupported IPA size is probided. >> >> Although this is an ABI change, it doesn't really change much >> for userspace: >> >> - the guest couldn't run before this change, but no error was >> returned. At least userspace knows what is happening. >> >> - a memory slot that was accepted because it did fit the default >> IPA space now doesn't even get a chance to be registered. >> >> The other thing that is left doing is to convince userspace to >> actually use the IPA space setting instead of relying on the >> antiquated default. >> >> Signed-off-by: Marc Zyngier >> --- >> Documentation/virt/kvm/api.rst | 3 +++ >> arch/arm64/kvm/reset.c | 12 ++++++++---- >> 2 files changed, 11 insertions(+), 4 deletions(-) >> >> diff --git a/Documentation/virt/kvm/api.rst >> b/Documentation/virt/kvm/api.rst >> index 1a2b5210cdbf..38e327d4b479 100644 >> --- a/Documentation/virt/kvm/api.rst >> +++ b/Documentation/virt/kvm/api.rst >> @@ -182,6 +182,9 @@ is dependent on the CPU capability and the kernel >> configuration. The limit can >> be retrieved using KVM_CAP_ARM_VM_IPA_SIZE of the KVM_CHECK_EXTENSION >> ioctl() at run-time. >> >> +Creation of the VM will fail if the requested IPA size (whether it is >> +implicit or explicit) is unsupported on the host. >> + >> Please note that configuring the IPA size does not affect the >> capability >> exposed by the guest CPUs in ID_AA64MMFR0_EL1[PARange]. It only >> affects >> size of the address translated by the stage2 level (guest physical to >> diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c >> index 47f3f035f3ea..f1a38405934e 100644 >> --- a/arch/arm64/kvm/reset.c >> +++ b/arch/arm64/kvm/reset.c >> @@ -324,10 +324,9 @@ int kvm_set_ipa_limit(void) >> } >> >> kvm_ipa_limit = id_aa64mmfr0_parange_to_phys_shift(parange); >> - WARN(kvm_ipa_limit < KVM_PHYS_SHIFT, >> - "KVM IPA Size Limit (%d bits) is smaller than default size\n", >> - kvm_ipa_limit); >> - kvm_info("IPA Size Limit: %d bits\n", kvm_ipa_limit); >> + kvm_info("IPA Size Limit: %d bits%s\n", kvm_ipa_limit, >> + ((kvm_ipa_limit < KVM_PHYS_SHIFT) ? >> + " (Reduced IPA size, limited VM/VMM compatibility)" : "")); >> >> return 0; >> } >> @@ -356,6 +355,11 @@ int kvm_arm_setup_stage2(struct kvm *kvm, >> unsigned long type) >> return -EINVAL; >> } else { >> phys_shift = KVM_PHYS_SHIFT; >> + if (phys_shift > kvm_ipa_limit) { >> + pr_warn_once("%s using unsupported default IPA limit, upgrade your >> VMM\n", >> + current->comm, kvm_ipa_limit); > don't you have a trouble with the args here? > > Otherwise looks sensible to me. This is what happens when you do a last minute change and push it out without thinking. My apologies, I'll fix that. M. -- Jazz is not dead. It just smells funny...