From patchwork Wed Mar 15 05:14:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 69951 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2145052wrd; Tue, 14 Mar 2023 22:16:19 -0700 (PDT) X-Google-Smtp-Source: AK7set9Zhlb1xGwlEXbh/SGAOivhNIJPX6XnVIb1Be62srneMvbuJt+YmJYBARrmyYspFQ87++oZ X-Received: by 2002:a17:902:e484:b0:19f:2339:b2ec with SMTP id i4-20020a170902e48400b0019f2339b2ecmr1121539ple.33.1678857379754; Tue, 14 Mar 2023 22:16:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678857379; cv=none; d=google.com; s=arc-20160816; b=MvfNec69pgiiyGYu8SLpvKXefOSWAww/foqze5qitcGwQrG2/JcEoqai9YB+ttiSrk 5qZULfvc8lVcv70/yo2ENrwluMexkyiCJp7idVNFaZ8gxUqaOogjGVrhFsR/5azBbfR2 k5XbKmkk851o+x9ilINazo+8Q437krjkq29kcEiahKz1ZlYN/MfQX/EvE0f/EysVY+Hx 24/GIi8dky39xc8HZQ7+zw5SNKmB4r75pQsSu65Y/SC+xY4uMUzKjH37SYZ+ysfFyi6b kdZoBrd7ZSLmbx/ZEC2LpytiE4PiBfhdkpZf3IURJ4XQOU4fZiyh/hGCRWgY6fkF/cdZ 4PgQ== 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=kYj+qH1/7tSlgOsrYtaH9bSHy1IP4XWRsGSUxqRkHdw=; b=sDUKYqpmFI1KL7OeY9cgDy7OyWO+O9C+9RqwH5jXhFt83edVy4Pd8D9OaTcbz5tk7H 63IDa1McksRG1u9Q098vVxA6eWX/6N3VQgTlf1J0T+48axVPdhgAT6nfuzyVCvE7vfzu Rk10DQ9RemlCUysKfsVG7FzbtOb43Qf8dLyH+B4i9QcrOGWNhXo74W99RM9D8hlDJr0H 9Jx/eAuQHk61jjUri1VdDHh6XWHhNDVXgaEJiwN7KbmR9NJF07YE1cFy+sl6eFQPx4PZ kuk35uD7apGm6IesTYJg5F2DMWazXc+oDzuQslhLrDvUsXP3JNVgLhuomifKtrNlAC4E Ufzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=qCXSPv+7; 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 p16-20020a170902ebd000b0019b005e3292si3918243plg.542.2023.03.14.22.16.06; Tue, 14 Mar 2023 22:16:19 -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=qCXSPv+7; 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 S231417AbjCOFPZ (ORCPT + 99 others); Wed, 15 Mar 2023 01:15:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230356AbjCOFPG (ORCPT ); Wed, 15 Mar 2023 01:15:06 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2737523A54; Tue, 14 Mar 2023 22:14:50 -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=kYj+qH1/7tSlgOsrYtaH9bSHy1IP4XWRsGSUxqRkHdw=; b=qCXSPv+75+CZqxylF5+9tiMWXb QUPFEm/uOKR8S+KHFCVONuqmgQrens6os069ChSrooiIRS9f5rxzkyGLUSk/MZYVcRUOh6MV2V7Z0 qer/Cjb1yxa/DMCzHV5SR234J8FlMvpWzn2UT0qPNx2AR/TGRiU2FoIiVGotwI4w34DCRkaAEKjij CChK9b6ELKvMw2K/DnQwRkvBuVmdBOZbFWrwilne9ogqHbz2VUJ7fAwZlBEbEdkkAlZbI4JQ03Y2D PPww1Dcby4qBwBeLYqY1fxrtY6fTphNabVIbFZBzUTaY+EpXYXYL8u/1kFb5L3QAEm4Q8r1SBBPjA +S2Z8bkg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pcJTL-00DYBY-Kj; Wed, 15 Mar 2023 05:14:47 +0000 From: "Matthew Wilcox (Oracle)" To: linux-arch@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Brian Cain Subject: [PATCH v4 11/36] hexagon: Implement the new page table range API Date: Wed, 15 Mar 2023 05:14:19 +0000 Message-Id: <20230315051444.3229621-12-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230315051444.3229621-1-willy@infradead.org> References: <20230315051444.3229621-1-willy@infradead.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760409555909347195?= X-GMAIL-MSGID: =?utf-8?q?1760409555909347195?= 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 | 7 +++++-- arch/hexagon/include/asm/pgtable.h | 9 +-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/arch/hexagon/include/asm/cacheflush.h b/arch/hexagon/include/asm/cacheflush.h index 6eff0730e6ef..63ca314ede89 100644 --- a/arch/hexagon/include/asm/cacheflush.h +++ b/arch/hexagon/include/asm/cacheflush.h @@ -58,12 +58,15 @@ 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_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(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);