@@ -3201,6 +3201,9 @@
Note that even when enabled, there are a few cases where
the feature is not effective.
+ memory_block_size=size [PPC]
+ Use this parameter to configure the memory block size value.
+
memtest= [KNL,X86,ARM,M68K,PPC,RISCV] Enable memtest
Format: <integer>
default : 0 <disable>
@@ -892,6 +892,29 @@ unsigned long memory_block_size_bytes(void)
return MIN_MEMORY_BLOCK_SIZE;
}
+
+/*
+ * Restrict to a power of 2 value for memblock which is larger than
+ * section size
+ */
+static int __init parse_mem_block_size(char *ptr)
+{
+ unsigned int order;
+ unsigned long size = memparse(ptr, NULL);
+
+ order = fls64(size);
+ if (!order)
+ return 0;
+
+ order--;
+ if (order < SECTION_SIZE_BITS)
+ return 0;
+
+ memory_block_size = 1UL << order;
+
+ return 0;
+}
+early_param("memory_block_size", parse_mem_block_size);
#endif
#if defined(CONFIG_PPC_INDIRECT_PIO) || defined(CONFIG_PPC_INDIRECT_MMIO)
@@ -569,13 +569,20 @@ static int __init probe_memory_block_size(unsigned long node, const char *uname,
return 0;
}
-/*
- * start with 1G memory block size. Early init will
- * fix this with correct value.
- */
-unsigned long memory_block_size __ro_after_init = 1UL << 30;
+unsigned long memory_block_size __ro_after_init;
static void __init early_init_memory_block_size(void)
{
+ /*
+ * if it is set via early param just return.
+ */
+ if (memory_block_size)
+ return;
+
+ /*
+ * start with 1G memory block size. update_memory_block_size()
+ * will derive the right value based on device tree details.
+ */
+ memory_block_size = SZ_1G;
/*
* We need to do memory_block_size probe early so that
* radix__early_init_mmu() can use this as limit for