summaryrefslogtreecommitdiff
path: root/arch/mips/kernel/setup.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2020-10-16 12:40:55 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2020-10-16 12:40:55 -0700
commit09a31a7e3723afd79022d5d3ff3634c2630c2eeb (patch)
treeb9bbf21da582f1c62b0ae8f1e4498754f0198458 /arch/mips/kernel/setup.c
parent847d4287a0c6709fd1ce24002b96d404a6da8b5b (diff)
parentcf3af0a4d3b62ab48e0b90180ea161d0f5d4953f (diff)
Merge tag 'mips_5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux
Pull MIPS updates from Thomas Bogendoerfer: - removed support for PNX833x alias NXT_STB22x - included Ingenic SoC support into generic MIPS kernels - added support for new Ingenic SoCs - converted workaround selection to use Kconfig - replaced old boot mem functions by memblock_* - enabled COP2 usage in kernel for Loongson64 to make use of 16byte load/stores possible - cleanups and fixes * tag 'mips_5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: (92 commits) MIPS: DEC: Restore bootmem reservation for firmware working memory area MIPS: dec: fix section mismatch bcm963xx_tag.h: fix duplicated word mips: ralink: enable zboot support MIPS: ingenic: Remove CPU_SUPPORTS_HUGEPAGES MIPS: cpu-probe: remove MIPS_CPU_BP_GHIST option bit MIPS: cpu-probe: introduce exclusive R3k CPU probe MIPS: cpu-probe: move fpu probing/handling into its own file MIPS: replace add_memory_region with memblock MIPS: Loongson64: Clean up numa.c MIPS: Loongson64: Select SMP in Kconfig to avoid build error mips: octeon: Add Ubiquiti E200 and E220 boards MIPS: SGI-IP28: disable use of ll/sc in kernel MIPS: tx49xx: move tx4939_add_memory_regions into only user MIPS: pgtable: Remove used PAGE_USERIO define MIPS: alchemy: Share prom_init implementation MIPS: alchemy: Fix build breakage, if TOUCHSCREEN_WM97XX is disabled MIPS: process: include exec.h header in process.c MIPS: process: Add prototype for function arch_dup_task_struct MIPS: idle: Add prototype for function check_wait ...
Diffstat (limited to 'arch/mips/kernel/setup.c')
-rw-r--r--arch/mips/kernel/setup.c76
1 files changed, 28 insertions, 48 deletions
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index ee8636ccded2..fccdbe2e7c2b 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -91,45 +91,6 @@ unsigned long ARCH_PFN_OFFSET;
EXPORT_SYMBOL(ARCH_PFN_OFFSET);
#endif
-void __init add_memory_region(phys_addr_t start, phys_addr_t size, long type)
-{
- /*
- * Note: This function only exists for historical reason,
- * new code should use memblock_add or memblock_add_node instead.
- */
-
- /*
- * If the region reaches the top of the physical address space, adjust
- * the size slightly so that (start + size) doesn't overflow
- */
- if (start + size - 1 == PHYS_ADDR_MAX)
- --size;
-
- /* Sanity check */
- if (start + size < start) {
- pr_warn("Trying to add an invalid memory region, skipped\n");
- return;
- }
-
- if (start < PHYS_OFFSET)
- return;
-
- memblock_add(start, size);
- /* Reserve any memory except the ordinary RAM ranges. */
- switch (type) {
- case BOOT_MEM_RAM:
- break;
-
- case BOOT_MEM_NOMAP: /* Discard the range from the system. */
- memblock_remove(start, size);
- break;
-
- default: /* Reserve the rest of the memory types at boot time */
- memblock_reserve(start, size);
- break;
- }
-}
-
void __init detect_memory_region(phys_addr_t start, phys_addr_t sz_min, phys_addr_t sz_max)
{
void *dm = &detect_magic;
@@ -146,7 +107,7 @@ void __init detect_memory_region(phys_addr_t start, phys_addr_t sz_min, phys_add
((unsigned long long) sz_min) / SZ_1M,
((unsigned long long) sz_max) / SZ_1M);
- add_memory_region(start, size, BOOT_MEM_RAM);
+ memblock_add(start, size);
}
/*
@@ -396,7 +357,7 @@ static int __init early_parse_mem(char *p)
if (*p == '@')
start = memparse(p + 1, &p);
- add_memory_region(start, size, BOOT_MEM_RAM);
+ memblock_add(start, size);
return 0;
}
@@ -422,13 +383,14 @@ static int __init early_parse_memmap(char *p)
if (*p == '@') {
start_at = memparse(p+1, &p);
- add_memory_region(start_at, mem_size, BOOT_MEM_RAM);
+ memblock_add(start_at, mem_size);
} else if (*p == '#') {
pr_err("\"memmap=nn#ss\" (force ACPI data) invalid on MIPS\n");
return -EINVAL;
} else if (*p == '$') {
start_at = memparse(p+1, &p);
- add_memory_region(start_at, mem_size, BOOT_MEM_RESERVED);
+ memblock_add(start_at, mem_size);
+ memblock_reserve(start_at, mem_size);
} else {
pr_err("\"memmap\" invalid format!\n");
return -EINVAL;
@@ -443,7 +405,7 @@ static int __init early_parse_memmap(char *p)
early_param("memmap", early_parse_memmap);
#ifdef CONFIG_PROC_VMCORE
-unsigned long setup_elfcorehdr, setup_elfcorehdr_size;
+static unsigned long setup_elfcorehdr, setup_elfcorehdr_size;
static int __init early_parse_elfcorehdr(char *p)
{
phys_addr_t start, end;
@@ -472,6 +434,11 @@ early_param("elfcorehdr", early_parse_elfcorehdr);
#endif
#ifdef CONFIG_KEXEC
+
+/* 64M alignment for crash kernel regions */
+#define CRASH_ALIGN SZ_64M
+#define CRASH_ADDR_MAX SZ_512M
+
static void __init mips_parse_crashkernel(void)
{
unsigned long long total_mem;
@@ -484,9 +451,22 @@ static void __init mips_parse_crashkernel(void)
if (ret != 0 || crash_size <= 0)
return;
- if (!memblock_find_in_range(crash_base, crash_base + crash_size, crash_size, 1)) {
- pr_warn("Invalid memory region reserved for crash kernel\n");
- return;
+ if (crash_base <= 0) {
+ crash_base = memblock_find_in_range(CRASH_ALIGN, CRASH_ADDR_MAX,
+ crash_size, CRASH_ALIGN);
+ if (!crash_base) {
+ pr_warn("crashkernel reservation failed - No suitable area found.\n");
+ return;
+ }
+ } else {
+ unsigned long long start;
+
+ start = memblock_find_in_range(crash_base, crash_base + crash_size,
+ crash_size, 1);
+ if (start != crash_base) {
+ pr_warn("Invalid memory region reserved for crash kernel\n");
+ return;
+ }
}
crashk_res.start = crash_base;
@@ -621,7 +601,7 @@ static void __init bootcmdline_init(void)
* arch_mem_init - initialize memory management subsystem
*
* o plat_mem_setup() detects the memory configuration and will record detected
- * memory areas using add_memory_region.
+ * memory areas using memblock_add.
*
* At this stage the memory configuration of the system is known to the
* kernel but generic memory management system is still entirely uninitialized.