From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0A87C2D0FE for ; Wed, 13 May 2020 11:20:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9699E2078C for ; Wed, 13 May 2020 11:20:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rVsNhV/V" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9699E2078C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=eaBZx6rpFsd6gadC20xELSAIBp13qhxZvmd5dR6SuLs=; b=rVsNhV/VQKFd9D Vhi/iuDw/KlLj9OMz9Sr4DFevFrMwW9QmdeOepQVw3TBfHP0G6ipzFohwdy2oN/bcyb7FoNW2PZ0Z aBqf6pN35mfDF1pM40dPUjZ1jqtjDObknFgDAfMWHvUuyDojf3Tk6uvBROE7/PNa3aVf6eUu579L3 EDdsDplXPzJabYMf4Q7qdLHa5jdB8CCOASNS+eSSvK+lZgvxOHsqCUxgHnA6vEDxyS2DpaASF6BRI ZjSipQuNoX6T4ZauIsK5W8qQ+pI7dGtsC70jq5CZP7rMA7nevTYCCJiX/1GAT04DJXbEyRRU562hm Arf5Lk0Tvz4D/Hex6kXw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jYpQr-0003Dx-1k; Wed, 13 May 2020 11:20:13 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jYpQn-0002dj-6r; Wed, 13 May 2020 11:20:11 +0000 Received: from [10.44.0.192] (unknown [103.48.210.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B2F70206E5; Wed, 13 May 2020 11:19:49 +0000 (UTC) Subject: Re: [PATCH 06/12] m68k/mm: move {cache,nocahe}_page() definitions close to their user To: Mike Rapoport , linux-kernel@vger.kernel.org References: <20200512184422.12418-1-rppt@kernel.org> <20200512184422.12418-7-rppt@kernel.org> From: Greg Ungerer Message-ID: Date: Wed, 13 May 2020 21:19:45 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200512184422.12418-7-rppt@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200513_042009_309918_20220ABE X-CRM114-Status: GOOD ( 22.31 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rich Felker , linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, Catalin Marinas , Heiko Carstens , Max Filippov , Guo Ren , linux-csky@vger.kernel.org, sparclinux@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-riscv@lists.infradead.org, Vincent Chen , Will Deacon , Thomas Gleixner , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, linux-c6x-dev@linux-c6x.org, Brian Cain , Michael Ellerman , Helge Deller , x86@kernel.org, Russell King , Ley Foon Tan , Mike Rapoport , Ingo Molnar , Geert Uytterhoeven , linux-parisc@vger.kernel.org, Mark Salter , Matt Turner , linux-snps-arc@lists.infradead.org, linux-xtensa@linux-xtensa.org, Arnd Bergmann , linux-alpha@vger.kernel.org, linux-um@lists.infradead.org, linux-m68k@lists.linux-m68k.org, Tony Luck , Borislav Petkov , Greentime Hu , Paul Walmsley , Stafford Horne , Guan Xuetao , linux-arm-kernel@lists.infradead.org, Chris Zankel , Michal Simek , Thomas Bogendoerfer , Yoshinori Sato , Nick Hu , linux-mm@kvack.org, Vineet Gupta , linux-mips@vger.kernel.org, openrisc@lists.librecores.org, Richard Weinberger , Andrew Morton , linuxppc-dev@lists.ozlabs.org, "David S. Miller" Sender: "linux-riscv" Errors-To: linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org Hi Mike, On 13/5/20 4:44 am, Mike Rapoport wrote: > From: Mike Rapoport > > The cache_page() and nocache_page() functions are only used by the morotola ^^^^^^^^ motorola > MMU variant for setting caching attributes for the page table pages. > > Move the definitions of these functions from > arch/m68k/include/asm/motorola_pgtable.h closer to their usage in > arch/m68k/mm/motorola.c and drop unused definition in > arch/m68k/include/asm/mcf_pgtable.h. > > Signed-off-by: Mike Rapoport Acked-by: Greg Ungerer Regards Greg > --- > arch/m68k/include/asm/mcf_pgtable.h | 40 --------------------- > arch/m68k/include/asm/motorola_pgtable.h | 44 ------------------------ > arch/m68k/mm/motorola.c | 43 +++++++++++++++++++++++ > 3 files changed, 43 insertions(+), 84 deletions(-) > > diff --git a/arch/m68k/include/asm/mcf_pgtable.h b/arch/m68k/include/asm/mcf_pgtable.h > index 0031cd387b75..737e826294f3 100644 > --- a/arch/m68k/include/asm/mcf_pgtable.h > +++ b/arch/m68k/include/asm/mcf_pgtable.h > @@ -328,46 +328,6 @@ extern pgd_t kernel_pg_dir[PTRS_PER_PGD]; > #define pte_offset_kernel(dir, address) \ > ((pte_t *) __pmd_page(*(dir)) + __pte_offset(address)) > > -/* > - * Disable caching for page at given kernel virtual address. > - */ > -static inline void nocache_page(void *vaddr) > -{ > - pgd_t *dir; > - p4d_t *p4dp; > - pud_t *pudp; > - pmd_t *pmdp; > - pte_t *ptep; > - unsigned long addr = (unsigned long) vaddr; > - > - dir = pgd_offset_k(addr); > - p4dp = p4d_offset(dir, addr); > - pudp = pud_offset(p4dp, addr); > - pmdp = pmd_offset(pudp, addr); > - ptep = pte_offset_kernel(pmdp, addr); > - *ptep = pte_mknocache(*ptep); > -} > - > -/* > - * Enable caching for page at given kernel virtual address. > - */ > -static inline void cache_page(void *vaddr) > -{ > - pgd_t *dir; > - p4d_t *p4dp; > - pud_t *pudp; > - pmd_t *pmdp; > - pte_t *ptep; > - unsigned long addr = (unsigned long) vaddr; > - > - dir = pgd_offset_k(addr); > - p4dp = p4d_offset(dir, addr); > - pudp = pud_offset(p4dp, addr); > - pmdp = pmd_offset(pudp, addr); > - ptep = pte_offset_kernel(pmdp, addr); > - *ptep = pte_mkcache(*ptep); > -} > - > /* > * Encode and de-code a swap entry (must be !pte_none(e) && !pte_present(e)) > */ > diff --git a/arch/m68k/include/asm/motorola_pgtable.h b/arch/m68k/include/asm/motorola_pgtable.h > index 9e5a3de21e15..e1594acf7c7e 100644 > --- a/arch/m68k/include/asm/motorola_pgtable.h > +++ b/arch/m68k/include/asm/motorola_pgtable.h > @@ -227,50 +227,6 @@ static inline pte_t *pte_offset_kernel(pmd_t *pmdp, unsigned long address) > #define pte_offset_map(pmdp,address) ((pte_t *)__pmd_page(*pmdp) + (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) > #define pte_unmap(pte) ((void)0) > > -/* Prior to calling these routines, the page should have been flushed > - * from both the cache and ATC, or the CPU might not notice that the > - * cache setting for the page has been changed. -jskov > - */ > -static inline void nocache_page(void *vaddr) > -{ > - unsigned long addr = (unsigned long)vaddr; > - > - if (CPU_IS_040_OR_060) { > - pgd_t *dir; > - p4d_t *p4dp; > - pud_t *pudp; > - pmd_t *pmdp; > - pte_t *ptep; > - > - dir = pgd_offset_k(addr); > - p4dp = p4d_offset(dir, addr); > - pudp = pud_offset(p4dp, addr); > - pmdp = pmd_offset(pudp, addr); > - ptep = pte_offset_kernel(pmdp, addr); > - *ptep = pte_mknocache(*ptep); > - } > -} > - > -static inline void cache_page(void *vaddr) > -{ > - unsigned long addr = (unsigned long)vaddr; > - > - if (CPU_IS_040_OR_060) { > - pgd_t *dir; > - p4d_t *p4dp; > - pud_t *pudp; > - pmd_t *pmdp; > - pte_t *ptep; > - > - dir = pgd_offset_k(addr); > - p4dp = p4d_offset(dir, addr); > - pudp = pud_offset(p4dp, addr); > - pmdp = pmd_offset(pudp, addr); > - ptep = pte_offset_kernel(pmdp, addr); > - *ptep = pte_mkcache(*ptep); > - } > -} > - > /* Encode and de-code a swap entry (must be !pte_none(e) && !pte_present(e)) */ > #define __swp_type(x) (((x).val >> 4) & 0xff) > #define __swp_offset(x) ((x).val >> 12) > diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c > index 904c2a663977..8e5e74121a78 100644 > --- a/arch/m68k/mm/motorola.c > +++ b/arch/m68k/mm/motorola.c > @@ -45,6 +45,49 @@ unsigned long mm_cachebits; > EXPORT_SYMBOL(mm_cachebits); > #endif > > +/* Prior to calling these routines, the page should have been flushed > + * from both the cache and ATC, or the CPU might not notice that the > + * cache setting for the page has been changed. -jskov > + */ > +static inline void nocache_page(void *vaddr) > +{ > + unsigned long addr = (unsigned long)vaddr; > + > + if (CPU_IS_040_OR_060) { > + pgd_t *dir; > + p4d_t *p4dp; > + pud_t *pudp; > + pmd_t *pmdp; > + pte_t *ptep; > + > + dir = pgd_offset_k(addr); > + p4dp = p4d_offset(dir, addr); > + pudp = pud_offset(p4dp, addr); > + pmdp = pmd_offset(pudp, addr); > + ptep = pte_offset_kernel(pmdp, addr); > + *ptep = pte_mknocache(*ptep); > + } > +} > + > +static inline void cache_page(void *vaddr) > +{ > + unsigned long addr = (unsigned long)vaddr; > + > + if (CPU_IS_040_OR_060) { > + pgd_t *dir; > + p4d_t *p4dp; > + pud_t *pudp; > + pmd_t *pmdp; > + pte_t *ptep; > + > + dir = pgd_offset_k(addr); > + p4dp = p4d_offset(dir, addr); > + pudp = pud_offset(p4dp, addr); > + pmdp = pmd_offset(pudp, addr); > + ptep = pte_offset_kernel(pmdp, addr); > + *ptep = pte_mkcache(*ptep); > + } > +} > > /* > * Motorola 680x0 user's manual recommends using uncached memory for address >