From patchwork Mon Jul 10 20:43:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 118101 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp74995vqm; Mon, 10 Jul 2023 14:12:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlFbRKyj/mMe9UWmM4hi9BTPJD0hiFU4lqrrjUfscbup7Eskhpv6a0ltjhWPn54XzDeIp4zC X-Received: by 2002:a17:903:22c9:b0:1b8:aef2:773e with SMTP id y9-20020a17090322c900b001b8aef2773emr12539110plg.46.1689023535059; Mon, 10 Jul 2023 14:12:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689023535; cv=none; d=google.com; s=arc-20160816; b=FlBRdguOYVp1kCyxjSJ0vA2kOcN37TJQLW691ICw2zBS+fNA7fE+MO843kDjlH0A54 Cmkmd2YM95VJDITdzRImJYigCQJphxpOnL9sIDGWQgb4hIpjnI1BEQL9THwQYrtjmHzK Qj2bQNTsrGwv5lVbM/WVQtevD5g+2wUnb0KamiAN/uXN8YNVaVSycTkFYZQ4J9s2bKyL IijaV6SDOjgBSsdwJF1/QWs4cZErEAzBmt1VDnoFWv/0Yw7oJiyaxJ8VwmHN9ipQqT9C dnEUl23Q7YXdMm2nTCs2svLOP/fTtwMd+vt6jukijIJAexUd3IyVkdIW9qP8RxTMkU/j tBEA== 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=5z4wJk0QTIjcx4c+UwHHBLj4skJRBt0v1N12u1MFfd4=; fh=11uzIfhdGq1YuG3VlRhckEsy0uLPjx6s+fQfaWW6RNo=; b=f8RQgcVg9Vd+OIk39uYpG4z6PiUl32RSuINOUE7fQQB+HKfWrNkOyxVv4gufpCOBYY VNjTyC+3TZ6oPNrIIr2G8yW9/b69jPJSYEQ7zHjlSOVCjEAvHCgL2JSvYkUcnnyl/w6Z /efBWfN9HExo4oQhGcpevHLlUmAKEQWxW6KrWdmgukvpUXmWFG1zwS3m30qwGLIAwp38 JFQEE+nDeVbsNZYOVQskldsYP0bCpcqLn3CyYB1Y2YuPJk0BEo8NqpX8WwETnhsyW3XL hSYA9gqkoF6Nel//OxrNqNoHiDT5xGLdurBI5xK8lVS3j0cO9aEpQsO1+JUikIEkKN1a MN0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=F3tIJGX3; 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 d9-20020a170902cec900b001b9e9b21249si349171plg.649.2023.07.10.14.12.02; Mon, 10 Jul 2023 14:12:15 -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=F3tIJGX3; 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 S233355AbjGJUq0 (ORCPT + 99 others); Mon, 10 Jul 2023 16:46:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232146AbjGJUo7 (ORCPT ); Mon, 10 Jul 2023 16:44:59 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE121127; Mon, 10 Jul 2023 13:43: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=5z4wJk0QTIjcx4c+UwHHBLj4skJRBt0v1N12u1MFfd4=; b=F3tIJGX3TcBd8jd37iFsFAx744 +Fg9zd01Ea63D7FffjdtHbZRmLMH1r81WylBxdustZ4JMXuUPwnYFR5pQFHmn37M9chwOI5Pcu4eV z11VZwus4IF3NTVCNup0zOEIFRPGlw0XRw/l5MD2SZmt+siplZn9psDbOO87IIHk/6sO73zwp3nQY OHpBuoINn3jHnlqe03bIALGblwIkdlqvgd4zp8aS1BcTvc/dXJo5oJJsqWZRgxk8R/PFVxTH12lQF adwHKSxlkTGhzuIZXvRjXm7rYoNngmHOVMlkoNJq7NJeEtLW8kHl5JAmoqabG3GVaRnwtiIKV0syu Ki84JZwA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qIxjS-00EupL-Ve; Mon, 10 Jul 2023 20:43:43 +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, Mike Rapoport , Michal Simek Subject: [PATCH v5 16/38] microblaze: Implement the new page table range API Date: Mon, 10 Jul 2023 21:43:17 +0100 Message-Id: <20230710204339.3554919-17-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: 1771069541978959257 X-GMAIL-MSGID: 1771069541978959257 Rename PFN_SHIFT_OFFSET to PTE_PFN_SHIFT. Change the calling convention for set_pte() to be the same as other architectures. Add update_mmu_cache_range(), flush_icache_pages() and flush_dcache_folio(). Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Mike Rapoport (IBM) Cc: Michal Simek --- arch/microblaze/include/asm/cacheflush.h | 8 ++++++++ arch/microblaze/include/asm/pgtable.h | 15 ++++----------- arch/microblaze/include/asm/tlbflush.h | 4 +++- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/arch/microblaze/include/asm/cacheflush.h b/arch/microblaze/include/asm/cacheflush.h index 39f8fb6768d8..e6641ff98cb3 100644 --- a/arch/microblaze/include/asm/cacheflush.h +++ b/arch/microblaze/include/asm/cacheflush.h @@ -74,6 +74,14 @@ do { \ flush_dcache_range((unsigned) (addr), (unsigned) (addr) + PAGE_SIZE); \ } while (0); +static void flush_dcache_folio(struct folio *folio) +{ + unsigned long addr = folio_pfn(folio) << PAGE_SHIFT; + + flush_dcache_range(addr, addr + folio_size(folio)); +} +#define flush_dcache_folio flush_dcache_folio + #define flush_cache_page(vma, vmaddr, pfn) \ flush_dcache_range(pfn << PAGE_SHIFT, (pfn << PAGE_SHIFT) + PAGE_SIZE); diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h index d1b8272abcd9..6f9b99082518 100644 --- a/arch/microblaze/include/asm/pgtable.h +++ b/arch/microblaze/include/asm/pgtable.h @@ -230,12 +230,12 @@ extern unsigned long empty_zero_page[1024]; #define pte_page(x) (mem_map + (unsigned long) \ ((pte_val(x) - memory_start) >> PAGE_SHIFT)) -#define PFN_SHIFT_OFFSET (PAGE_SHIFT) +#define PFN_PTE_SHIFT PAGE_SHIFT -#define pte_pfn(x) (pte_val(x) >> PFN_SHIFT_OFFSET) +#define pte_pfn(x) (pte_val(x) >> PFN_PTE_SHIFT) #define pfn_pte(pfn, prot) \ - __pte(((pte_basic_t)(pfn) << PFN_SHIFT_OFFSET) | pgprot_val(prot)) + __pte(((pte_basic_t)(pfn) << PFN_PTE_SHIFT) | pgprot_val(prot)) #ifndef __ASSEMBLY__ /* @@ -330,14 +330,7 @@ static inline unsigned long pte_update(pte_t *p, unsigned long clr, /* * set_pte stores a linux PTE into the linux page table. */ -static inline void set_pte(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, pte_t pte) -{ - *ptep = pte; -} - -static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, pte_t pte) +static inline void set_pte(pte_t *ptep, pte_t pte) { *ptep = pte; } diff --git a/arch/microblaze/include/asm/tlbflush.h b/arch/microblaze/include/asm/tlbflush.h index 2038168ed128..a31ae9d44083 100644 --- a/arch/microblaze/include/asm/tlbflush.h +++ b/arch/microblaze/include/asm/tlbflush.h @@ -33,7 +33,9 @@ static inline void local_flush_tlb_range(struct vm_area_struct *vma, #define flush_tlb_kernel_range(start, end) do { } while (0) -#define update_mmu_cache(vma, addr, ptep) do { } while (0) +#define update_mmu_cache_range(vmf, vma, addr, ptep, nr) do { } while (0) +#define update_mmu_cache(vma, addr, pte) \ + update_mmu_cache_range(NULL, vma, addr, ptep, 1) #define flush_tlb_all local_flush_tlb_all #define flush_tlb_mm local_flush_tlb_mm