From patchwork Fri May 3 13:01:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 13652793 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 E4F30C10F16 for ; Fri, 3 May 2024 13:02:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D37F6B00A8; Fri, 3 May 2024 09:02:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 75C796B00A9; Fri, 3 May 2024 09:02:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5B23A6B00AA; Fri, 3 May 2024 09:02:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 3A35B6B00A8 for ; Fri, 3 May 2024 09:02:47 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id E9CBF40F95 for ; Fri, 3 May 2024 13:02:46 +0000 (UTC) X-FDA: 82077099132.14.0BFF81A Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf04.hostedemail.com (Postfix) with ESMTP id B24E34003F for ; Fri, 3 May 2024 13:02:42 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; spf=pass (imf04.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=1714741362; 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=UCOC1oT2eBl3OuHcpEdtcFY9AiX3PwI5X0vEATuJgdQ=; b=FetMN+ZgXAn+3Rtly8y9oPtiRi7ePRa/OkoPFry5SLE3ob5mAYSWUsCqw3FgUt2RWze9Zr s3dwaY/MizOQVIFB2LXq68JMRQt+wrQjQbixpNK1FOT28efl07u9Ofke1Zd3lwUxnA9nr3 ukxIRruomp8M59jJEMM4zqtlYtSLNjQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714741362; a=rsa-sha256; cv=none; b=J34W/hsVL+hvZKhtl8FmzRE5vcZP0CBiNODm2rTukmVqM4WVaKq0NdlzCea8YCZf9rJMY1 Tq0+YdWAQLW7txU9Iyaoc5IX64Q3XSUjNO9RA0O/GVeJki3u8xYrS2FxcC9PHuygrN9TEi aHIMYip5fWP03S5Nabw1MkgS1t67r88= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; spf=pass (imf04.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 23D4916A3; Fri, 3 May 2024 06:03:07 -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 C71E83F73F; Fri, 3 May 2024 06:02:38 -0700 (PDT) From: Joey Gouly To: linux-arm-kernel@lists.infradead.org Cc: akpm@linux-foundation.org, aneesh.kumar@kernel.org, aneesh.kumar@linux.ibm.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, szabolcs.nagy@arm.com, tglx@linutronix.de, will@kernel.org, x86@kernel.org, kvmarm@lists.linux.dev Subject: [PATCH v4 14/29] arm64: mask out POIndex when modifying a PTE Date: Fri, 3 May 2024 14:01:32 +0100 Message-Id: <20240503130147.1154804-15-joey.gouly@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240503130147.1154804-1-joey.gouly@arm.com> References: <20240503130147.1154804-1-joey.gouly@arm.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: p8tgu7c9mtreiepck8ern8mo9rg8mkdh X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: B24E34003F X-HE-Tag: 1714741362-319152 X-HE-Meta: U2FsdGVkX1+qZgcgD6drmpkC8NHUDBaqyaH+bxvpXZyxQhy1mNAcLCASn4gtJxbxjzQ8e4hc9qObWhaa7pqrjR+O4Jqzgg4Vvq79q67ZpYvh5LEr8kJ4DLSXXMRIwacmyNXxVUVvNNipdPZbp+p1Bv3nsWcWit/oAsAmJ0fj9yNtc69176e3Im5Ke/BrV5RxCdyGN2SjTaQR7HgPgl4Cj9g/ZyMYxehvqdyOe22LPkNzbTAwQNt4/2DAjhW3tTV3AIa4BPeue7AdM42O/FjDd1chRAOzcCmntlei1aLFoIeqFoMhtkCe4se/l/3vicS2mjySX1BiQkYWgpQrg5z9M7M7Vwgib3QfHU6gbyk4tTp8JUC/8Fwvp7/+EwpjSFFxrZTTpKZ2U6m7Cy5h2JAnGnK8Q9W1laIAHqgNBwgon7bN1iPAkjHH5+9TKEMDYBD38VrR3b4VnbYzkgs+PxM9gRrxYJOS6N+JxNYAh0qWQEjtFTXHOBUi+nsqr6ASzkDXbsl33LS6r2MpO+H1fxPvCdlHddhcNohgLF+t1QhHYmVCm7LNydq01CUKjdcarjofdrf63KQvcTmnhe7CbB57iAVj9fpApQFaiewt+ek3exD0EKfLoOOnkB/PnM7sJohPmd+wgCs95rrcRhzL04K3Edkb3aT7Jc3L9maVloQ8lgDUjMSiM24/4BIU5XSblin0OcDUHsNXyxYIiwmT7zILwDYU/nu/IXGPCOH/jxVQa2id/BlKjR++8B0Ojho8pEC/vZai4Y4wfw7lbORJrvGcGFOBzwjMTftr6xS0KEETfJ4aj6zGaPPr6T20fV+bkfObCIySTs1fKVQhPtdTTbY6jFnzhupY1M7gS7aorHBk+AyvKfatthWncBrQxYYWY9B/Vct4GRmIjD+WGQ9Y+heI7iclhziS9VRRut1G2po7EavWpfQPysQk2S5npOxztfo+KSLDADkWH7GDr0Zw+pF YiktR1+Q O18no83dl/XPNkviUi7bm0cvRAFzLrQolgS5P70ogoq6uHIaDS9wySFjo7RaGP5oMXur3A2K5aNaoEP1hd6oVMDEvKFK0+BGFYv3fBWnD9WLMvkKXxX6LCwGuVPQN3isEkyO/urXF2L6iwPCpoEDtHum72G9/wagf7NzfNk39zwJ7ponHZnWFhUyTBjFIB3u3u8b5kotdZN1H7HEkvKvsGZe5EQ== 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 a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index afdd56d26ad7..5c970a9cca67 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -1028,7 +1028,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));