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.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 03925C433E2 for ; Wed, 9 Sep 2020 14:53:45 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 77CE620768 for ; Wed, 9 Sep 2020 14:53:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="cWu7NikA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 77CE620768 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TPC/wqz+0hBOiNQXvARNWVvDS7acOZ6g+RtGyAOFO3E=; b=cWu7NikAScZlKbuPzJhQmeIrH hHnT2eDhXpu2y05aBeNP9IpE9/4yhAmICDuLSb5ttEX9dVuPLP0ghlezpqNqjLomraVrHjo4AXtxz 7bd+2LB1fNpip5jylr0Ce5LwabjQSSB0IRk0C3SEdEvj/NZ3fasPnixBsl2dVeN7iS86WYQVYEWNo /+N/jV4eRRxcryxc/MoI3Bx61mVxYRE0Ncy6hD84VylLqY/ptbNCDKAndM+cJyV78zNT6MlUCt8iE GQjvyjeqbTaZyZ6PGgA/Ym/coCY0mTn0Nl8D1ESOJ5v2lV8c4cP4b7bSTEd1f08k+4SqJevn+pocs 9pXaKZAZQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kG1ST-0006Ei-Tq; Wed, 09 Sep 2020 14:52:25 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kG1SR-0006EG-Ly for linux-arm-kernel@lists.infradead.org; Wed, 09 Sep 2020 14:52:24 +0000 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 71F3B101E; Wed, 9 Sep 2020 07:52:22 -0700 (PDT) Received: from [192.168.0.110] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 30CDF3F66E; Wed, 9 Sep 2020 07:52:21 -0700 (PDT) Subject: Re: [PATCH v4 21/21] KVM: arm64: Don't constrain maximum IPA size based on host configuration To: Will Deacon , kvmarm@lists.cs.columbia.edu References: <20200907152344.12978-1-will@kernel.org> <20200907152344.12978-22-will@kernel.org> From: Alexandru Elisei Message-ID: <05da664a-7abf-ce13-1201-61b86368933e@arm.com> Date: Wed, 9 Sep 2020 15:53:21 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20200907152344.12978-22-will@kernel.org> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200909_105223_818127_F8B79404 X-CRM114-Status: GOOD ( 22.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gavin Shan , Suzuki Poulose , Marc Zyngier , Quentin Perret , James Morse , Catalin Marinas , kernel-team@android.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Will, On 9/7/20 4:23 PM, Will Deacon wrote: > Now that the guest stage-2 page-tables are managed independently from > the host stage-1 page-tables, we can avoid constraining the IPA size > based on the host and instead limit it only based on the PARange field > of the ID_AA64MMFR0 register. > > Cc: Marc Zyngier > Cc: Quentin Perret > Reviewed-by: Gavin Shan > Signed-off-by: Will Deacon > --- > arch/arm64/kvm/reset.c | 38 +++++--------------------------------- > 1 file changed, 5 insertions(+), 33 deletions(-) > > diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c > index ee33875c5c2a..471ee9234e40 100644 > --- a/arch/arm64/kvm/reset.c > +++ b/arch/arm64/kvm/reset.c > @@ -339,7 +339,7 @@ u32 get_kvm_ipa_limit(void) > > int kvm_set_ipa_limit(void) > { > - unsigned int ipa_max, pa_max, va_max, parange, tgran_2; > + unsigned int parange, tgran_2; > u64 mmfr0; > > mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1); > @@ -376,38 +376,10 @@ int kvm_set_ipa_limit(void) > break; > } > > - pa_max = id_aa64mmfr0_parange_to_phys_shift(parange); > - > - /* Clamp the IPA limit to the PA size supported by the kernel */ > - ipa_max = (pa_max > PHYS_MASK_SHIFT) ? PHYS_MASK_SHIFT : pa_max; > - /* > - * Since our stage2 table is dependent on the stage1 page table code, > - * we must always honor the following condition: > - * > - * Number of levels in Stage1 >= Number of levels in Stage2. > - * > - * So clamp the ipa limit further down to limit the number of levels. > - * Since we can concatenate upto 16 tables at entry level, we could > - * go upto 4bits above the maximum VA addressable with the current > - * number of levels. > - */ > - va_max = PGDIR_SHIFT + PAGE_SHIFT - 3; > - va_max += 4; > - > - if (va_max < ipa_max) > - ipa_max = va_max; > - > - /* > - * If the final limit is lower than the real physical address > - * limit of the CPUs, report the reason. > - */ > - if (ipa_max < pa_max) > - pr_info("kvm: Limiting the IPA size due to kernel %s Address limit\n", > - (va_max < pa_max) ? "Virtual" : "Physical"); > - > - WARN(ipa_max < KVM_PHYS_SHIFT, > - "KVM IPA limit (%d bit) is smaller than default size\n", ipa_max); > - kvm_ipa_limit = ipa_max; > + kvm_ipa_limit = id_aa64mmfr0_parange_to_phys_shift(parange); > + WARN(kvm_ipa_limit < KVM_PHYS_SHIFT, > + "KVM IPA limit (%d bit) is smaller than default size\n", > + kvm_ipa_limit); > kvm_info("IPA Size Limit: %dbits\n", kvm_ipa_limit); Bikeshedding: the two messages are slightly inconsistent: "IPA limit" vs "IPA Size Limit" and "%d bit" vs "%dbits. Might be worth using the exact wording to make it painfully obvious that the messages refer to the same variable, kvm_ipa_limit. Thanks, Alex _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel