From patchwork Fri Nov 24 16:34:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 13467925 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 C900EC61D97 for ; Fri, 24 Nov 2023 16:35:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E74436B02AF; Fri, 24 Nov 2023 11:35:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E25E76B02B4; Fri, 24 Nov 2023 11:35:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CED2D6B02B6; Fri, 24 Nov 2023 11:35:49 -0500 (EST) 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 C034C6B02AF for ; Fri, 24 Nov 2023 11:35:49 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 97D2980169 for ; Fri, 24 Nov 2023 16:35:49 +0000 (UTC) X-FDA: 81493399218.12.7C12E76 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf07.hostedemail.com (Postfix) with ESMTP id C614340002 for ; Fri, 24 Nov 2023 16:35:47 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=none; spf=pass (imf07.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=1700843747; 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=sZebDOqPh7p1LKqY4i/CEXWn5Rw7fcbpLMdU995VmbU=; b=Gg2srFMFLbko7452KuCXasfBzxslSh8ISkVX0qGwSkDb4cDfGU87Fi888Ni3VqF+jkLDwk gvNivogiLx6fqllpz6a98/+M7SU+qGOkpD5Bu+N3QY1YKO4OlfzZglmjCN+NtsZA28MvKW u+DUh7ADuDfWGeoNIfA/OKZO/+MlWEo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700843747; a=rsa-sha256; cv=none; b=qyHO5ktag1VtU4j15y2tgqxWayAepgdIQp6+abmAEkjyMm6TSXhSdoScAoRmnUfIcD9hBl 6+DNyyRLnSJ4iApwaYSZIuVIbs0DsvtOhI+esGboDQ3cUbRJQKQjS14eL5noXIkFJV5uxY Z7EbYlLSIzy+3daEVDHvOLVLseHqA1A= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=none; spf=pass (imf07.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 894A41BCA; Fri, 24 Nov 2023 08:36:33 -0800 (PST) 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 DA01D3F73F; Fri, 24 Nov 2023 08:35:44 -0800 (PST) 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 v3 10/25] arm64: mask out POIndex when modifying a PTE Date: Fri, 24 Nov 2023 16:34:55 +0000 Message-Id: <20231124163510.1835740-11-joey.gouly@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231124163510.1835740-1-joey.gouly@arm.com> References: <20231124163510.1835740-1-joey.gouly@arm.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: C614340002 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: pj6y3yjcfcdjt4ukyjqp11ryjbc7h6p1 X-HE-Tag: 1700843747-205113 X-HE-Meta: U2FsdGVkX1/YYCMf6TezFH+GhZriuvXcxMH4UncWkK4BmzG0/BvBCY6/GvOrHviszb3f1ZYqVzR/Y85r0MVduaquQckaeS26hgatCboxnFP8547h2xTnDTTBQRwdjZm/ctkV8PMmrRPiJeCy0T7pZONe3uQQlhWr3ghCYDPp/qouVWF1MsqzKpL3ohg5r/AxV47k1cGAZueqVSY9IQFKf2jfkTDWCi98UNM7gncEqcyYfKMpQyNJ7LXX69ktC3+enB5to/3LMB2wCT5SzmwJ5BC627zrd5bCqNeaCfe8hBvOtaGdUK6NEUuMs3NgFcn0u/9OyPJ+aPyrd0n6BjxjDqQ6WPk3g5RRhKX5mw6/axpWPUdmHjeQfUYJOWKqSzsZP76V3MIBgeic+txSavJUYM9CglY1bAvo/Csl3Q02WO7Y90fC/HKOvtlKxgZG5lfRHqc24ypWxGXYnInh3zA/O38D0Z95H/ffdR2ng36t6Ptnyy7dpVuaBchZRkrxYnMST+JmnBAPUQHtiFuFVuAhgmrkRDQz4ZYm/kSrlKN+OaUnsY9krQGvRTHJ9Xd1wao/ikjwr0jr3GCqrswPiz1Uz6vp/JiH2D/ETvTMFux0lL4a/vxP/PGfSDioq94D7u/ksumUmibQufecQCFHOPcMmTZU9sbzB/4z9DoHFvjk0mPU/9WGD+QMnbZTzFf+QbZzTltEAbuxNtwGWJr6kCGlIvjtZiAx8WTtf0szelMVLOg4pfsq+syltdTDxTQ1okSXwQ8PsoEUiXYJOzOPkbx/KPqXoM1brHh/sgBuHKSPxzEpfRNV45MSwldOLUdSX6gFYYcJfwfkfoiZLi+oHYRbKpL8oBZbuseLMDuTLP3KAGsYJn+inF+IunXRzYbjH5oeRZyFd0TZpCyiheeojJNLxVh+hRKVwflJYM6wZwLaYWRjBCz+svnxJFzqz66OvBq+V4jXk0K1EVJssJ5y/lE TXkoGDSj /WuL4sqN5gleICnEJmYENKgTRMGQTuLYk3tQGEiwqihkqNNTYEzOKej+r7AT+NYSChyD6hLls3TZszHFgWSQG33AF0t8E/CycfBvM9kqu/L36iPlJEx0m1gtUnpU+w2RhyU+QljEaj3zSekluSsSnKTLloIlVC+zkeO9pn7kFrUklXCLaNT5nmY2cp4F+Fx8kf4D3yMkKr7G9qVkzlZliqzXLdA== 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 --- 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 b19a8aee684c..e45105336ca0 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -828,7 +828,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));