Skip to content

Commit 5f037ea

Browse files
committed
nds32/mm/highmem: Switch to generic kmap atomic
The mapping code is odd and looks broken. See FIXME in the comment. Also fix the harmless off by one in the FIX_KMAP_END define. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Nick Hu <[email protected]> Cc: Greentime Hu <[email protected]> Cc: Vincent Chen <[email protected]> Cc: Arnd Bergmann <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a4c33e8 commit 5f037ea

File tree

5 files changed

+19
-57
lines changed

5 files changed

+19
-57
lines changed

arch/nds32/Kconfig.cpu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ config HW_SUPPORT_UNALIGNMENT_ACCESS
157157
config HIGHMEM
158158
bool "High Memory Support"
159159
depends on MMU && !CPU_CACHE_ALIASING
160+
select KMAP_LOCAL
160161
help
161162
The address space of Andes processors is only 4 Gigabytes large
162163
and it has to accommodate user address space, kernel address

arch/nds32/include/asm/fixmap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
#ifdef CONFIG_HIGHMEM
88
#include <linux/threads.h>
9-
#include <asm/kmap_types.h>
9+
#include <asm/kmap_size.h>
1010
#endif
1111

1212
enum fixed_addresses {
1313
FIX_HOLE,
1414
FIX_KMAP_RESERVED,
1515
FIX_KMAP_BEGIN,
1616
#ifdef CONFIG_HIGHMEM
17-
FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_TYPE_NR * NR_CPUS),
17+
FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_MAX_IDX * NR_CPUS) - 1,
1818
#endif
1919
FIX_EARLYCON_MEM_BASE,
2020
__end_of_fixed_addresses

arch/nds32/include/asm/highmem.h

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#define _ASM_HIGHMEM_H
66

77
#include <asm/proc-fns.h>
8-
#include <asm/kmap_types.h>
98
#include <asm/fixmap.h>
109

1110
/*
@@ -45,11 +44,22 @@ extern pte_t *pkmap_page_table;
4544
extern void kmap_init(void);
4645

4746
/*
48-
* The following functions are already defined by <linux/highmem.h>
49-
* when CONFIG_HIGHMEM is not set.
47+
* FIXME: The below looks broken vs. a kmap_atomic() in task context which
48+
* is interupted and another kmap_atomic() happens in interrupt context.
49+
* But what do I know about nds32. -- tglx
5050
*/
51-
#ifdef CONFIG_HIGHMEM
52-
extern void *kmap_atomic_pfn(unsigned long pfn);
53-
#endif
51+
#define arch_kmap_local_post_map(vaddr, pteval) \
52+
do { \
53+
__nds32__tlbop_inv(vaddr); \
54+
__nds32__mtsr_dsb(vaddr, NDS32_SR_TLB_VPN); \
55+
__nds32__tlbop_rwr(pteval); \
56+
__nds32__isb(); \
57+
} while (0)
58+
59+
#define arch_kmap_local_pre_unmap(vaddr) \
60+
do { \
61+
__nds32__tlbop_inv(vaddr); \
62+
__nds32__isb(); \
63+
} while (0)
5464

5565
#endif

arch/nds32/mm/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ obj-y := extable.o tlb.o fault.o init.o mmap.o \
33
mm-nds32.o cacheflush.o proc.o
44

55
obj-$(CONFIG_ALIGNMENT_TRAP) += alignment.o
6-
obj-$(CONFIG_HIGHMEM) += highmem.o
76

87
ifdef CONFIG_FUNCTION_TRACER
98
CFLAGS_REMOVE_proc.o = $(CC_FLAGS_FTRACE)

arch/nds32/mm/highmem.c

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

0 commit comments

Comments
 (0)