From patchwork Wed Aug 2 15:13:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13338357 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 D55A6C001DF for ; Wed, 2 Aug 2023 15:14:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3D0992801A1; Wed, 2 Aug 2023 11:14:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1C7BE2801A2; Wed, 2 Aug 2023 11:14:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F34402801A3; Wed, 2 Aug 2023 11:14:19 -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 D11B02801A1 for ; Wed, 2 Aug 2023 11:14:19 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id A7514160F58 for ; Wed, 2 Aug 2023 15:14:19 +0000 (UTC) X-FDA: 81079510638.22.1ED769A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf03.hostedemail.com (Postfix) with ESMTP id 0B37020029 for ; Wed, 2 Aug 2023 15:14:17 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=eJxvofia; spf=none (imf03.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690989258; a=rsa-sha256; cv=none; b=Y/eZzFoW45ptbsXrVwnGsgkgwgT3oORaTSdPy+5pmLfDJpYczRMA9K3CxYKOwm7j7dIfub ry5zVY/QYK7sODKFdnYXr+aclIN4r4rzxNjxfrHOWu1iWz5ycDOMAHIi9oEe/HLLMBRgF/ hSboAPdmZ/GAlg+luzv0YaUTzRZN+/k= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=eJxvofia; spf=none (imf03.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690989258; 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=R3CnonFRN2u5W8MlfJcV+Jd6s/k7prD5kgGz6X6tBLU=; b=QhvavINkGMkYi2IrkMt9uMBrJL8JM7iSEnCWiNOuQBgUh9iZCa1vzEjX5ACkFwmqwsn+qv YeiHHEsxCQhiEWgNV0haLzmYbCJUYPVnrMIaJ3J2/5SxiJ1/V5GPKZesq7TY54kqju+PjA aDoLbbrUrDDChtSQ/oxurAeEVe5GDnI= 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=R3CnonFRN2u5W8MlfJcV+Jd6s/k7prD5kgGz6X6tBLU=; b=eJxvofiaiVVpJGOwTLrJBXPqtx YeGLbjO+66A9eQXkKLJvSSgGpGRqHqJW2p6xP5A+NnqhKA35wO5us0jNM48rUxepNHyniKc/GQIRF T2d8QpgiQwVgyOCyCbWxM8qC7LLIxTlEBe0Bd4+sYNJZUADQTchzH4mMeybT9BDl3bzIvAUky2wzj G6IfdyXgo8ZqBkN9o8RGnN1AwC4ASpbysL0Ye6gA88NsKro0G0L8S25Ge4HNFQfZ1WbgEa1RRpxXV dGIx765omd7Rb0ty/utbJZ+C/DxmGoH0RyGv6CFLSZDOfpM0+XOp5Z55fUsDy9Djqem48uAhnQ6wy ppDtCirw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qRDY9-00Ffjh-KV; Wed, 02 Aug 2023 15:14:09 +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 v6 16/38] microblaze: Implement the new page table range API Date: Wed, 2 Aug 2023 16:13:44 +0100 Message-Id: <20230802151406.3735276-17-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230802151406.3735276-1-willy@infradead.org> References: <20230802151406.3735276-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 0B37020029 X-Stat-Signature: byt1rftyumuoxyxu6obeyiy57kfo1y46 X-Rspam-User: X-HE-Tag: 1690989257-983557 X-HE-Meta: U2FsdGVkX187oBd2ExcZH0KW4kDWOv4HFfnzAwsWo28SA2zFF6IrKBWZ1IH2aPzjen4q0kzHJKaoNMyXP6PQ3Zt6hb2CrA65q2aDSRHyy4LV7sh9+aADZhlqMig+3rbS840SWru1tewMYuehg2mcvgGcN4Wz6+I2C5u9hrSzZxI2O7SJEtZRLlo/GGvi/CtsJ99W823uBHv2RuYGiYMbT62r66Uk9MXRgOKbWhu3jlme6HnfP2hArVgsXopKwcmwlvVxYP1N/ybUM7HXu8KT7P7wK4qISJxuoEhy/47vmoj93N9FOFzFmBvIR/bL2c2QKy6ND+h/ZmW3/3yAd+p+J4Lb24zbGRgavzpIhAYsqWiv5PQWIMua3kh3RShEBVuUU3xcnKECRMrSsjPU5NDPTgdK0X6rV+4Gxy7lPQPuV4tHLjqHSR8GPmCko7wnPjGIYg+TCcvjrn70SNfFFzQlT5x/TnqkF9r8r/QdhDRZSioXUOPsX3jt3PAG8PxicSFU0CcExV5DZWmQ1iaRufBc0cM4dZX0v5ArbSK2bnoArKtTuFcBaGmDZnpx7eVz51lFzG1zQrZoP0vfLWuELZEQn8VHLkkEMgM8hT7V4DTXzqbeYUDAmBiLL0Uu5mQNG+Cl6h10Lfm/BoWBxmo2l1GqLJELqbiTb4ZSZOzEc1LRP7u/vIjzJFCfC3P4GQX4YalCxcjksZor5MQYnjZjtpH30G0WthjAaFy6chigtwnv5DxlLGaq/J5nyjVIOGhxGdJK4DTSzYNY2LVUluqzGmjUadr0EsU9tGzecR4EbZNCt9BK6ThKN+zL8xsdjI5J9NJ4by9NextReBX3husZZgrdTD0zamh3678/LZ6ynIA7jb0hRCEWqeM5AvxO2CSBa0o4Dum1dbXU2nvcLqo/TF5QbulMFWI1wq6btxu10zrXjfjNfWpx6cZ8ld41Q0TRtRpzkZ0ddlv8739lHftsqCO XpSzZ17e f4cRI86knLbPEQSDos8D+OknSgDkkCCJ+6xqGY8LaQj8Sf6JiRWBB8/jm3Tj7OpfQHvFSwiiuuZtyThI9WuzegXGsVOcMDqqpzPILBu1ndBZL7f/uXyejcXnIK27cv5OkqInogIlm/d+X1Xzz2U4256GwUOCkGBUqwOVgKKmJn76k1zDrfxwHRBwsqYf9HZXlDkEXlK4sMj9X+7VszglMffYCLjZ0Lty6Fvt2JzP3ee/F/5lsC+TMdpVXPc4slwAHCXfqYn3m/TWXInSOiT0qIpWql8Ct/F8KI+MGjsizeJyem+o= 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: 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