Skip to content

Commit 4bfc848

Browse files
rppttorvalds
authored andcommitted
m68k/mm: enable use of generic memory_model.h for !DISCONTIGMEM
The pg_data_map and pg_data_table arrays as well as page_to_pfn() and pfn_to_page() are required only for DISCONTIGMEM. Other memory models can use the generic definitions in asm-generic/memory_model.h. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Mike Rapoport <[email protected]> Cc: Alexey Dobriyan <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Greg Ungerer <[email protected]> Cc: John Paul Adrian Glaubitz <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Matt Turner <[email protected]> Cc: Meelis Roos <[email protected]> Cc: Michael Schmitz <[email protected]> Cc: Russell King <[email protected]> Cc: Tony Luck <[email protected]> Cc: Vineet Gupta <[email protected]> Cc: Will Deacon <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 6b2ad8d commit 4bfc848

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

arch/m68k/Kconfig.cpu

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,6 @@ config SINGLE_MEMORY_CHUNK
374374
bool "Use one physical chunk of memory only" if ADVANCED && !SUN3
375375
depends on MMU
376376
default y if SUN3 || MMU_COLDFIRE
377-
select NEED_MULTIPLE_NODES
378377
help
379378
Ignore all but the first contiguous chunk of physical memory for VM
380379
purposes. This will save a few bytes kernel size and may speed up

arch/m68k/include/asm/page.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ extern unsigned long _ramend;
6262
#include <asm/page_no.h>
6363
#endif
6464

65+
#ifdef CONFIG_DISCONTIGMEM
6566
#define __phys_to_pfn(paddr) ((unsigned long)((paddr) >> PAGE_SHIFT))
6667
#define __pfn_to_phys(pfn) PFN_PHYS(pfn)
68+
#endif
6769

6870
#include <asm-generic/getorder.h>
6971

arch/m68k/include/asm/page_mm.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ static inline __attribute_const__ int __virt_to_node_shift(void)
153153
pfn_to_virt(page_to_pfn(page)); \
154154
})
155155

156+
#ifdef CONFIG_DISCONTIGMEM
156157
#define pfn_to_page(pfn) ({ \
157158
unsigned long __pfn = (pfn); \
158159
struct pglist_data *pgdat; \
@@ -165,6 +166,10 @@ static inline __attribute_const__ int __virt_to_node_shift(void)
165166
pgdat = &pg_data_map[page_to_nid(__p)]; \
166167
((__p) - pgdat->node_mem_map) + pgdat->node_start_pfn; \
167168
})
169+
#else
170+
#define ARCH_PFN_OFFSET (m68k_memory[0].addr)
171+
#include <asm-generic/memory_model.h>
172+
#endif
168173

169174
#define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
170175
#define pfn_valid(pfn) virt_addr_valid(pfn_to_virt(pfn))

arch/m68k/include/asm/virtconvert.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,7 @@ static inline void *phys_to_virt(unsigned long address)
2929
}
3030

3131
/* Permanent address of a page. */
32-
#if defined(CONFIG_MMU) && !defined(CONFIG_DISCONTIGMEM)
33-
#define page_to_phys(page) \
34-
__pa(PAGE_OFFSET + (((page) - pg_data_map[0].node_mem_map) << PAGE_SHIFT))
35-
#else
3632
#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
37-
#endif
3833

3934
/*
4035
* IO bus memory addresses are 1:1 with the physical address,

arch/m68k/mm/init.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ EXPORT_SYMBOL(empty_zero_page);
4242

4343
#ifdef CONFIG_MMU
4444

45-
pg_data_t pg_data_map[MAX_NUMNODES];
46-
EXPORT_SYMBOL(pg_data_map);
47-
4845
int m68k_virt_to_node_shift;
4946

5047
#ifdef CONFIG_DISCONTIGMEM
48+
pg_data_t pg_data_map[MAX_NUMNODES];
49+
EXPORT_SYMBOL(pg_data_map);
50+
5151
pg_data_t *pg_data_table[65];
5252
EXPORT_SYMBOL(pg_data_table);
5353
#endif

0 commit comments

Comments
 (0)