Commit 2a15ba82 authored by Thomas Gleixner's avatar Thomas Gleixner
Browse files

ARM: highmem: Switch to generic kmap atomic



No reason having the same code in every architecture.

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20201103095857.582196476@linutronix.de
parent 39cac191
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1498,6 +1498,7 @@ config HAVE_ARCH_PFN_VALID
config HIGHMEM
	bool "High Memory Support"
	depends on MMU
	select KMAP_LOCAL
	help
	  The address space of ARM processors is only 4 Gigabytes large
	  and it has to accommodate user address space, kernel address
+2 −2
Original line number Diff line number Diff line
@@ -7,14 +7,14 @@
#define FIXADDR_TOP		(FIXADDR_END - PAGE_SIZE)

#include <linux/pgtable.h>
#include <asm/kmap_types.h>
#include <asm/kmap_size.h>

enum fixed_addresses {
	FIX_EARLYCON_MEM_BASE,
	__end_of_permanent_fixed_addresses,

	FIX_KMAP_BEGIN = __end_of_permanent_fixed_addresses,
	FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_TYPE_NR * NR_CPUS) - 1,
	FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_MAX_IDX * NR_CPUS) - 1,

	/* Support writing RO kernel text via kprobes, jump labels, etc. */
	FIX_TEXT_POKE0,
+23 −10
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
#ifndef _ASM_HIGHMEM_H
#define _ASM_HIGHMEM_H

#include <asm/kmap_types.h>
#include <asm/fixmap.h>

#define PKMAP_BASE		(PAGE_OFFSET - PMD_SIZE)
#define LAST_PKMAP		PTRS_PER_PTE
@@ -46,19 +46,32 @@ extern pte_t *pkmap_page_table;

#ifdef ARCH_NEEDS_KMAP_HIGH_GET
extern void *kmap_high_get(struct page *page);
#else

static inline void *arch_kmap_local_high_get(struct page *page)
{
	if (IS_ENABLED(CONFIG_DEBUG_HIGHMEM) && !cache_is_vivt())
		return NULL;
	return kmap_high_get(page);
}
#define arch_kmap_local_high_get arch_kmap_local_high_get

#else /* ARCH_NEEDS_KMAP_HIGH_GET */
static inline void *kmap_high_get(struct page *page)
{
	return NULL;
}
#endif
#endif /* !ARCH_NEEDS_KMAP_HIGH_GET */

/*
 * The following functions are already defined by <linux/highmem.h>
 * when CONFIG_HIGHMEM is not set.
 */
#ifdef CONFIG_HIGHMEM
extern void *kmap_atomic_pfn(unsigned long pfn);
#endif
#define arch_kmap_local_post_map(vaddr, pteval)				\
	local_flush_tlb_kernel_page(vaddr)

#define arch_kmap_local_pre_unmap(vaddr)				\
do {									\
	if (cache_is_vivt())						\
		__cpuc_flush_dcache_area((void *)vaddr, PAGE_SIZE);	\
} while (0)

#define arch_kmap_local_post_unmap(vaddr)				\
	local_flush_tlb_kernel_page(vaddr)

#endif

arch/arm/include/asm/kmap_types.h

deleted100644 → 0
+0 −10
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __ARM_KMAP_TYPES_H
#define __ARM_KMAP_TYPES_H

/*
 * This is the "bare minimum".  AIO seems to require this.
 */
#define KM_TYPE_NR 16

#endif
+0 −1
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ obj-$(CONFIG_MODULES) += proc-syms.o
obj-$(CONFIG_DEBUG_VIRTUAL)	+= physaddr.o

obj-$(CONFIG_ALIGNMENT_TRAP)	+= alignment.o
obj-$(CONFIG_HIGHMEM)		+= highmem.o
obj-$(CONFIG_HUGETLB_PAGE)	+= hugetlbpage.o
obj-$(CONFIG_ARM_PV_FIXUP)	+= pv-fixup-asm.o

Loading