# \[PATCH v3\] powerpc: wire up memtest

- Subsystems: LINUX FOR POWERPC (32-BIT AND 64-BIT), DOCUMENTATION, THE REST
- Maintainers: Madhavan Srinivasan, Jonathan Corbet, Linus Torvalds
- Status: REVIEWED · 1 review, 0 by maintainers (Daniel Axtens)
- Reviewed.
- 1 review trailer.
- List: linuxppc-dev
- 2 messages, 2 authors
- Page: https://ratatoskr.run/linuxppc-dev/2018/09/5394334/t

## \[PATCH v3\] powerpc: wire up memtest

- From: Christophe Leroy \<hidden\>
- Date: 2018-09-28 15:39:24 
- Message: https://ratatoskr.run/linuxppc-dev/2018/09/5394334.md

```text
Add call to early_memtest() so that kernel compiled with
CONFIG_MEMTEST really perform memtest at startup when requested
via 'memtest' boot parameter.

Tested-by: Daniel Axtens <redacted>
Signed-off-by: Christophe Leroy <redacted>
---
 v3: updated kernel parameters documentation to mention PPC

 v2: moved the test after initmem_init() as PPC64 sets max_low_pfn later than PPC32.

 Documentation/admin-guide/kernel-parameters.txt | 2 +-
 arch/powerpc/kernel/setup-common.c              | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 92eb1f42240d..a5ad67d5cb16 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2404,7 +2404,7 @@
 			seconds.  Use this parameter to check at some
 			other rate.  0 disables periodic checking.
 
-	memtest=	[KNL,X86,ARM] Enable memtest
+	memtest=	[KNL,X86,ARM,PPC] Enable memtest
 			Format: <integer>
 			default : 0 <disable>
 			Specifies the number of memtest passes to be
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 93fa0c99681e..9ca9db707bcb 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -33,6 +33,7 @@
 #include <linux/serial_8250.h>
 #include <linux/percpu.h>
 #include <linux/memblock.h>
+#include <linux/bootmem.h>
 #include <linux/of_platform.h>
 #include <linux/hugetlb.h>
 #include <asm/debugfs.h>
@@ -966,6 +967,8 @@ void __init setup_arch(char **cmdline_p)
 
 	initmem_init();
 
+	early_memtest(min_low_pfn << PAGE_SHIFT, max_low_pfn << PAGE_SHIFT);
+
 #ifdef CONFIG_DUMMY_CONSOLE
 	conswitchp = &dummy_con;
 #endif
-- 
2.13.3

```

## Re: \[v3\] powerpc: wire up memtest

- From: Michael Ellerman \<hidden\>
- Date: 2018-10-04 06:14:51 
- Message: https://ratatoskr.run/linuxppc-dev/2018/10/5398876.md

```text
On Fri, 2018-09-28 at 15:39:20 UTC, Christophe Leroy wrote:
> Add call to early_memtest() so that kernel compiled with
> CONFIG_MEMTEST really perform memtest at startup when requested
> via 'memtest' boot parameter.
> 
> Tested-by: Daniel Axtens <redacted>
> Signed-off-by: Christophe Leroy <redacted>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/d90fe2acd9b2900790da01354dbca4

cheers
```
