From: Thomas Gleixner <tglx@linutronix•de>
To: LKML <linux-kernel@vger•kernel.org>
Cc: Juri Lelli <juri.lelli@redhat•com>,
linux-xtensa@linux-xtensa•org,
Peter Zijlstra <peterz@infradead•org>,
Sebastian Andrzej Siewior <bigeasy@linutronix•de>,
Ben Segall <bsegall@google•com>,
linux-mm@kvack•org, Guo Ren <guoren@kernel•org>,
sparclinux@vger•kernel.org, Vincent Chen <deanbo422@gmail•com>,
Ingo Molnar <mingo@kernel•org>,
linux-arch@vger•kernel.org,
Vincent Guittot <vincent.guittot@linaro•org>,
Herbert Xu <herbert@gondor•apana.org.au>,
x86@kernel•org, Russell King <linux@armlinux•org.uk>,
linux-csky@vger•kernel.org, Christoph Hellwig <hch@lst•de>,
David Airlie <airlied@linux•ie>, Mel Gorman <mgorman@suse•de>,
linux-snps-arc@lists•infradead.org,
Ard Biesheuvel <ardb@kernel•org>,
Paul McKenney <paulmck@kernel•org>,
linuxppc-dev@lists•ozlabs.org,
Steven Rostedt <rostedt@goodmis•org>,
Linus Torvalds <torvalds@linuxfoundation•org>,
Greentime Hu <green.hu@gmail•com>,
Dietmar Eggemann <dietmar.eggemann@arm•com>,
linux-arm-kernel@lists•infradead.org,
Chris Zankel <chris@zankel•net>, Michal Simek <monstr@monstr•eu>,
Thomas Bogendoerfer <tsbogend@alpha•franken.de>,
Nick Hu <nickhu@andestech•com>, Max Filippov <jcmvbkbc@gmail•com>,
Vineet Gupta <vgupta@synopsys•com>,
linux-mips@vger•kernel.org, Arnd Bergmann <arnd@arndb•de>,
Daniel Vetter <daniel@ffwll•ch>,
Paul Mackerras <paulus@samba•org>,
Andrew Morton <akpm@linux-foundation•org>,
Daniel Bristot de Oliveira <bristot@redhat•com>,
"David S. Miller" <davem@davemloft•net>
Subject: [patch V2 07/18] csky/mm/highmem: Switch to generic kmap atomic
Date: Thu, 29 Oct 2020 23:18:13 +0100 [thread overview]
Message-ID: <20201029222651.303553207@linutronix.de> (raw)
In-Reply-To: 20201029221806.189523375@linutronix.de
No reason having the same code in every architecture.
Signed-off-by: Thomas Gleixner <tglx@linutronix•de>
Acked-by: Guo Ren <guoren@kernel•org>
Cc: linux-csky@vger•kernel.org
---
arch/csky/Kconfig | 1
arch/csky/include/asm/highmem.h | 4 +-
arch/csky/mm/highmem.c | 75 ----------------------------------------
3 files changed, 5 insertions(+), 75 deletions(-)
--- a/arch/csky/Kconfig
+++ b/arch/csky/Kconfig
@@ -286,6 +286,7 @@ config NR_CPUS
config HIGHMEM
bool "High Memory Support"
depends on !CPU_CK610
+ select KMAP_LOCAL
default y
config FORCE_MAX_ZONEORDER
--- a/arch/csky/include/asm/highmem.h
+++ b/arch/csky/include/asm/highmem.h
@@ -32,10 +32,12 @@ extern pte_t *pkmap_page_table;
#define ARCH_HAS_KMAP_FLUSH_TLB
extern void kmap_flush_tlb(unsigned long addr);
-extern void *kmap_atomic_pfn(unsigned long pfn);
#define flush_cache_kmaps() do {} while (0)
+#define arch_kmap_local_post_map(vaddr, pteval) kmap_flush_tlb(vaddr)
+#define arch_kmap_local_post_unmap(vaddr) kmap_flush_tlb(vaddr)
+
extern void kmap_init(void);
#endif /* __KERNEL__ */
--- a/arch/csky/mm/highmem.c
+++ b/arch/csky/mm/highmem.c
@@ -9,8 +9,6 @@
#include <asm/tlbflush.h>
#include <asm/cacheflush.h>
-static pte_t *kmap_pte;
-
unsigned long highstart_pfn, highend_pfn;
void kmap_flush_tlb(unsigned long addr)
@@ -19,67 +17,7 @@ void kmap_flush_tlb(unsigned long addr)
}
EXPORT_SYMBOL(kmap_flush_tlb);
-void *kmap_atomic_high_prot(struct page *page, pgprot_t prot)
-{
- unsigned long vaddr;
- int idx, type;
-
- type = kmap_atomic_idx_push();
- idx = type + KM_TYPE_NR*smp_processor_id();
- vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
-#ifdef CONFIG_DEBUG_HIGHMEM
- BUG_ON(!pte_none(*(kmap_pte - idx)));
-#endif
- set_pte(kmap_pte-idx, mk_pte(page, prot));
- flush_tlb_one((unsigned long)vaddr);
-
- return (void *)vaddr;
-}
-EXPORT_SYMBOL(kmap_atomic_high_prot);
-
-void kunmap_atomic_high(void *kvaddr)
-{
- unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
- int idx;
-
- if (vaddr < FIXADDR_START)
- return;
-
-#ifdef CONFIG_DEBUG_HIGHMEM
- idx = KM_TYPE_NR*smp_processor_id() + kmap_atomic_idx();
-
- BUG_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx));
-
- pte_clear(&init_mm, vaddr, kmap_pte - idx);
- flush_tlb_one(vaddr);
-#else
- (void) idx; /* to kill a warning */
-#endif
- kmap_atomic_idx_pop();
-}
-EXPORT_SYMBOL(kunmap_atomic_high);
-
-/*
- * This is the same as kmap_atomic() but can map memory that doesn't
- * have a struct page associated with it.
- */
-void *kmap_atomic_pfn(unsigned long pfn)
-{
- unsigned long vaddr;
- int idx, type;
-
- pagefault_disable();
-
- type = kmap_atomic_idx_push();
- idx = type + KM_TYPE_NR*smp_processor_id();
- vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
- set_pte(kmap_pte-idx, pfn_pte(pfn, PAGE_KERNEL));
- flush_tlb_one(vaddr);
-
- return (void *) vaddr;
-}
-
-static void __init kmap_pages_init(void)
+void __init kmap_init(void)
{
unsigned long vaddr;
pgd_t *pgd;
@@ -96,14 +34,3 @@ static void __init kmap_pages_init(void)
pte = pte_offset_kernel(pmd, vaddr);
pkmap_page_table = pte;
}
-
-void __init kmap_init(void)
-{
- unsigned long vaddr;
-
- kmap_pages_init();
-
- vaddr = __fix_to_virt(FIX_KMAP_BEGIN);
-
- kmap_pte = pte_offset_kernel((pmd_t *)pgd_offset_k(vaddr), vaddr);
-}
next prev parent reply other threads:[~2020-10-29 22:46 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-29 22:18 [patch V2 00/18] mm/highmem: Preemptible variant of kmap_atomic & friends Thomas Gleixner
2020-10-29 22:18 ` [patch V2 01/18] sched: Make migrate_disable/enable() independent of RT Thomas Gleixner
2020-10-29 22:18 ` [patch V2 02/18] mm/highmem: Un-EXPORT __kmap_atomic_idx() Thomas Gleixner
2020-10-29 22:18 ` [patch V2 03/18] highmem: Provide generic variant of kmap_atomic* Thomas Gleixner
2020-10-29 23:46 ` Test Results: RE: [V2,03/18] " snowpatch
2020-10-29 22:18 ` [patch V2 04/18] x86/mm/highmem: Use generic kmap atomic implementation Thomas Gleixner
2020-10-29 22:18 ` [patch V2 05/18] arc/mm/highmem: " Thomas Gleixner
2020-10-29 23:44 ` Test Results: RE: [V2, " snowpatch
2020-10-29 22:18 ` [patch V2 06/18] ARM: highmem: Switch to generic kmap atomic Thomas Gleixner
2020-10-29 23:40 ` Test Results: RE: [V2,06/18] " snowpatch
2020-10-29 22:18 ` Thomas Gleixner [this message]
2020-10-29 23:42 ` Test Results: RE: [V2, 07/18] csky/mm/highmem: " snowpatch
2020-10-29 22:18 ` [patch V2 08/18] microblaze/mm/highmem: " Thomas Gleixner
2020-10-29 23:38 ` Test Results: RE: [V2,08/18] " snowpatch
2020-10-29 22:18 ` [patch V2 09/18] mips/mm/highmem: " Thomas Gleixner
2020-10-29 23:36 ` Test Results: RE: [V2, " snowpatch
2020-10-29 22:18 ` [patch V2 10/18] nds32/mm/highmem: " Thomas Gleixner
2020-10-29 23:33 ` Test Results: RE: [V2,10/18] " snowpatch
2020-10-29 22:18 ` [patch V2 11/18] powerpc/mm/highmem: " Thomas Gleixner
2020-10-29 23:31 ` Test Results: RE: [V2,11/18] " snowpatch
2020-10-29 22:18 ` [patch V2 12/18] sparc/mm/highmem: " Thomas Gleixner
2020-10-29 23:29 ` Test Results: RE: [V2,12/18] " snowpatch
2020-10-29 22:18 ` [patch V2 13/18] xtensa/mm/highmem: " Thomas Gleixner
2020-10-29 23:26 ` Test Results: RE: [V2,13/18] " snowpatch
2020-10-29 22:18 ` [patch V2 14/18] mm/highmem: Remove the old kmap_atomic cruft Thomas Gleixner
2020-10-29 23:22 ` Test Results: RE: [V2,14/18] " snowpatch
2020-10-29 22:18 ` [patch V2 15/18] io-mapping: Cleanup atomic iomap Thomas Gleixner
2020-10-29 23:20 ` Test Results: RE: [V2,15/18] " snowpatch
2020-10-29 22:18 ` [patch V2 16/18] sched: highmem: Store local kmaps in task struct Thomas Gleixner
2020-10-29 23:24 ` Test Results: RE: [V2,16/18] " snowpatch
2020-10-29 22:18 ` [patch V2 17/18] mm/highmem: Provide kmap_local* Thomas Gleixner
2020-10-29 23:18 ` Test Results: RE: [V2,17/18] " snowpatch
2020-10-29 22:18 ` [patch V2 18/18] io-mapping: Provide iomap_local variant Thomas Gleixner
2020-10-29 23:16 ` Test Results: RE: [V2,18/18] " snowpatch
2020-10-29 23:11 ` [patch V2 00/18] mm/highmem: Preemptible variant of kmap_atomic & friends Linus Torvalds
2020-10-29 23:41 ` Thomas Gleixner
2020-10-30 9:39 ` Thomas Gleixner
2020-10-30 20:28 ` Linus Torvalds
2020-10-30 22:26 ` Thomas Gleixner
2020-10-30 22:46 ` Linus Torvalds
2020-10-30 23:26 ` Thomas Gleixner
2020-10-30 23:53 ` Thomas Gleixner
2020-10-31 13:37 ` Arnd Bergmann
2020-10-31 15:05 ` Christophe Leroy
2020-10-31 21:33 ` Arnd Bergmann
2020-10-30 7:25 ` Christoph Hellwig
2020-10-30 9:39 ` Thomas Gleixner
2020-10-30 13:06 ` Matthew Wilcox
2020-10-30 19:35 ` Thomas Gleixner
2020-11-02 1:08 ` Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201029222651.303553207@linutronix.de \
--to=tglx@linutronix$(echo .)de \
--cc=airlied@linux$(echo .)ie \
--cc=akpm@linux-foundation$(echo .)org \
--cc=ardb@kernel$(echo .)org \
--cc=arnd@arndb$(echo .)de \
--cc=bigeasy@linutronix$(echo .)de \
--cc=bristot@redhat$(echo .)com \
--cc=bsegall@google$(echo .)com \
--cc=chris@zankel$(echo .)net \
--cc=daniel@ffwll$(echo .)ch \
--cc=davem@davemloft$(echo .)net \
--cc=deanbo422@gmail$(echo .)com \
--cc=dietmar.eggemann@arm$(echo .)com \
--cc=green.hu@gmail$(echo .)com \
--cc=guoren@kernel$(echo .)org \
--cc=hch@lst$(echo .)de \
--cc=herbert@gondor$(echo .)apana.org.au \
--cc=jcmvbkbc@gmail$(echo .)com \
--cc=juri.lelli@redhat$(echo .)com \
--cc=linux-arch@vger$(echo .)kernel.org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-csky@vger$(echo .)kernel.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-mips@vger$(echo .)kernel.org \
--cc=linux-mm@kvack$(echo .)org \
--cc=linux-snps-arc@lists$(echo .)infradead.org \
--cc=linux-xtensa@linux-xtensa$(echo .)org \
--cc=linux@armlinux$(echo .)org.uk \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=mgorman@suse$(echo .)de \
--cc=mingo@kernel$(echo .)org \
--cc=monstr@monstr$(echo .)eu \
--cc=nickhu@andestech$(echo .)com \
--cc=paulmck@kernel$(echo .)org \
--cc=paulus@samba$(echo .)org \
--cc=peterz@infradead$(echo .)org \
--cc=rostedt@goodmis$(echo .)org \
--cc=sparclinux@vger$(echo .)kernel.org \
--cc=torvalds@linuxfoundation$(echo .)org \
--cc=tsbogend@alpha$(echo .)franken.de \
--cc=vgupta@synopsys$(echo .)com \
--cc=vincent.guittot@linaro$(echo .)org \
--cc=x86@kernel$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox