From patchwork Mon Jul 10 20:43:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13307653 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 C42E0EB64D9 for ; Mon, 10 Jul 2023 21:04:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 37D0C8E0001; Mon, 10 Jul 2023 17:04:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 32CBE8D0001; Mon, 10 Jul 2023 17:04:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21C498E0001; Mon, 10 Jul 2023 17:04:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 1385A8D0001 for ; Mon, 10 Jul 2023 17:04:42 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id C1B59160251 for ; Mon, 10 Jul 2023 21:04:41 +0000 (UTC) X-FDA: 80996931162.01.85DA072 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf25.hostedemail.com (Postfix) with ESMTP id 3AB4EA001A for ; Mon, 10 Jul 2023 21:04:37 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=l4H0Sp2I; dmarc=none; spf=none (imf25.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689023079; 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:dkim-signature; bh=5+4G9ihnAATxhE+mN/TPHluvKQf1KT1lzbSAkqtjj8A=; b=7n/XjNpbCYHT3U8HVVuX82vLAAvJdbmZKvfC0serCbMnqysK2Pi2IPTjHBc32LtXHTCcSE JtmkC9TcdoqngsiuaFtfFyGPiv5lv/IIge5/LsYp+rgbJUQSgyEl0Q5bRDxdkr8L6Lz6GU +bHqct95WlIYHBeND0IQfhAPFl6X7Jg= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=l4H0Sp2I; dmarc=none; spf=none (imf25.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689023079; a=rsa-sha256; cv=none; b=DhslxFkt5D6sCRIaYbLurdvciFDlcP4JGqNDcldYf3nlt5s29TgyVKgmtQ1CEDZoV2ZP2w bfR6mvbB+5SRBwhPIBilrfGwAfjM1rD1of1G7uLRF1/blqL6zjOEf04A07qpzN0aEwwt3k CvD/nUAHam5oIO/ndIQ/7n0la0kIrsk= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=5+4G9ihnAATxhE+mN/TPHluvKQf1KT1lzbSAkqtjj8A=; b=l4H0Sp2I2O9RCZTb8AEFCido2i /8+Ddvb+sUKF9z6mUxpBDYoYWqmnn4aOWQoC7IexYAgrTe0or6WgViwvP1KZrum7pKC0NOyGJMjKc jS3v+NHyWt+f7/mkUsWrCpSYRHNryr7mAx2T4t4pn1KFR9CzjiR8sVoYxSpyp2I8S0LcdEgx28c8P FTRsQ/uuPuwZVhuPDfVoBpNPH5Htib4iP2kNco+O4QZOTn2boDt/9vMQrP9jZcj11dptab20jY6Vo gIYwsr6sUvBHhjFaYk8ylIhtnJewm+KSd+85pjtQ6UTRdq3blHrsC3Q/rhYDK9ngjZGucFuR3KFwq 4E6+Do7A==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qIxjS-00Euoz-H5; Mon, 10 Jul 2023 20:43:42 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Brian Cain , Mike Rapoport Subject: [PATCH v5 12/38] hexagon: Implement the new page table range API Date: Mon, 10 Jul 2023 21:43:13 +0100 Message-Id: <20230710204339.3554919-13-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230710204339.3554919-1-willy@infradead.org> References: <20230710204339.3554919-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 3AB4EA001A X-Stat-Signature: huwz713pjcrorh665hquh3opgczqo7xp X-HE-Tag: 1689023077-903686 X-HE-Meta: U2FsdGVkX1+Y3GS9BUVpWsZjeolW0uJ/NBXWKmhMlGMqZnjzeBuxaoVLuAUZ1bwGHkm6F9epn4HmV27Srsb3Z3d2YJK82mKQaCfAjgITStJuiRvWyxefvGRYT2jsqtwa1ScaCji4ZV7ussjj3rfdHvNiWWA4PDG637j1I82Abk6Wr6w34t6MmgC7iuWAj2Hb9r1ePa78zZeME+vbx8/5i20oBRn5cM9dHHOX/TEpHzCOw/XcnhkedIwH/EtdurcoaQxOobbRTLAA5hgyEbjsURrl61Is+50BO09Rz2kURydayyYHlgoXtbAxPeg0LoAUCyddsxvg4jJxkC5tx7MFmkjm8kqWnbtNtPupi40Le0SRNP534k/AWUmmoJNSLJfli1p6WOnShVQu2U3H9LrKv8EdEgXM/BWbmJAfXyU/xMIVeD/hD2h+/E3I7OHEdt93ZgR6enk+MG/HE84hbrSn1Sbzmr2MScJXBRa7M3eAWNPKoE2R11BE3ogzBSF+DsgfktRNGruFpRR+cD5fcBhipqnZATlEvETyeDvo+qLd9kb4cjBWWqc413ugCgURFV5k+Hlyyg1xUywqVUNhcRKk2jMxGVn5r1BWC0OGxZ0CP0mcJUQ1DN+PA6TRIrbG2BvH/GGW4T8VYNEBF3ZEub4mYBTNtIn85P4jKDrhUu6La14oRBqPSK5EhdvqzjZdAKD+N8jNSEdqP8GbpXLdc0gFC2cJlr1Ja72xsoSB74SJDJLgLZQk5pRBePrxeo7tEgfaX4H338ZzmIohBC9ecUSWUS8L+h/3oIwr3B4eEOFF3VTMPmpzyDWwH8eVNFRkhp8TUt/NtersMSBQ6XQjz6I9FSdwUY+XOooVeFioYx4HCKxFtC9U1IFNy8uY1QgnZzd45+xyO/G6t8WROv6NhYA6SW4pmmDFI/VWmq+uHRaFXwN8CGnTrANLs0RKqRrEdPK1W/tmjzv19AIXMAIRUYc 7Jl8WSzS FoO2AYkApSiRqLMpIeieHEYKiXfI747oh7me8iR2DfbmwsdnPn67geNUzWoF/n3sRmAPv9iCFATs/OxVyPDGszsbAOxV0gKfk08L1mF00IVj+mcHw+CLH19MDWM3vQzEnP965qWrdDn19JKiifhRLg+xapfZd+3vHz+BCq5iBiYD8u+G8+L2c6LA2oRXBnARwU/MN0SGhtjFX7wKmrFeeUUToh8DXS++JkXbRmgZtIVeiTjc0JbjsKHs0qEOqptT7ztDYhDHQbLEIxY3H1HaP6wG5eP5rhELTSLIMX4N0B/3eckA= 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: Add PFN_PTE_SHIFT and update_mmu_cache_range(). Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Brian Cain Acked-by: Mike Rapoport (IBM) --- arch/hexagon/include/asm/cacheflush.h | 8 ++++++-- arch/hexagon/include/asm/pgtable.h | 9 +-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/arch/hexagon/include/asm/cacheflush.h b/arch/hexagon/include/asm/cacheflush.h index 6eff0730e6ef..dc3f500a5a01 100644 --- a/arch/hexagon/include/asm/cacheflush.h +++ b/arch/hexagon/include/asm/cacheflush.h @@ -58,12 +58,16 @@ extern void flush_cache_all_hexagon(void); * clean the cache when the PTE is set. * */ -static inline void update_mmu_cache(struct vm_area_struct *vma, - unsigned long address, pte_t *ptep) +static inline void update_mmu_cache_range(struct vm_fault *vmf, + struct vm_area_struct *vma, unsigned long address, + pte_t *ptep, unsigned int nr) { /* generic_ptrace_pokedata doesn't wind up here, does it? */ } +#define update_mmu_cache(vma, addr, ptep) \ + update_mmu_cache_range(NULL, vma, addr, ptep, 1) + void copy_to_user_page(struct vm_area_struct *vma, struct page *page, unsigned long vaddr, void *dst, void *src, int len); #define copy_to_user_page copy_to_user_page diff --git a/arch/hexagon/include/asm/pgtable.h b/arch/hexagon/include/asm/pgtable.h index 59393613d086..dd05dd71b8ec 100644 --- a/arch/hexagon/include/asm/pgtable.h +++ b/arch/hexagon/include/asm/pgtable.h @@ -338,6 +338,7 @@ static inline int pte_exec(pte_t pte) /* __swp_entry_to_pte - extract PTE from swap entry */ #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) +#define PFN_PTE_SHIFT PAGE_SHIFT /* pfn_pte - convert page number and protection value to page table entry */ #define pfn_pte(pfn, pgprot) __pte((pfn << PAGE_SHIFT) | pgprot_val(pgprot)) @@ -345,14 +346,6 @@ static inline int pte_exec(pte_t pte) #define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT) #define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval)) -/* - * set_pte_at - update page table and do whatever magic may be - * necessary to make the underlying hardware/firmware take note. - * - * VM may require a virtual instruction to alert the MMU. - */ -#define set_pte_at(mm, addr, ptep, pte) set_pte(ptep, pte) - static inline unsigned long pmd_page_vaddr(pmd_t pmd) { return (unsigned long)__va(pmd_val(pmd) & PAGE_MASK);