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 7A936C27C79 for ; Wed, 19 Jun 2024 16:45:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=io5bXnZ0+4cO+Yj2eKHI97URzu4xpO8672wXKNO54BU=; b=LurVy1GoHMAJOHw4K9zWILLm/i XTcMfdatrCk3HBUARRrurGLOP56tdUcNnKWyx+IWW0Rvm+M0CPsHZpOH8TG6YiPcb3SQBT7xhJALn pNSGSPO4DiTX8ROgNiuk9myy6RHnJd2NVGEa0rzvsE+Y+kXHTnG5HP1N0xTIEx6DxPmcHDqYUmL+U 6FIYkNQedrsinjwX28ejucdkb/WWc5ZcYZRBa4Ak8izByDqgC01dPW8kh9vR37LyEFbxzluyy1ziM SiZuYp/9ysc9U/12qnzq2ykhoWR0+yw0jhuPolTYK9Ef2CBYuUpC+sws5LWvwmpZhiDkw4tlZyUIN z4P7oBHA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJyRN-000000026va-11wp; Wed, 19 Jun 2024 16:45:45 +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 1sJyRG-000000026sU-3k9Z for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2024 16:45:42 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 4E2BF61EAE; Wed, 19 Jun 2024 16:45:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47094C2BBFC; Wed, 19 Jun 2024 16:45:32 +0000 (UTC) Date: Wed, 19 Jun 2024 17:45:29 +0100 From: Catalin Marinas To: Amit Daniel Kachhap Cc: Joey Gouly , linux-arm-kernel@lists.infradead.org, akpm@linux-foundation.org, aneesh.kumar@kernel.org, aneesh.kumar@linux.ibm.com, bp@alien8.de, broonie@kernel.org, christophe.leroy@csgroup.eu, dave.hansen@linux.intel.com, hpa@zytor.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, maz@kernel.org, mingo@redhat.com, mpe@ellerman.id.au, naveen.n.rao@linux.ibm.com, npiggin@gmail.com, oliver.upton@linux.dev, shuah@kernel.org, szabolcs.nagy@arm.com, tglx@linutronix.de, will@kernel.org, x86@kernel.org, kvmarm@lists.linux.dev Subject: Re: [PATCH v4 13/29] arm64: convert protection key into vm_flags and pgprot values Message-ID: References: <20240503130147.1154804-1-joey.gouly@arm.com> <20240503130147.1154804-14-joey.gouly@arm.com> <4f7d8691-fe19-4e8a-95e5-9f7680c82021@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4f7d8691-fe19-4e8a-95e5-9f7680c82021@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_094541_377616_63103BEB X-CRM114-Status: GOOD ( 13.31 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, May 28, 2024 at 12:24:57PM +0530, Amit Daniel Kachhap wrote: > On 5/3/24 18:31, Joey Gouly wrote: > > diff --git a/arch/arm64/include/asm/mman.h b/arch/arm64/include/asm/mman.h > > index 5966ee4a6154..ecb2d18dc4d7 100644 > > --- a/arch/arm64/include/asm/mman.h > > +++ b/arch/arm64/include/asm/mman.h > > @@ -7,7 +7,7 @@ > > #include > > static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot, > > - unsigned long pkey __always_unused) > > + unsigned long pkey) > > { > > unsigned long ret = 0; > > @@ -17,6 +17,12 @@ static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot, > > if (system_supports_mte() && (prot & PROT_MTE)) > > ret |= VM_MTE; > > +#if defined(CONFIG_ARCH_HAS_PKEYS) > > Should there be system_supports_poe() check like above? I think it should, otherwise we end up with these bits in the pte even when POE is not supported. > > + ret |= pkey & 0x1 ? VM_PKEY_BIT0 : 0; > > + ret |= pkey & 0x2 ? VM_PKEY_BIT1 : 0; > > + ret |= pkey & 0x4 ? VM_PKEY_BIT2 : 0; > > +#endif > > + > > return ret; > > } > > #define arch_calc_vm_prot_bits(prot, pkey) arch_calc_vm_prot_bits(prot, pkey) -- Catalin