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.7 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 F4206C4338F for ; Tue, 10 Aug 2021 13:32:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 AC38160F41 for ; Tue, 10 Aug 2021 13:32:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AC38160F41 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=R/dHXc7EZsedzDk7abjtQkRYgXlcDn6dxpMI3Q8Qk9Q=; b=EAXPZ5o7vj98w4cRm9DUjoVBVW HjwIW5zSG2rOb/KDq1IHEj9MDOt0Kf95/Z5H7RJ5yuYs17+ttQ8y8C4HFZCi2QeYXkPmKGNl+FT5Y nOb06d/ZO57pMK7WA4fOPEkvvxDGp8PiGsUOm9X01PvNhsckhZJG3K+4CresZLR9X2RE8Bd8RJcQ6 oOUwWQyDGbiErYb8/FpLCG9uKPfHWqQjW8oqSl4HroiYjf32Kk0ohb5dYqQtcyXpr/FfdYOI6G2Ac /Jw3PFHnvYDOWLK2hNrJA/4puji/cuSnbCMZ9Mw4t+RwwngyxcOo17+7p363jILFH7s3sPSUu+B2J 23YtpJ1A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDRom-003yFE-SC; Tue, 10 Aug 2021 13:29:21 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDRoj-003yES-EA for linux-arm-kernel@lists.infradead.org; Tue, 10 Aug 2021 13:29:18 +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 C49FD60F25; Tue, 10 Aug 2021 13:29:16 +0000 (UTC) Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) 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 1mDRog-00448e-Ro; Tue, 10 Aug 2021 14:29:15 +0100 MIME-Version: 1.0 Date: Tue, 10 Aug 2021 14:29:14 +0100 From: Marc Zyngier To: Anshuman Khandual Cc: linux-arm-kernel@lists.infradead.org, James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Will Deacon , kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org Subject: Re: [PATCH 5/5] KVM: arm64: Define KVM_PHYS_SHIFT_MIN In-Reply-To: <1628578961-29097-6-git-send-email-anshuman.khandual@arm.com> References: <1628578961-29097-1-git-send-email-anshuman.khandual@arm.com> <1628578961-29097-6-git-send-email-anshuman.khandual@arm.com> User-Agent: Roundcube Webmail/1.4.11 Message-ID: <2dbeb2c329cfeb1ee9a7331683cdbc97@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: anshuman.khandual@arm.com, linux-arm-kernel@lists.infradead.org, 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210810_062917_566267_DFF83EFD X-CRM114-Status: GOOD ( 19.90 ) 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 On 2021-08-10 08:02, Anshuman Khandual wrote: > Drop the hard coded value for the minimum IPA range i.e 32 bit. Instead > define a macro KVM_PHYS_SHIFT_MIN which improves the code readability. > > 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 > Signed-off-by: Anshuman Khandual > --- > arch/arm64/include/asm/kvm_mmu.h | 3 ++- > arch/arm64/kvm/reset.c | 2 +- > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/include/asm/kvm_mmu.h > b/arch/arm64/include/asm/kvm_mmu.h > index b52c5c4b9a3d..716f999818d9 100644 > --- a/arch/arm64/include/asm/kvm_mmu.h > +++ b/arch/arm64/include/asm/kvm_mmu.h > @@ -141,7 +141,8 @@ static __always_inline unsigned long > __kern_hyp_va(unsigned long v) > * We currently support using a VM-specified IPA size. For backward > * compatibility, the default IPA size is fixed to 40bits. > */ > -#define KVM_PHYS_SHIFT (40) > +#define KVM_PHYS_SHIFT (40) > +#define KVM_PHYS_SHIFT_MIN (32) > > #define kvm_phys_shift(kvm) VTCR_EL2_IPA(kvm->arch.vtcr) > #define kvm_phys_size(kvm) (_AC(1, ULL) << kvm_phys_shift(kvm)) > diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c > index cba7872d69a8..8dc8b4b9de37 100644 > --- a/arch/arm64/kvm/reset.c > +++ b/arch/arm64/kvm/reset.c > @@ -369,7 +369,7 @@ int kvm_arm_setup_stage2(struct kvm *kvm, unsigned > long type) > phys_shift = KVM_VM_TYPE_ARM_IPA_SIZE(type); > if (phys_shift) { > if (phys_shift > kvm_ipa_limit || > - phys_shift < 32) > + phys_shift < KVM_PHYS_SHIFT_MIN) > return -EINVAL; > } else { > phys_shift = KVM_PHYS_SHIFT; This is not a KVM property, but an architectural one. If you want to replace it with something more readable, please make it global to the whole of arm64 (ARM64_MIN_PARANGE?). Thanks, 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