From patchwork Thu Aug 22 15:10:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 13773685 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD3CBC3DA4A for ; Thu, 22 Aug 2024 15:12:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A3BF6B0306; Thu, 22 Aug 2024 11:12:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 354096B0307; Thu, 22 Aug 2024 11:12:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1D0556B0308; Thu, 22 Aug 2024 11:12:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id F12566B0306 for ; Thu, 22 Aug 2024 11:12:31 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id ADEAA1C583D for ; Thu, 22 Aug 2024 15:12:31 +0000 (UTC) X-FDA: 82480222902.17.70B3F0B Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf20.hostedemail.com (Postfix) with ESMTP id F25BF1C0025 for ; Thu, 22 Aug 2024 15:12:29 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=none; spf=pass (imf20.hostedemail.com: domain of joey.gouly@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=joey.gouly@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724339509; a=rsa-sha256; cv=none; b=0WGUCW+7j1qF6mj2rJml5pAmDEFNg4gKL0L3K+4v0A8E691TuoQ3s0YFtU8M3GqgwTOct/ m6Le39K9lyrgex2ZL1EN0GNL5+ql0H3uhZ/EPl4HzWv+ZOV4jvHTTSgXoOw5mwH208cVuw rdFQ76WFbT0rKifP88DqM7vTZSth4m8= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; spf=pass (imf20.hostedemail.com: domain of joey.gouly@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=joey.gouly@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724339509; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XWloCsKInlghkQxh/mo59nFfEBaFhJ6JRXZEr40jxF0=; b=LRaAPvH6KW94RYJUrZsyDzPYRJzmh6OD67AT16TRHxT0bFxskr0KkRgvy627l2rmdBSbbt xvf/4HeOOjMhI/zMh+X/CuPe9+U6WYI1M4qQKpyYK5k2QoCGCr/PmR38kLLMcaF6dhYnsR x0PQEU3c9c6TBzBQehutmRUqLY5gQ08= 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 2BF8D165C; Thu, 22 Aug 2024 08:12:55 -0700 (PDT) Received: from e124191.cambridge.arm.com (e124191.cambridge.arm.com [10.1.197.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0D3BE3F58B; Thu, 22 Aug 2024 08:12:24 -0700 (PDT) From: Joey Gouly To: linux-arm-kernel@lists.infradead.org Cc: nd@arm.com, akpm@linux-foundation.org, aneesh.kumar@kernel.org, aneesh.kumar@linux.ibm.com, anshuman.khandual@arm.com, bp@alien8.de, broonie@kernel.org, catalin.marinas@arm.com, christophe.leroy@csgroup.eu, dave.hansen@linux.intel.com, hpa@zytor.com, joey.gouly@arm.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, skhan@linuxfoundation.org, szabolcs.nagy@arm.com, tglx@linutronix.de, will@kernel.org, x86@kernel.org, kvmarm@lists.linux.dev, linux-kselftest@vger.kernel.org Subject: [PATCH v5 15/30] arm64: mask out POIndex when modifying a PTE Date: Thu, 22 Aug 2024 16:10:58 +0100 Message-Id: <20240822151113.1479789-16-joey.gouly@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240822151113.1479789-1-joey.gouly@arm.com> References: <20240822151113.1479789-1-joey.gouly@arm.com> MIME-Version: 1.0 X-Stat-Signature: cwxptjyeccjz45zbqjkqp99ix4h5r4yd X-Rspamd-Queue-Id: F25BF1C0025 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1724339549-443739 X-HE-Meta: U2FsdGVkX191eC+q3doTsLeUydo7Cbm9b1/6DUM//YyvDSCpjyyKlNfGA+Rwas0JHeexYzYRgXxLnWuumqI4gPESTiI1JEjYIPiI9kCvaLK4fM+4mIFXRYe31bu6ETtt8k52PxiNu0SpxmWpWNFzPKlW0RCRpizWsxkcCK4R53TN5UNdAxLYHIfilez3Hlq2bsfykSHegb4cI/Zh0O0Au6gE+Fp8LqHGGZ/vBHo4KHFewwUURO3FIpv9rOwE7srOdhuO25hIGUEk+pIYry2FwKqbnAofqSODfoVpTrFT8oKscoiJDroLV68GeAbLOfUy5Inez/XCO1nqV2LXWKVM6x9D0fnMUcIgAPx2zFU0svtiZGicTxJt0tRZYBU9UFlgUbTIR6BnKjHTNMR6voexD7bzABK5SH/veydSNN6/uVg4BAEG/0wHOE+yFRjXOQKkGQ4lWopwO6DsLdfRDI3o0vNHymF3moQRIZFPh697CZ71jP2twPmapGLB8NyuCEzLI8UOU4j5pwcb650ZzVDoBqsQ3H0mf+EkREfJfBUl526wmKzNXfXCwlLZVFW1i4jkforVZJhfm7D65KLi0L5YYzJJxmYs1n6cudbcgWvmU/z3Ca3DBEPj6XdZBP16CA1OUfvJkC5S2c8Jjc07NydjJ0HApy3P1O3Ss7dC3NXbWU++ELS8fUPK5Itm0rT8IdN7hWscbk69z8jzVSy9z9EVUDamw0enJD+3QyXqS/vL3g5emhQjiWDaVSPbtMx3IUToKm1Mnamkup3GlQr3FOcLsRua8wfjiPPY9c+DHoKRA4pHyxixutTtI9N9p72Vn/KS8CfZYRfzJ1LyEvCO0sCJs7YiKr6JjFZWhCtg+AFeEZVqhdgt1BgwLPguo8G2eJTqf29oItBl3V+Ui6LwY65h+id2cu6uAuKTy/vvIi1BJMRiuRWQSWlQPqRSeqLlsKSxLiVi1z9Wf63/msPuQs3 GmLnIaor PllNkQwDeUTYopkqDkOLUbTGQsD1KXPtOiWv652k8v6I6uL4eHVupSBsz3b8/c68iUaQ/8kgA5Hi+6INt0j69zgMhg3XOOOgGEV1K01UaZYhg5zokQ/h1aKCgx9cr8gyPiTB5bssBVYJCqGBbf0aWqbY6K5uOQYqsZqP7/gf4KUo/0FPkIVjZ1LgkjLiOLn1/+STwcJaSwiOUW3rzSefzAiWGYQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: When a PTE is modified, the POIndex must be masked off so that it can be modified. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Reviewed-by: Catalin Marinas Reviewed-by: Anshuman Khandual --- arch/arm64/include/asm/pgtable.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git arch/arm64/include/asm/pgtable.h arch/arm64/include/asm/pgtable.h index 7a4f5604be3f..1d0f18d30e1e 100644 --- arch/arm64/include/asm/pgtable.h +++ arch/arm64/include/asm/pgtable.h @@ -1103,7 +1103,8 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) */ const pteval_t mask = PTE_USER | PTE_PXN | PTE_UXN | PTE_RDONLY | PTE_PRESENT_INVALID | PTE_VALID | PTE_WRITE | - PTE_GP | PTE_ATTRINDX_MASK; + PTE_GP | PTE_ATTRINDX_MASK | PTE_PO_IDX_MASK; + /* preserve the hardware dirty information */ if (pte_hw_dirty(pte)) pte = set_pte_bit(pte, __pgprot(PTE_DIRTY));