Skip to content

Commit 2a15ba8

Browse files
committed
ARM: highmem: Switch to generic kmap atomic
No reason having the same code in every architecture. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Russell King <[email protected]> Cc: Arnd Bergmann <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 39cac19 commit 2a15ba8

File tree

6 files changed

+26
-144
lines changed

6 files changed

+26
-144
lines changed

arch/arm/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,6 +1498,7 @@ config HAVE_ARCH_PFN_VALID
14981498
config HIGHMEM
14991499
bool "High Memory Support"
15001500
depends on MMU
1501+
select KMAP_LOCAL
15011502
help
15021503
The address space of ARM processors is only 4 Gigabytes large
15031504
and it has to accommodate user address space, kernel address

arch/arm/include/asm/fixmap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
#define FIXADDR_TOP (FIXADDR_END - PAGE_SIZE)
88

99
#include <linux/pgtable.h>
10-
#include <asm/kmap_types.h>
10+
#include <asm/kmap_size.h>
1111

1212
enum fixed_addresses {
1313
FIX_EARLYCON_MEM_BASE,
1414
__end_of_permanent_fixed_addresses,
1515

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

1919
/* Support writing RO kernel text via kprobes, jump labels, etc. */
2020
FIX_TEXT_POKE0,

arch/arm/include/asm/highmem.h

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#ifndef _ASM_HIGHMEM_H
33
#define _ASM_HIGHMEM_H
44

5-
#include <asm/kmap_types.h>
5+
#include <asm/fixmap.h>
66

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

4747
#ifdef ARCH_NEEDS_KMAP_HIGH_GET
4848
extern void *kmap_high_get(struct page *page);
49-
#else
49+
50+
static inline void *arch_kmap_local_high_get(struct page *page)
51+
{
52+
if (IS_ENABLED(CONFIG_DEBUG_HIGHMEM) && !cache_is_vivt())
53+
return NULL;
54+
return kmap_high_get(page);
55+
}
56+
#define arch_kmap_local_high_get arch_kmap_local_high_get
57+
58+
#else /* ARCH_NEEDS_KMAP_HIGH_GET */
5059
static inline void *kmap_high_get(struct page *page)
5160
{
5261
return NULL;
5362
}
54-
#endif
63+
#endif /* !ARCH_NEEDS_KMAP_HIGH_GET */
5564

56-
/*
57-
* The following functions are already defined by <linux/highmem.h>
58-
* when CONFIG_HIGHMEM is not set.
59-
*/
60-
#ifdef CONFIG_HIGHMEM
61-
extern void *kmap_atomic_pfn(unsigned long pfn);
62-
#endif
65+
#define arch_kmap_local_post_map(vaddr, pteval) \
66+
local_flush_tlb_kernel_page(vaddr)
67+
68+
#define arch_kmap_local_pre_unmap(vaddr) \
69+
do { \
70+
if (cache_is_vivt()) \
71+
__cpuc_flush_dcache_area((void *)vaddr, PAGE_SIZE); \
72+
} while (0)
73+
74+
#define arch_kmap_local_post_unmap(vaddr) \
75+
local_flush_tlb_kernel_page(vaddr)
6376

6477
#endif

arch/arm/include/asm/kmap_types.h

Lines changed: 0 additions & 10 deletions
This file was deleted.

arch/arm/mm/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ obj-$(CONFIG_MODULES) += proc-syms.o
1919
obj-$(CONFIG_DEBUG_VIRTUAL) += physaddr.o
2020

2121
obj-$(CONFIG_ALIGNMENT_TRAP) += alignment.o
22-
obj-$(CONFIG_HIGHMEM) += highmem.o
2322
obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
2423
obj-$(CONFIG_ARM_PV_FIXUP) += pv-fixup-asm.o
2524

arch/arm/mm/highmem.c

Lines changed: 0 additions & 121 deletions
This file was deleted.

0 commit comments

Comments
 (0)