public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix•de>
To: LKML <linux-kernel@vger•kernel.org>
Cc: Juri Lelli <juri.lelli@redhat•com>,
	linux-aio@kvack•org, Peter Zijlstra <peterz@infradead•org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix•de>,
	Joonas Lahtinen <joonas.lahtinen@linux•intel.com>,
	dri-devel@lists•freedesktop.org,
	virtualization@lists•linux-foundation.org,
	Ben Segall <bsegall@google•com>, Chris Mason <clm@fb•com>,
	Huang Rui <ray.huang@amd•com>, Paul Mackerras <paulus@samba•org>,
	Gerd Hoffmann <kraxel@redhat•com>,
	Daniel Bristot de Oliveira <bristot@redhat•com>,
	sparclinux@vger•kernel.org, Vincent Chen <deanbo422@gmail•com>,
	Christoph Hellwig <hch@lst•de>,
	Vincent Guittot <vincent.guittot@linaro•org>,
	Paul McKenney <paulmck@kernel•org>,
	Max Filippov <jcmvbkbc@gmail•com>,
	x86@kernel•org, Russell King <linux@armlinux•org.uk>,
	linux-csky@vger•kernel.org, Ingo Molnar <mingo@kernel•org>,
	David Airlie <airlied@linux•ie>,
	VMware Graphics <linux-graphics-maintainer@vmware•com>,
	Mel Gorman <mgorman@suse•de>,
	nouveau@lists•freedesktop.org, Dave Airlie <airlied@redhat•com>,
	linux-snps-arc@lists•infradead.org,
	Ben Skeggs <bskeggs@redhat•com>,
	linux-xtensa@linux-xtensa•org, Arnd Bergmann <arnd@arndb•de>,
	intel-gfx@lists•freedesktop.org,
	Roland Scheidegger <sroland@vmware•com>,
	Josef Bacik <josef@toxicpanda•com>,
	Steven Rostedt <rostedt@goodmis•org>,
	Linus Torvalds <torvalds@linuxfoundation•org>,
	Alexander Viro <viro@zeniv•linux.org.uk>,
	spice-devel@lists•freedesktop.org,
	David Sterba <dsterba@suse•com>,
	Rodrigo Vivi <rodrigo.vivi@intel•com>,
	Dietmar Eggemann <dietmar.eggemann@arm•com>,
	linux-arm-kernel@lists•infradead.org,
	Jani Nikula <jani.nikula@linux•intel.com>,
	Chris Zankel <chris@zankel•net>, Michal Simek <monstr@monstr•eu>,
	Thomas Bogendoerfer <tsbogend@alpha•franken.de>,
	Nick Hu <nickhu@andestech•com>,
	linux-mm@kvack•org, Vineet Gupta <vgupta@synopsys•com>,
	linux-mips@vger•kernel.org,
	Christian Koenig <christian.koenig@amd•com>,
	Benjamin LaHaise <bcrl@kvack•org>,
	Daniel Vetter <daniel@ffwll•ch>,
	linux-fsdevel@vger•kernel.org,
	Andrew Morton <akpm@linux-foundation•org>,
	linuxppc-dev@lists•ozlabs.org,
	"David S. Miller" <davem@davemloft•net>,
	linux-btrfs@vger•kernel.org, Greentime Hu <green.hu@gmail•com>
Subject: [patch V3 12/37] microblaze/mm/highmem: Switch to generic kmap atomic
Date: Tue, 03 Nov 2020 10:27:24 +0100	[thread overview]
Message-ID: <20201103095857.777445435@linutronix.de> (raw)
In-Reply-To: 20201103092712.714480842@linutronix.de

No reason having the same code in every architecture.

Signed-off-by: Thomas Gleixner <tglx@linutronix•de>
Cc: Michal Simek <monstr@monstr•eu>
---
V3: Remove the kmap types cruft
---
 arch/microblaze/Kconfig               |    1 
 arch/microblaze/include/asm/fixmap.h  |    4 -
 arch/microblaze/include/asm/highmem.h |    6 ++
 arch/microblaze/mm/Makefile           |    1 
 arch/microblaze/mm/highmem.c          |   78 ----------------------------------
 arch/microblaze/mm/init.c             |    6 --
 6 files changed, 8 insertions(+), 88 deletions(-)

--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -155,6 +155,7 @@ config XILINX_UNCACHED_SHADOW
 config HIGHMEM
 	bool "High memory support"
 	depends on MMU
