From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BA2C208A1; Mon, 13 May 2024 16:38:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715618339; cv=none; b=R0H7c09MH9nzalO4YXvQdpsnk0YwSJJ05zZxK3sWanS82DMNNnpdyzFvbLfZJRZGkYL7WCYzzjWFe3RAoCGujq/Y3t5Dd+o84CNVoH32CzF+3zJnGr/zJF/4SOp9hvwi/7ZGxmUDkg0L1sYKkXCP/GwFGE7BgXJV0WtWNfx1Zao= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715618339; c=relaxed/simple; bh=fhiBDdzgfG8w+pcwYov50xsdrVpjMez9OR8PkWTcBTM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LuoaaTXMH+synXiWwM+oPiOq4coGdBvbAsk3sQA/XothX+1Sf2hqde7ez5Sr2/NZLdDLs8kZhE1X0sWMOXYZ13fzSQnye8V/ZAdD25TaOuI9SDQLQ+YHWNQAqGkHOZaFu7AaHZiCnuOxwoXvlIJoWckNFWfosk89oWLxaBpYvGc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E331C113CC; Mon, 13 May 2024 16:38:56 +0000 (UTC) Date: Mon, 13 May 2024 17:38:53 +0100 From: Catalin Marinas To: Steven Price Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev, Marc Zyngier , Will Deacon , James Morse , Oliver Upton , Suzuki K Poulose , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joey Gouly , Alexandru Elisei , Christoffer Dall , Fuad Tabba , linux-coco@lists.linux.dev, Ganapatrao Kulkarni Subject: Re: [PATCH v2 07/14] arm64: Make the PHYS_MASK_SHIFT dynamic Message-ID: References: <20240412084213.1733764-1-steven.price@arm.com> <20240412084213.1733764-8-steven.price@arm.com> Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240412084213.1733764-8-steven.price@arm.com> On Fri, Apr 12, 2024 at 09:42:06AM +0100, Steven Price wrote: > diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h > index e01bb5ca13b7..9944aca348bd 100644 > --- a/arch/arm64/include/asm/kvm_arm.h > +++ b/arch/arm64/include/asm/kvm_arm.h > @@ -398,7 +398,7 @@ > * bits in PAR are res0. > */ > #define PAR_TO_HPFAR(par) \ > - (((par) & GENMASK_ULL(52 - 1, 12)) >> 8) > + (((par) & GENMASK_ULL(MAX_PHYS_MASK_SHIFT - 1, 12)) >> 8) Why does this need to be changed? It's still a constant not dependent on the new dynamic IPA size. > diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h > index ef207a0d4f0d..90dc292bed5f 100644 > --- a/arch/arm64/include/asm/pgtable-hwdef.h > +++ b/arch/arm64/include/asm/pgtable-hwdef.h > @@ -206,8 +206,8 @@ > /* > * Highest possible physical address supported. > */ > -#define PHYS_MASK_SHIFT (CONFIG_ARM64_PA_BITS) > -#define PHYS_MASK ((UL(1) << PHYS_MASK_SHIFT) - 1) > +#define MAX_PHYS_MASK_SHIFT (CONFIG_ARM64_PA_BITS) > +#define MAX_PHYS_MASK ((UL(1) << PHYS_MASK_SHIFT) - 1) I prefer to have MAX as suffix in those definitions, it matches other places like TASK_SIZE_MAX, PHYS_ADDR_MAX (I know PHYS_MASK_MAX doesn't roll off the tongue easily but very few people tend to read the kernel aloud ;)). -- Catalin 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id DDAF0C25B74 for ; Mon, 13 May 2024 16:39:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hWdO3u49J5IEsEHkDWk+pRrV/3VzytyLxXwlWbEXYCI=; b=FMBO8MqVxdIhL5 0vqKIxvYU3LrmTuOj3okUIwLi8UyLGr4DvhQYndTT5ABtaY5QWnMUbDEem08M3CybC541sSEDHWFK SwlSX8tlkBIO/CztbogQwtLg1tVKKHkcyFEz95EuvVPQlHhw/t7KZxZ7NI+Fy47pNUvycYBUDHRd1 vj14TFtjrTyK0Qhlq6LcmJVI0dJ2xoSQjvwwHOT+tDXAe+1tm143rBp2bh/noDfSSEqUxDtcwxnnk 1HUFYIL+sMgQxeb0JcYnvDnpYdSYvDlhAZ8onb86shDRKaPsWXsMqoWt39jgoCbDA/EbjanCjpq6+ 7UqCwsMCYMyj9l84OTEw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s6Yhb-0000000DZvD-0FNW; Mon, 13 May 2024 16:39:03 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s6YhY-0000000DZu6-39wr for linux-arm-kernel@lists.infradead.org; Mon, 13 May 2024 16:39:02 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id BE62460EC2; Mon, 13 May 2024 16:38:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E331C113CC; Mon, 13 May 2024 16:38:56 +0000 (UTC) Date: Mon, 13 May 2024 17:38:53 +0100 From: Catalin Marinas To: Steven Price Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev, Marc Zyngier , Will Deacon , James Morse , Oliver Upton , Suzuki K Poulose , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joey Gouly , Alexandru Elisei , Christoffer Dall , Fuad Tabba , linux-coco@lists.linux.dev, Ganapatrao Kulkarni Subject: Re: [PATCH v2 07/14] arm64: Make the PHYS_MASK_SHIFT dynamic Message-ID: References: <20240412084213.1733764-1-steven.price@arm.com> <20240412084213.1733764-8-steven.price@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240412084213.1733764-8-steven.price@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240513_093900_854986_898ABED1 X-CRM114-Status: GOOD ( 12.21 ) 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-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 On Fri, Apr 12, 2024 at 09:42:06AM +0100, Steven Price wrote: > diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h > index e01bb5ca13b7..9944aca348bd 100644 > --- a/arch/arm64/include/asm/kvm_arm.h > +++ b/arch/arm64/include/asm/kvm_arm.h > @@ -398,7 +398,7 @@ > * bits in PAR are res0. > */ > #define PAR_TO_HPFAR(par) \ > - (((par) & GENMASK_ULL(52 - 1, 12)) >> 8) > + (((par) & GENMASK_ULL(MAX_PHYS_MASK_SHIFT - 1, 12)) >> 8) Why does this need to be changed? It's still a constant not dependent on the new dynamic IPA size. > diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h > index ef207a0d4f0d..90dc292bed5f 100644 > --- a/arch/arm64/include/asm/pgtable-hwdef.h > +++ b/arch/arm64/include/asm/pgtable-hwdef.h > @@ -206,8 +206,8 @@ > /* > * Highest possible physical address supported. > */ > -#define PHYS_MASK_SHIFT (CONFIG_ARM64_PA_BITS) > -#define PHYS_MASK ((UL(1) << PHYS_MASK_SHIFT) - 1) > +#define MAX_PHYS_MASK_SHIFT (CONFIG_ARM64_PA_BITS) > +#define MAX_PHYS_MASK ((UL(1) << PHYS_MASK_SHIFT) - 1) I prefer to have MAX as suffix in those definitions, it matches other places like TASK_SIZE_MAX, PHYS_ADDR_MAX (I know PHYS_MASK_MAX doesn't roll off the tongue easily but very few people tend to read the kernel aloud ;)). -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel