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=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 01607C4338F for ; Wed, 11 Aug 2021 09:36:53 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 702E860F22 for ; Wed, 11 Aug 2021 09:36:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 702E860F22 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id F0D19405D8; Wed, 11 Aug 2021 05:36:51 -0400 (EDT) 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 8+Xt0F13W2Nq; Wed, 11 Aug 2021 05:36:47 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 9287E49F83; Wed, 11 Aug 2021 05:36:47 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id CCD4449E5F for ; Wed, 11 Aug 2021 05:36:45 -0400 (EDT) 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 28LpWDc1AJ4z for ; Wed, 11 Aug 2021 05:36:41 -0400 (EDT) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 56E28405D8 for ; Wed, 11 Aug 2021 05:36:41 -0400 (EDT) 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 43B8E60F11; Wed, 11 Aug 2021 09:36:40 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mDkf8-004HVI-5u; Wed, 11 Aug 2021 10:36:38 +0100 Date: Wed, 11 Aug 2021 10:36:37 +0100 Message-ID: <87v94c9vbu.wl-maz@kernel.org> From: Marc Zyngier To: Anshuman Khandual Subject: Re: [PATCH] KVM: arm64: Restrict IPA size to maximum 48 bits on 4K and 16K page size In-Reply-To: <1628657549-27584-1-git-send-email-anshuman.khandual@arm.com> References: <1628657549-27584-1-git-send-email-anshuman.khandual@arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: anshuman.khandual@arm.com, linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: Will Deacon , Catalin Marinas , linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Wed, 11 Aug 2021 05:52:29 +0100, Anshuman Khandual wrote: > > Even though ID_AA64MMFR0.PARANGE reports 52 bit PA size support, it cannot > be enabled as guest IPA size on 4K or 16K page size configurations. Hence > kvm_ipa_limit must be restricted to 48 bits. This change achieves required > IPA capping. > > Before the commit c9b69a0cf0b4 ("KVM: arm64: Don't constrain maximum IPA > size based on host configuration"), the problem here would have been just > latent via PHYS_MASK_SHIFT (which earlier in turn capped kvm_ipa_limit), > which remains capped at 48 bits on 4K and 16K configs. > > Cc: Marc Zyngier > Cc: James Morse > Cc: Alexandru Elisei > Cc: Suzuki K Poulose > Cc: Catalin Marinas > Cc: Will Deacon > Cc: linux-arm-kernel@lists.infradead.org > Cc: kvmarm@lists.cs.columbia.edu > Cc: linux-kernel@vger.kernel.org > Fixes: c9b69a0cf0b4 ("KVM: arm64: Don't constrain maximum IPA size based on host configuration") > Signed-off-by: Anshuman Khandual > --- > This applies on v5.14-rc5 > > arch/arm64/kvm/reset.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c > index 20588220fe66..e66974c4b9d3 100644 > --- a/arch/arm64/kvm/reset.c > +++ b/arch/arm64/kvm/reset.c > @@ -337,6 +337,15 @@ int kvm_set_ipa_limit(void) > return -EINVAL; > } > > + /* > + * IPA size beyond 48 bits could not be supported > + * on either 4K or 16K page size. Hence let's cap > + * it to 48 bits, in case it's reported as larger > + * on the system. > + */ > + if (!IS_ENABLED(CONFIG_ARM64_64K_PAGES)) As per our earlier discussion, please use (PAGE_SIZE != SZ_64K) instead. This is in keeping with the rest of the file. > + parange = min(parange, (unsigned int)ID_AA64MMFR0_PARANGE_48); > + Also, please move it next to the point where we assign parange. > kvm_ipa_limit = id_aa64mmfr0_parange_to_phys_shift(parange); > kvm_info("IPA Size Limit: %d bits%s\n", kvm_ipa_limit, > ((kvm_ipa_limit < KVM_PHYS_SHIFT) ? Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm