Skip to content

Commit

Permalink
MIPS: Loongson3,SGI-IP27: Simplify max_low_pfn calculation
Browse files Browse the repository at this point in the history
Both the Loongson3 & SGI-IP27 platforms set max_low_pfn to the last
available PFN describing memory. They both do it in paging_init() which
is later than ideal since max_low_pfn is used before that function is
called. Simplify both platforms to trivially initialize max_low_pfn
using the end address of DRAM, and do it earlier in prom_meminit().

Signed-off-by: Paul Burton <paul.burton@mips.com>
Suggested-by: Mike Rapoport <rppt@linux.ibm.com>
Tested-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
Patchwork: https://patchwork.linux-mips.org/patch/21104/
References: https://patchwork.linux-mips.org/patch/21031/
Cc: Huacai Chen <chenhc@lemote.com>
Cc: Mike Rapoport <rppt@linux.ibm.com>
Cc: Thomas Bogendoerfer <tbogendoerfer@suse.de>
Cc: linux-mips@linux-mips.org
  • Loading branch information
Paul Burton committed Nov 15, 2018
1 parent 25517ed commit 1229ace
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
12 changes: 2 additions & 10 deletions arch/mips/loongson64/loongson-3/numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ static __init void prom_meminit(void)
cpumask_clear(&__node_data[(node)]->cpumask);
}
}
max_low_pfn = PHYS_PFN(memblock_end_of_DRAM());

for (cpu = 0; cpu < loongson_sysconf.nr_cpus; cpu++) {
node = cpu / loongson_sysconf.cores_per_node;
if (node >= num_online_nodes())
Expand All @@ -248,19 +250,9 @@ static __init void prom_meminit(void)

void __init paging_init(void)
{
unsigned node;
unsigned long zones_size[MAX_NR_ZONES] = {0, };

pagetable_init();

for_each_online_node(node) {
unsigned long start_pfn, end_pfn;

get_pfn_range_for_nid(node, &start_pfn, &end_pfn);

if (end_pfn > max_low_pfn)
max_low_pfn = end_pfn;
}
#ifdef CONFIG_ZONE_DMA32
zones_size[ZONE_DMA32] = MAX_DMA32_PFN;
#endif
Expand Down
11 changes: 1 addition & 10 deletions arch/mips/sgi-ip27/ip27-memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ void __init prom_meminit(void)

mlreset();
szmem();
max_low_pfn = PHYS_PFN(memblock_end_of_DRAM());

for (node = 0; node < MAX_COMPACT_NODES; node++) {
if (node_online(node)) {
Expand All @@ -455,18 +456,8 @@ extern void setup_zero_pages(void);
void __init paging_init(void)
{
unsigned long zones_size[MAX_NR_ZONES] = {0, };
unsigned node;

pagetable_init();

for_each_online_node(node) {
unsigned long start_pfn, end_pfn;

get_pfn_range_for_nid(node, &start_pfn, &end_pfn);

if (end_pfn > max_low_pfn)
max_low_pfn = end_pfn;
}
zones_size[ZONE_NORMAL] = max_low_pfn;
free_area_init_nodes(zones_size);
}
Expand Down

0 comments on commit 1229ace

Please sign in to comment.