+	select KMAP_LOCAL
 	help
 	  The address space of Microblaze processors is only 4 Gigabytes large
 	  and it has to accommodate user address space, kernel address
--- a/arch/microblaze/include/asm/fixmap.h
+++ b/arch/microblaze/include/asm/fixmap.h
@@ -20,7 +20,7 @@
 #include <asm/page.h>
 #ifdef CONFIG_HIGHMEM
 #include <linux/threads.h>
-#include <asm/kmap_types.h>
+#include <asm/kmap_size.h>
 #endif
 
 #define FIXADDR_TOP	((unsigned long)(-PAGE_SIZE))
@@ -47,7 +47,7 @@ enum fixed_addresses {
 	FIX_HOLE,
 #ifdef CONFIG_HIGHMEM
 	FIX_KMAP_BEGIN,	/* reserved pte's for temporary kernel mappings */
-	FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_TYPE_NR * num_possible_cpus()) - 1,
+	FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_MAX_IDX * num_possible_cpus()) - 1,
 #endif
 	__end_of_fixed_addresses
 };
--- a/arch/microblaze/include/asm/highmem.h
+++ b/arch/microblaze/include/asm/highmem.h
@@ -25,7 +25,6 @@
 #include <linux/uaccess.h>
 #include <asm/fixmap.h>
 
-extern pte_t *kmap_pte;
 extern pte_t *pkmap_page_table;
 
 /*
@@ -52,6 +51,11 @@ extern pte_t *pkmap_page_table;
 
 #define flush_cache_kmaps()	{ flush_icache(); flush_dcache(); }
 
+#define arch_kmap_local_post_map(vaddr, pteval)	\
+	local_flush_tlb_page(NULL, vaddr);
+#define arch_kmap_local_post_unmap(vaddr)	\
+	local_flush_tlb_page(NULL, vaddr);
+
 #endif /* __KERNEL__ */
 
 #endif /* _ASM_HIGHMEM_H */
--- a/arch/microblaze/mm/Makefile
+++ b/arch/microblaze/mm/Makefile
@@ -6,4 +6,3 @@
 obj-y := consistent.o init.o
 
 obj-$(CONFIG_MMU) += pgtable.o mmu_context.o fault.o
-obj-$(CONFIG_HIGHMEM) += highmem.o
--- a/arch/microblaze/mm/highmem.c
+++ /dev/null
@@ -1,78 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * highmem.c: virtual kernel memory mappings for high memory
- *
- * PowerPC version, stolen from the i386 version.
- *
- * Used in CONFIG_HIGHMEM systems for memory pages which
- * are not addressable by direct kernel virtual addresses.
- *
- * Copyright (C) 1999 Gerhard Wichert, Siemens AG
- *		      Gerhard.Wichert@pdb•siemens.de
- *
- *
- * Redesigned the x86 32-bit VM architecture to deal with
- * up to 16 Terrabyte physical memory. With current x86 CPUs
- * we now support up to 64 Gigabytes physical RAM.
- *
- * Copyright (C) 1999 Ingo Molnar <mingo@redhat•com>
- *
- * Reworked for PowerPC by various contributors. Moved from
- * highmem.h by Benjamin Herrenschmidt (c) 2009 IBM Corp.
- */
-
-#include <linux/export.h>
-#include <linux/highmem.h>
-
-/*
- * The use of kmap_atomic/kunmap_atomic is discouraged - kmap/kunmap
- * gives a more generic (and caching) interface. But kmap_atomic can
- * be used in IRQ contexts, so in some (very limited) cases we need
- * it.
- */
-#include <asm/tlbflush.h>
-
-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_at(&init_mm, vaddr, kmap_pte-idx, mk_pte(page, prot));
-	local_flush_tlb_page(NULL, 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 type;
-	unsigned int idx;
-
-	if (vaddr < __fix_to_virt(FIX_KMAP_END))
-		return;
-
-	type = kmap_atomic_idx();
-
-	idx = type + KM_TYPE_NR * smp_processor_id();
-#ifdef CONFIG_DEBUG_HIGHMEM
-	BUG_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx));
-#endif
-	/*
-	 * force other mappings to Oops if they'll try to access
-	 * this pte without first remap it
-	 */
-	pte_clear(&init_mm, vaddr, kmap_pte-idx);
-	local_flush_tlb_page(NULL, vaddr);
-
-	kmap_atomic_idx_pop();
-}
-EXPORT_SYMBOL(kunmap_atomic_high);
--- a/arch/microblaze/mm/init.c
+++ b/arch/microblaze/mm/init.c
@@ -49,17 +49,11 @@ unsigned long lowmem_size;
 EXPORT_SYMBOL(min_low_pfn);
 EXPORT_SYMBOL(max_low_pfn);
 
