From patchwork Fri Oct 27 18:08:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 13438781 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 B1F26C25B47 for ; Fri, 27 Oct 2023 18:09:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4D9946B03E1; Fri, 27 Oct 2023 14:09:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4644B6B03E2; Fri, 27 Oct 2023 14:09:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 303EE6B03E3; Fri, 27 Oct 2023 14:09:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 229D56B03E1 for ; Fri, 27 Oct 2023 14:09:31 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id ED50D80964 for ; Fri, 27 Oct 2023 18:09:30 +0000 (UTC) X-FDA: 81392028900.12.49ABB8D Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf13.hostedemail.com (Postfix) with ESMTP id 5C9702000C for ; Fri, 27 Oct 2023 18:09:29 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=none; spf=pass (imf13.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=1698430169; 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=eZn9+SPTAmjnj0mZl3RsfzwZVNVBgYgjIKK1tqjbkQ4=; b=HNxtIYR6UPUJZQoeb4dwS+r/YetQiHD+ATutVSiQqT7eJo57Geca51JRg2/FKqCUFhAEHM x++kP06xKLr64ndRu8n4USkyxzDV8QpmN0viFFLMNkift0EHI+y6OnalDaYi7O4QK/7Ygd 4OzTFxq3hvgSqT8I3mE8wrvbadTaWo4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698430169; a=rsa-sha256; cv=none; b=vVYq6ErqelDqHHwBImbeDVfsplqMvFXYJMCCoqPy4LqxYM5lqKNPwla33TwsGZMQMXYMkP FT2Kvgbl0SIYcREn9AW5e8DN4OQlZ3SSWKXy8LGnBqU86Xa1XnoeUEGgmEyXR4Pg1hFffn Q8vgpRU01TRZj0GP8TEKDRO7q3ajq5w= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; spf=pass (imf13.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 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 388EB143D; Fri, 27 Oct 2023 11:10:10 -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 6B4F33F64C; Fri, 27 Oct 2023 11:09:26 -0700 (PDT) From: Joey Gouly To: linux-arm-kernel@lists.infradead.org Cc: akpm@linux-foundation.org, aneesh.kumar@linux.ibm.com, broonie@kernel.org, catalin.marinas@arm.com, dave.hansen@linux.intel.com, joey.gouly@arm.com, maz@kernel.org, oliver.upton@linux.dev, shuah@kernel.org, will@kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, James Morse , Suzuki K Poulose , Zenghui Yu Subject: [PATCH v2 10/24] arm64: mask out POIndex when modifying a PTE Date: Fri, 27 Oct 2023 19:08:36 +0100 Message-Id: <20231027180850.1068089-11-joey.gouly@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231027180850.1068089-1-joey.gouly@arm.com> References: <20231027180850.1068089-1-joey.gouly@arm.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 5C9702000C X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: febn1cfq618xrz1b45k9974mpdj1p8ur X-HE-Tag: 1698430169-789497 X-HE-Meta: U2FsdGVkX19Lr1sqag9ndcvrGldJpF9iWoz8bbIxefMTtxY5p7AVbIUInNVymv+mAUJQG4zE4FYOFMj8y/c0MGJut3xFs5k3dbuqH+DRaJY/dJo9Qb4DDgssM4fKX5KvSOr3Fm3MnEGe7KgD6bnGlRQ10Wd98ewRRjj4qeiY30bDYWCdxsUHY3J0toOiKgbS4UBiw3QjVPJ2YNUNuckO+CvtcWuKq10V3nIX3WS1g7DO1B4LpxuL7PMCuF7f0DCgLrQg/Qv3yXmR4u1Y6KO3+3VTC7TsdsvHF8Axh2nZb6X/jRiocQ0WVGxUc6lInNu5hVu6azSD41AOqfNEqJ6aU6t9OWYH8fRekMFFIxLIFEPem88d1y0xPeOKs4SNNtexYjBrpLiXv1lzsMeY69ssDFGBiTblRKqVYxT1eA6vzAzOn4Yrldh1tRpOQ57z6wB1kNC1GaYIjNR9TZR7BsVT2aQ+EGYq51zv0fJZOcEiwVMusNwkcwEqH2+BZXPkFSlFtvNyAtRxRnxCV99Y6gO9bB3h7B26d3qok5xnSMR8vAbG3uhyCMEOofjryHpLoAXgG+9ZuGMKrHP05M0vyQ5AdBUkf64wvYi69TV2hU5qii8OCkpoUQnfwZExFmeZ3Hsbs7rJz9N9RP/gbtI5R5k8Wg041RWB72koyKEMiRGaDvoGnoh5TM6oVZlPF7NGyMrU/vRI5H1O3Px+1z2Nrz/v5twMaEnwaNt12kkWoFqY9yyJlgHZHvIgW8fh0YFceGILzkR+5WLotamQ0Ff0JIVyX8L3mXRbMe8y7ipr+voZj8Rn4iho4PsmPlMClWczlH2BcXeGcOv5YHMs8WiCjU3gCJ1Bmmn9fkLV5S1eYkx9QtkKuwzLv0UxWXnaprAAHPjXi7St4fGjQA4Holko7n8niYTLlx6wDBf4fgr7HTB8I577ppZhtsNoUPCecxh+H5madFBiukswsBIJzPCX1Kz vgy3twIV weGVTThjj92g+zmTqpLF7KL8opLWWEuDydt5V1q+wDQVWbmVCSmx2flx7U9izLc1FTaimeKp1YhInilx9X/Y/YUkYmSHms84mMGB4vfPrercv7MUcz0eogl5xAE3a7raeNQe2BQ+6271et9XIkOjfwdskiWGFVTk1WqP3DCcYXJ//yx9HEEa6sXxNzpB+PodBOLlpXg0dR7JNnyTAmSI+JAlUDA== 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 --- arch/arm64/include/asm/pgtable.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 7f7d9b1df4e5..6c57ebe8e349 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -820,7 +820,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_PROT_NONE | PTE_VALID | PTE_WRITE | PTE_GP | - PTE_ATTRINDX_MASK; + 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));