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: 118082 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp62831vqm; Mon, 10 Jul 2023 13:46:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlHpgoyOGrsUVGUgr4NX5N2gkxBHW3exEJ2zOW8Rs4xdD4wdHBoeC9XMvnL2ldT3ogMTaSh/ X-Received: by 2002:a05:6402:150:b0:51d:a012:ec2 with SMTP id s16-20020a056402015000b0051da0120ec2mr18849039edu.3.1689021972571; Mon, 10 Jul 2023 13:46:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689021972; cv=none; d=google.com; s=arc-20160816; b=FUFcPxqOy2dGXcCSeHk7RYU5RGO4hKgP3TbCvxZgIOls0OGehlBdp/z1l8KVWeTe8F dZ8YqQQjYh1KbxHSNaCk02QJP7uy/QdtxrkbWf2L4drOglV8st7Rl4hyjd1oxJVqJLWt f2GjhblsfR/rD+XoQW4fxnDuUeu5FnnJYI4iL9ZhqhJLdVCRRhlTsx5hiCCmPPfHtOQs AGQW5e3QCsvtGulaxCdhRK+WuWioHTfGB9KkKobHtBxoUJ1K0fZcRxSUW0UXyVSpzQZD XDCNK9RpR9UPB7QaipwaVzOthmGC6Kh3bIdmsnPBeG/MLiFAjvXw++Bal9VAA1XHFDlK qZPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5+4G9ihnAATxhE+mN/TPHluvKQf1KT1lzbSAkqtjj8A=; fh=UUuhNXrTB5xq/wTzzqVGF6zdWlcRjxdcC8mNGsBXO4w=; b=FXZz3Xu9VzH3unnMowDqyyEtX02+MxfSiGDHT9QPAZxZJQkCqh9+gG8ioLhw5SdmUz R3kKnw2QsPFfnFtCoSSSvsbJ41hnFKN1hYBLYPxD2gCbLMPEuvnTq5BZJM9T5FJWLPgv a+9vL+tk3wwWlAzHAJkSvLaJi1MmUooBIfIJgRGLgVyEk/KmZ/2RPeybR3/E2Aj7GQr0 l2OHs+Xz8D+H0Wcxi4ieDr8CgO7/N/4IJkmwzCRBEQHuazcFDpGWkaI5KxU7CFrsv3om 3s/8V/iWbseyC46G3aXbRS8wc550xWcucHK+n+Wpi3+mXdoryd37W7c9DR7p+zpCTDGC ys7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=l4H0Sp2I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o16-20020a17090608d000b00992f1a3b9c0si410619eje.414.2023.07.10.13.45.49; Mon, 10 Jul 2023 13:46:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=l4H0Sp2I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232452AbjGJUoP (ORCPT + 99 others); Mon, 10 Jul 2023 16:44:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229669AbjGJUn5 (ORCPT ); Mon, 10 Jul 2023 16:43:57 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3DDBE6B; Mon, 10 Jul 2023 13:43:44 -0700 (PDT) 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771067904291256099 X-GMAIL-MSGID: 1771067904291256099 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);