Skip to content

Commit

Permalink
nds32/mm/highmem: Switch to generic kmap atomic
Browse files Browse the repository at this point in the history
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]
  • Loading branch information
KAGA-KOKO committed Nov 6, 2020
1 parent a4c33e8 commit 5f037ea
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 57 deletions.
1 change: 1 addition & 0 deletions arch/nds32/Kconfig.cpu
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ config HW_SUPPORT_UNALIGNMENT_ACCESS
config HIGHMEM
bool "High Memory Support"
depends on MMU && !CPU_CACHE_ALIASING
select KMAP_LOCAL
help
The address space of Andes processors is only 4 Gigabytes large
and it has to accommodate user address space, kernel address
Expand Down
4 changes: 2 additions & 2 deletions arch/nds32/include/asm/fixmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

#ifdef CONFIG_HIGHMEM
#include <linux/threads.h>
#include <asm/kmap_types.h>
#include <asm/kmap_size.h>
#endif

enum fixed_addresses {
FIX_HOLE,
FIX_KMAP_RESERVED,
FIX_KMAP_BEGIN,
#ifdef CONFIG_HIGHMEM
FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_TYPE_NR * NR_CPUS),
FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_MAX_IDX * NR_CPUS) - 1,
#endif
FIX_EARLYCON_MEM_BASE,
__end_of_fixed_addresses
Expand Down
22 changes: 16 additions & 6 deletions arch/nds32/include/asm/highmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#define _ASM_HIGHMEM_H

#include <asm/proc-fns.h>
#include <asm/kmap_types.h>
#include <asm/fixmap.h>

/*
Expand Down Expand Up @@ -45,11 +44,22 @@ extern pte_t *pkmap_page_table;
extern void kmap_init(void);

/*
* The following functions are already defined by <linux/highmem.h>
* when CONFIG_HIGHMEM is not set.
* FIXME: The below looks broken vs. a kmap_atomic() in task context which
* is interupted and another kmap_atomic() happens in interrupt context.
* But what do I know about nds32. -- tglx
*/
#ifdef CONFIG_HIGHMEM
extern void *kmap_atomic_pfn(unsigned long pfn);
#endif
#define arch_kmap_local_post_map(vaddr, pteval) \
do { \
__nds32__tlbop_inv(vaddr); \
__nds32__mtsr_dsb(vaddr, NDS32_SR_TLB_VPN); \
__nds32__tlbop_rwr(pteval); \
__nds32__isb(); \
} while (0)

#define arch_kmap_local_pre_unmap(vaddr) \
do { \
__nds32__tlbop_inv(vaddr); \
__nds32__isb(); \
} while (0)

#endif
1 change: 0 additions & 1 deletion arch/nds32/mm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ obj-y := extable.o tlb.o fault.o init.o mmap.o \
mm-nds32.o cacheflush.o proc.o

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

ifdef CONFIG_FUNCTION_TRACER
CFLAGS_REMOVE_proc.o = $(CC_FLAGS_FTRACE)
Expand Down
48 changes: 0 additions & 48 deletions arch/nds32/mm/highmem.c

This file was deleted.

0 comments on commit 5f037ea

Please sign in to comment.