-#ifdef CONFIG_HIGHMEM
-pte_t *kmap_pte;
-EXPORT_SYMBOL(kmap_pte);
-
 static void __init highmem_init(void)
 {
 	pr_debug("%x\n", (u32)PKMAP_BASE);
 	map_page(PKMAP_BASE, 0, 0);	/* XXX gross */
 	pkmap_page_table = virt_to_kpte(PKMAP_BASE);
-
-	kmap_pte = virt_to_kpte(__fix_to_virt(FIX_KMAP_BEGIN));
 }
 
 static void highmem_setup(void)


  parent reply	other threads:[~2020-11-03 11:36 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-03  9:27 [patch V3 00/37] mm/highmem: Preemptible variant of kmap_atomic & friends Thomas Gleixner
2020-11-03  9:27 ` [patch V3 01/37] mm/highmem: Un-EXPORT __kmap_atomic_idx() Thomas Gleixner
2020-11-03  9:27 ` [patch V3 02/37] highmem: Remove unused functions Thomas Gleixner
2020-11-03  9:27 ` [patch V3 03/37] fs: Remove asm/kmap_types.h includes Thomas Gleixner
2020-11-03 11:12   ` David Sterba
2020-11-03  9:27 ` [patch V3 04/37] sh/highmem: Remove all traces of unused cruft Thomas Gleixner
2020-11-03  9:27 ` [patch V3 05/37] asm-generic: Provide kmap_size.h Thomas Gleixner
2020-11-03 12:25   ` Arnd Bergmann
2020-11-03  9:27 ` [patch V3 06/37] highmem: Provide generic variant of kmap_atomic* Thomas Gleixner
2020-11-03  9:27 ` [patch V3 07/37] highmem: Make DEBUG_HIGHMEM functional Thomas Gleixner
2020-11-03  9:27 ` [patch V3 08/37] x86/mm/highmem: Use generic kmap atomic implementation Thomas Gleixner
2020-11-03  9:27 ` [patch V3 09/37] arc/mm/highmem: " Thomas Gleixner
2020-11-03  9:27 ` [patch V3 10/37] ARM: highmem: Switch to generic kmap atomic Thomas Gleixner
2020-11-12  8:10   ` Marek Szyprowski
2020-11-12 11:03     ` Thomas Gleixner
2020-11-12 11:07     ` Sebastian Andrzej Siewior
2020-11-03  9:27 ` [patch V3 11/37] csky/mm/highmem: " Thomas Gleixner
2020-11-03  9:27 ` Thomas Gleixner [this message]
2020-11-03  9:27 ` [patch V3 13/37] mips/mm/highmem: " Thomas Gleixner
2020-11-03  9:27 ` [patch V3 14/37] nds32/mm/highmem: " Thomas Gleixner
2020-11-03  9:27 ` [patch V3 15/37] powerpc/mm/highmem: " Thomas Gleixner
2020-11-03  9:27 ` [patch V3 16/37] sparc/mm/highmem: " Thomas Gleixner
2020-11-03  9:27 ` [patch V3 17/37] xtensa/mm/highmem: " Thomas Gleixner
2020-11-03  9:27 ` [patch V3 18/37] highmem: Get rid of kmap_types.h Thomas Gleixner
2020-11-03  9:27 ` [patch V3 19/37] mm/highmem: Remove the old kmap_atomic cruft Thomas Gleixner
2020-11-03  9:27 ` [patch V3 20/37] io-mapping: Cleanup atomic iomap Thomas Gleixner
2020-11-03  9:27 ` [patch V3 21/37] Documentation/io-mapping: Remove outdated blurb Thomas Gleixner
2020-11-03  9:27 ` [patch V3 22/37] highmem: High implementation details and document API Thomas Gleixner
2020-11-03 17:48   ` Linus Torvalds
2020-11-03 19:00     ` Thomas Gleixner
2020-11-03  9:27 ` [patch V3 23/37] sched: Make migrate_disable/enable() independent of RT Thomas Gleixner
2020-11-03  9:27 ` [patch V3 24/37] sched: highmem: Store local kmaps in task struct Thomas Gleixner
2020-11-03 13:49   ` Thomas Gleixner
2020-11-03 13:51   ` [patch V4 " Thomas Gleixner
2020-11-03  9:27 ` [patch V3 25/37] mm/highmem: Provide kmap_local* Thomas Gleixner
2020-11-03  9:27 ` [patch V3 26/37] io-mapping: Provide iomap_local variant Thomas Gleixner
2020-11-03  9:27 ` [patch V3 27/37] x86/crashdump/32: Simplify copy_oldmem_page() Thomas Gleixner
2020-11-03  9:27 ` [patch V3 28/37] mips/crashdump: " Thomas Gleixner
2020-11-03  9:27 ` [patch V3 29/37] ARM: mm: Replace kmap_atomic_pfn() Thomas Gleixner
2020-11-03  9:27 ` [patch V3 30/37] highmem: Remove kmap_atomic_pfn() Thomas Gleixner
2020-11-03  9:27 ` [patch V3 31/37] drm/ttm: Replace kmap_atomic() usage Thomas Gleixner
2020-11-03  9:27 ` [patch V3 32/37] drm/vmgfx: Replace kmap_atomic() Thomas Gleixner
2020-11-03  9:27 ` [patch V3 33/37] highmem: Remove kmap_atomic_prot() Thomas Gleixner
2020-11-03  9:27 ` [patch V3 34/37] drm/qxl: Replace io_mapping_map_atomic_wc() Thomas Gleixner
2020-11-03  9:27 ` [patch V3 35/37] drm/nouveau/device: " Thomas Gleixner
2020-11-03  9:27 ` [patch V3 36/37] drm/i915: " Thomas Gleixner
2020-11-03  9:27 ` [patch V3 37/37] io-mapping: Remove io_mapping_map_atomic_wc() 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=20201103095857.777445435@linutronix.de \
    --to=tglx@linutronix$(echo .)de \
    --cc=airlied@linux$(echo .)ie \
    --cc=airlied@redhat$(echo .)com \
    --cc=akpm@linux-foundation$(echo .)org \
    --cc=arnd@arndb$(echo .)de \
    --cc=bcrl@kvack$(echo .)org \
    --cc=bigeasy@linutronix$(echo .)de \
    --cc=bristot@redhat$(echo .)com \
    --cc=bsegall@google$(echo .)com \
    --cc=bskeggs@redhat$(echo .)com \
    --cc=chris@zankel$(echo .)net \
    --cc=christian.koenig@amd$(echo .)com \
    --cc=clm@fb$(echo .)com \
    --cc=daniel@ffwll$(echo .)ch \
    --cc=davem@davemloft$(echo .)net \
    --cc=deanbo422@gmail$(echo .)com \
    --cc=dietmar.eggemann@arm$(echo .)com \
    --cc=dri-devel@lists$(echo .)freedesktop.org \
    --cc=dsterba@suse$(echo .)com \
    --cc=green.hu@gmail$(echo .)com \
    --cc=hch@lst$(echo .)de \
    --cc=intel-gfx@lists$(echo .)freedesktop.org \
    --cc=jani.nikula@linux$(echo .)intel.com \
    --cc=jcmvbkbc@gmail$(echo .)com \
    --cc=joonas.lahtinen@linux$(echo .)intel.com \
    --cc=josef@toxicpanda$(echo .)com \
    --cc=juri.lelli@redhat$(echo .)com \
    --cc=kraxel@redhat$(echo .)com \
    --cc=linux-aio@kvack$(echo .)org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-btrfs@vger$(echo .)kernel.org \
    --cc=linux-csky@vger$(echo .)kernel.org \
    --cc=linux-fsdevel@vger$(echo .)kernel.org \
    --cc=linux-graphics-maintainer@vmware$(echo .)com \
    --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=nouveau@lists$(echo .)freedesktop.org \
    --cc=paulmck@kernel$(echo .)org \
    --cc=paulus@samba$(echo .)org \
    --cc=peterz@infradead$(echo .)org \
    --cc=ray.huang@amd$(echo .)com \
    --cc=rodrigo.vivi@intel$(echo .)com \
    --cc=rostedt@goodmis$(echo .)org \
    --cc=sparclinux@vger$(echo .)kernel.org \
    --cc=spice-devel@lists$(echo .)freedesktop.org \
    --cc=sroland@vmware$(echo .)com \
    --cc=torvalds@linuxfoundation$(echo .)org \
    --cc=tsbogend@alpha$(echo .)franken.de \
    --cc=vgupta@synopsys$(echo .)com \
    --cc=vincent.guittot@linaro$(echo .)org \
    --cc=viro@zeniv$(echo .)linux.org.uk \
    --cc=virtualization@lists$(echo .)linux-foundation.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