Skip to contentSkip to conversation

add new memtest command

PATCH Superseded Alexander Aring 3 participants 16 messages Jan 15, 2013 – Jan 23, 2013

Subsystems (6)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover add new memtest command

The new memtest command supports to enable or disable caching during testing(only arm architecture) and skipping barebox regions for avoid a barebox killing, if you want to write on barebox allocated regions.

If you run memtest without a argument, memtest will run on all registered memory banks.

The new memtest command has these arguments:
-s #ADDRESS [for start address]
-e #ADDRESS [for end address]
-i #ITER [for numbers of iterations] -c [don't disable caching]
-b [do bus testing only]

v2:
- remove adding whitespaces in linkerscript file and change position in of '_sdata' in ppc lds files.
- remove -1 calculation in linkerscript files which is wrong.
- split remap_range patch into three other patches:
- mmu: add getters for pte cache flags
- arm-mmu: move PAGE_ALIGN macro to common.h
- common: add PAGE_ALIGN_DOWN macro
- change stdout of memtest to make it more beautiful

Alexander Aring (8):
remap_range: make function 'remap_range' global
mmu: add getters for pte cache flags
arm-mmu: move PAGE_ALIGN macro to common.h
common: add PAGE_ALIGN_DOWN macro
memory: add function address_in_sdram_regions
barebox-data: add barebox-data sections
memtest: remove memtest command
memtest: add rewritten memtest command

 arch/arm/cpu/mmu.c                               |  18 +-
 arch/arm/include/asm/mmu.h                       |  17 +
 arch/arm/lib/barebox.lds.S                       |   2 +
 arch/blackfin/boards/ipe337/barebox.lds.S        |   2 +
 arch/blackfin/include/asm/mmu.h                  |  19 +
 arch/mips/include/asm/mmu.h                      |  19 +
 arch/mips/lib/barebox.lds.S                      |   2 +
 arch/nios2/cpu/barebox.lds.S                     |   1 +
 arch/nios2/include/asm/mmu.h                     |  19 +
 arch/openrisc/include/asm/mmu.h                  |  19 +
 arch/ppc/boards/freescale-p2020rdb/barebox.lds.S |   1 +
 arch/ppc/boards/pcm030/barebox.lds.S             |   1 +
 arch/ppc/include/asm/mmu.h                       |  15 +
 arch/sandbox/include/asm/mmu.h                   |  19 +
 arch/x86/include/asm/mmu.h                       |  19 +
 arch/x86/lib/barebox.lds.S                       |   2 +
 commands/Kconfig                                 |  16 +-
 commands/Makefile                                |   2 +-
 commands/memtest.c                               | 897 ++++++++++++++++-------
 common/memory.c                                  |  20 +
 include/asm-generic/sections.h                   |   1 +
 include/common.h                                 |   2 +
 include/memory.h                                 |   6 +
 23 files changed, 832 insertions(+), 287 deletions(-)
 create mode 100644 arch/blackfin/include/asm/mmu.h
 create mode 100644 arch/mips/include/asm/mmu.h
 create mode 100644 arch/nios2/include/asm/mmu.h
 create mode 100644 arch/openrisc/include/asm/mmu.h
 create mode 100644 arch/sandbox/include/asm/mmu.h
 create mode 100644 arch/x86/include/asm/mmu.h
Signature · 7 lines
1.8.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH v2 1/8 remap_range: make function 'remap_range' global

Change function remap_range in arm architecture to make it global accessable. For example command 'memtest' can change pte flags to enable or disable cache.

Add dummy function for others architectures that doesn't have mmu or pte support.

---
 arch/arm/cpu/mmu.c              | 2 +-
 arch/arm/include/asm/mmu.h      | 5 +++++
 arch/blackfin/include/asm/mmu.h | 9 +++++++++
 arch/mips/include/asm/mmu.h     | 9 +++++++++
 arch/nios2/include/asm/mmu.h    | 9 +++++++++
 arch/openrisc/include/asm/mmu.h | 9 +++++++++
 arch/ppc/include/asm/mmu.h      | 5 +++++
 arch/sandbox/include/asm/mmu.h  | 9 +++++++++
 arch/x86/include/asm/mmu.h      | 9 +++++++++
 9 files changed, 65 insertions(+), 1 deletion(-)
 create mode 100644 arch/blackfin/include/asm/mmu.h
 create mode 100644 arch/mips/include/asm/mmu.h
 create mode 100644 arch/nios2/include/asm/mmu.h
 create mode 100644 arch/openrisc/include/asm/mmu.h
 create mode 100644 arch/sandbox/include/asm/mmu.h
 create mode 100644 arch/x86/include/asm/mmu.h
arch/arm/cpu/mmu.c +1 -1
index 40b7ec4..b5c9c60 100644
@@ -93,7 +93,7 @@ static u32 *find_pte(unsigned long adr)
 	return &table[(adr >> PAGE_SHIFT) & 0xff];
 }
 
-static void remap_range(void *_start, size_t size, uint32_t flags)
+void remap_range(void *_start, size_t size, uint32_t flags)
 {
 	unsigned long start = (unsigned long)_start;
 	u32 *p;
arch/arm/include/asm/mmu.h +5 -0
index a66da8c..ae1686b 100644
@@ -41,6 +41,7 @@ void dma_flush_range(unsigned long, unsigned long);
 void dma_inv_range(unsigned long, unsigned long);
 unsigned long virt_to_phys(void *virt);
 void *phys_to_virt(unsigned long phys);
+void remap_range(void *_start, size_t size, uint32_t flags);
 void *map_io_sections(unsigned long physaddr, void *start, size_t size);
 
 #else
@@ -76,6 +77,10 @@ static inline void dma_inv_range(unsigned long s, unsigned long e)
 {
 }
 
+static inline void remap_range(void *_start, size_t size, uint32_t flags)
+{
+}
+
 static inline void *map_io_sections(unsigned long phys, void *start, size_t size)
 {
 	return (void *)phys;
arch/blackfin/include/asm/mmu.h new file +9 -0
new file mode 100644
index 0000000..0485a43
@@ -0,0 +1,9 @@
+#ifndef __ASM_MMU_H
+#define __ASM_MMU_H
+
+static inline void remap_range(void *_start, size_t size, uint32_t flags)
+{
+}
+
+#endif /* __ASM_MMU_H */
+
arch/mips/include/asm/mmu.h new file +9 -0
new file mode 100644
index 0000000..0485a43
@@ -0,0 +1,9 @@
+#ifndef __ASM_MMU_H
+#define __ASM_MMU_H
+
+static inline void remap_range(void *_start, size_t size, uint32_t flags)
+{
+}
+
+#endif /* __ASM_MMU_H */
+
arch/nios2/include/asm/mmu.h new file +9 -0
new file mode 100644
index 0000000..0485a43
@@ -0,0 +1,9 @@
+#ifndef __ASM_MMU_H
+#define __ASM_MMU_H
+
+static inline void remap_range(void *_start, size_t size, uint32_t flags)
+{
+}
+
+#endif /* __ASM_MMU_H */
+
arch/openrisc/include/asm/mmu.h new file +9 -0
new file mode 100644
index 0000000..0485a43
@@ -0,0 +1,9 @@
+#ifndef __ASM_MMU_H
+#define __ASM_MMU_H
+
+static inline void remap_range(void *_start, size_t size, uint32_t flags)
+{
+}
+
+#endif /* __ASM_MMU_H */
+
arch/ppc/include/asm/mmu.h +5 -0
index b2dd0b7..af263ae 100644
@@ -540,4 +540,9 @@ extern int write_bat(ppc_bat_t bat, unsigned long upper, unsigned long lower);
 					(rt<<21)|(ra<<16)|(ws<<11)|(946<<1)
 
 #endif
+
+static inline void remap_range(void *_start, size_t size, uint32_t flags)
+{
+}
+
 #endif /* _PPC_MMU_H_ */
arch/sandbox/include/asm/mmu.h new file +9 -0
new file mode 100644
index 0000000..0485a43
@@ -0,0 +1,9 @@
+#ifndef __ASM_MMU_H
+#define __ASM_MMU_H
+
+static inline void remap_range(void *_start, size_t size, uint32_t flags)
+{
+}
+
+#endif /* __ASM_MMU_H */
+
arch/x86/include/asm/mmu.h new file +9 -0
new file mode 100644
index 0000000..0485a43
@@ -0,0 +1,9 @@
+#ifndef __ASM_MMU_H
+#define __ASM_MMU_H
+
+static inline void remap_range(void *_start, size_t size, uint32_t flags)
+{
+}
+
+#endif /* __ASM_MMU_H */
+
Signature · 7 lines
1.8.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH v2 2/8 mmu: add getters for pte cache flags

In reply to Alexander Aring

Currently only arm architecture provide to change pte flags. Cache pte flags are configured at boottime.

Adding getters to get this pte flags at runtime. In additional of remap_range you can disable or enable caching in commands, for example memtest.

---
 arch/arm/cpu/mmu.c              | 14 ++++++++++++++
 arch/arm/include/asm/mmu.h      | 12 ++++++++++++
 arch/blackfin/include/asm/mmu.h | 10 ++++++++++
 arch/mips/include/asm/mmu.h     | 10 ++++++++++
 arch/nios2/include/asm/mmu.h    | 10 ++++++++++
 arch/openrisc/include/asm/mmu.h | 10 ++++++++++
 arch/ppc/include/asm/mmu.h      | 10 ++++++++++
 arch/sandbox/include/asm/mmu.h  | 10 ++++++++++
 arch/x86/include/asm/mmu.h      | 10 ++++++++++
 9 files changed, 96 insertions(+)
arch/arm/cpu/mmu.c +14 -0
index b5c9c60..6e2ecca 100644
@@ -52,11 +52,25 @@ extern int arm_architecture;
 #define PTE_FLAGS_CACHED_V4 (PTE_SMALL_AP_UNO_SRW | PTE_BUFFERABLE | PTE_CACHEABLE)
 #define PTE_FLAGS_UNCACHED_V4 PTE_SMALL_AP_UNO_SRW
 
+/*
+ * PTE flags to set cached and uncached areas.
+ * This will be determined at runtime.
+ */
 static uint32_t PTE_FLAGS_CACHED;
 static uint32_t PTE_FLAGS_UNCACHED;
 
 #define PTE_MASK ((1 << 12) - 1)
 
+uint32_t mmu_get_pte_cached_flags()
+{
+	return PTE_FLAGS_CACHED;
+}
+
+uint32_t mmu_get_pte_uncached_flags()
+{
+	return PTE_FLAGS_UNCACHED;
+}
+
 /*
  * Create a second level translation table for the given virtual address.
  * We initially create a flat uncached mapping on it.
arch/arm/include/asm/mmu.h +12 -0
index ae1686b..f32cea6 100644
@@ -43,6 +43,8 @@ unsigned long virt_to_phys(void *virt);
 void *phys_to_virt(unsigned long phys);
 void remap_range(void *_start, size_t size, uint32_t flags);
 void *map_io_sections(unsigned long physaddr, void *start, size_t size);
+uint32_t mmu_get_pte_cached_flags(void);
+uint32_t mmu_get_pte_uncached_flags(void);
 
 #else
 static inline void *dma_alloc_coherent(size_t size)
@@ -86,6 +88,16 @@ static inline void *map_io_sections(unsigned long phys, void *start, size_t size
 	return (void *)phys;
 }
 
+static inline uint32_t mmu_get_pte_cached_flags(void)
+{
+	return 0;
+}
+
+static inline uint32_t mmu_get_pte_uncached_flags(void)
+{
+	return 0;
+}
+
 #endif
 
 #ifdef CONFIG_CACHE_L2X0
arch/blackfin/include/asm/mmu.h +10 -0
index 0485a43..eed4c33 100644
@@ -5,5 +5,15 @@ static inline void remap_range(void *_start, size_t size, uint32_t flags)
 {
 }
 
+static inline uint32_t mmu_get_pte_cached_flags(void)
+{
+	return 0;
+}
+
+static inline uint32_t mmu_get_pte_uncached_flags(void)
+{
+	return 0;
+}
+
 #endif /* __ASM_MMU_H */
 
arch/mips/include/asm/mmu.h +10 -0
index 0485a43..eed4c33 100644
@@ -5,5 +5,15 @@ static inline void remap_range(void *_start, size_t size, uint32_t flags)
 {
 }
 
+static inline uint32_t mmu_get_pte_cached_flags(void)
+{
+	return 0;
+}
+
+static inline uint32_t mmu_get_pte_uncached_flags(void)
+{
+	return 0;
+}
+
 #endif /* __ASM_MMU_H */
 
arch/nios2/include/asm/mmu.h +10 -0
index 0485a43..eed4c33 100644
@@ -5,5 +5,15 @@ static inline void remap_range(void *_start, size_t size, uint32_t flags)
 {
 }
 
+static inline uint32_t mmu_get_pte_cached_flags(void)
+{
+	return 0;
+}
+
+static inline uint32_t mmu_get_pte_uncached_flags(void)
+{
+	return 0;
+}
+
 #endif /* __ASM_MMU_H */
 
arch/openrisc/include/asm/mmu.h +10 -0
index 0485a43..eed4c33 100644
@@ -5,5 +5,15 @@ static inline void remap_range(void *_start, size_t size, uint32_t flags)
 {
 }
 
+static inline uint32_t mmu_get_pte_cached_flags(void)
+{
+	return 0;
+}
+
+static inline uint32_t mmu_get_pte_uncached_flags(void)
+{
+	return 0;
+}
+
 #endif /* __ASM_MMU_H */
 
arch/ppc/include/asm/mmu.h +10 -0
index af263ae..050d84b 100644
@@ -545,4 +545,14 @@ static inline void remap_range(void *_start, size_t size, uint32_t flags)
 {
 }
 
+static inline uint32_t mmu_get_pte_cached_flags(void)
+{
+	return 0;
+}
+
+static inline uint32_t mmu_get_pte_uncached_flags(void)
+{
+	return 0;
+}
+
 #endif /* _PPC_MMU_H_ */
arch/sandbox/include/asm/mmu.h +10 -0
index 0485a43..eed4c33 100644
@@ -5,5 +5,15 @@ static inline void remap_range(void *_start, size_t size, uint32_t flags)
 {
 }
 
+static inline uint32_t mmu_get_pte_cached_flags(void)
+{
+	return 0;
+}
+
+static inline uint32_t mmu_get_pte_uncached_flags(void)
+{
+	return 0;
+}
+
 #endif /* __ASM_MMU_H */
 
arch/x86/include/asm/mmu.h +10 -0
index 0485a43..eed4c33 100644
@@ -5,5 +5,15 @@ static inline void remap_range(void *_start, size_t size, uint32_t flags)
 {
 }
 
+static inline uint32_t mmu_get_pte_cached_flags(void)
+{
+	return 0;
+}
+
+static inline uint32_t mmu_get_pte_uncached_flags(void)
+{
+	return 0;
+}
+
 #endif /* __ASM_MMU_H */
 
Signature · 7 lines
1.8.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH v2 3/8 arm-mmu: move PAGE_ALIGN macro to common.h

In reply to Alexander Aring

PAGE_ALIGN macro is needed to align addresses to page boundaries. Move this macro to another PAGE_* defines.

Commands which uses remap_range function needs this macro.

---
 arch/arm/cpu/mmu.c | 2 --
 include/common.h   | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)
arch/arm/cpu/mmu.c +0 -2
index 6e2ecca..6e24356 100644
@@ -308,8 +308,6 @@ void mmu_disable(void)
 	__mmu_cache_off();
 }
 
-#define PAGE_ALIGN(s) (((s) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
-
 void *dma_alloc_coherent(size_t size)
 {
 	void *ret;
include/common.h +1 -0
index b1c96de..9533344 100644
@@ -225,6 +225,7 @@ int run_shell(void);
 
 #define PAGE_SIZE	4096
 #define PAGE_SHIFT	12
+#define PAGE_ALIGN(s) (((s) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
 
 int memory_display(char *addr, loff_t offs, ulong nbytes, int size, int swab);
 
Signature · 7 lines
1.8.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH v2 4/8 common: add PAGE_ALIGN_DOWN macro

In reply to Alexander Aring

Add PAGE_ALIGN_DOWN macro, which is like PAGE_ALIGN macro but returns the lower page boundary of address.

---
 include/common.h | 1 +
 1 file changed, 1 insertion(+)
include/common.h +1 -0
index 9533344..3e67164 100644
@@ -226,6 +226,7 @@ int run_shell(void);
 #define PAGE_SIZE	4096
 #define PAGE_SHIFT	12
 #define PAGE_ALIGN(s) (((s) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
+#define PAGE_ALIGN_DOWN(x) ((x) & ~(PAGE_SIZE - 1))
 
 int memory_display(char *addr, loff_t offs, ulong nbytes, int size, int swab);
 
Signature · 7 lines
1.8.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

PATCH v2 5/8 memory: add function address_in_sdram_regions

In reply to Alexander Aring

Add function address_in_sdram_regions to check if a address is in any sdram region.

Also added new macro 'ADDRESS_IN_REGIONS' to check if address is in a special boundary with start and end address.

---
 common/memory.c  | 16 ++++++++++++++++
 include/memory.h |  6 ++++++
 2 files changed, 22 insertions(+)
common/memory.c +16 -0
index 7dd1384..f9192ab 100644
@@ -158,6 +158,22 @@ int release_sdram_region(struct resource *res)
 	return release_region(res);
 }
 
+/*
+ * Check if specific address are in any allocated region.
+ */
+int address_in_sdram_regions(resource_size_t address)
+{
+	struct memory_bank *bank = NULL;
+	struct resource *r = NULL;
+
+	for_each_memory_bank(bank)
+		list_for_each_entry(r, &bank->res->children, sibling)
+			if (ADDRESS_IN_REGIONS(address, r->start, r->end))
+				return 1;
+
+	return 0;
+}
+
 #ifdef CONFIG_OFTREE
 
 /*
include/memory.h +6 -0
index 165d2dc..e12a28d 100644
@@ -27,4 +27,10 @@ struct resource *request_sdram_region(const char *name, resource_size_t start,
 		resource_size_t size);
 int release_sdram_region(struct resource *res);
 
+#define ADDRESS_IN_REGIONS(address, region_start, region_end) \
+	((address >= region_start) && \
+	 (address <= region_end))
+
+int address_in_sdram_regions(resource_size_t address);
+
 #endif
Signature · 7 lines
1.8.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw

PATCH v2 7/8 memtest: remove memtest command

In reply to Alexander Aring

Remove memtest command.

---
 commands/Kconfig   |   9 --
 commands/Makefile  |   1 -
 commands/memtest.c | 351 -----------------------------------------------------
 3 files changed, 361 deletions(-)
 delete mode 100644 commands/memtest.c
commands/Kconfig +0 -9
index 53cee5c..fc0e448 100644
@@ -496,15 +496,6 @@ config CMD_NANDTEST
 	select PARTITION_NEED_MTD
 	prompt "nandtest"
 
-config CMD_MTEST
-	tristate
-	prompt "mtest"
-
-config CMD_MTEST_ALTERNATIVE
-	bool
-	depends on CMD_MTEST
-	prompt "alternative mtest implementation"
-
 endmenu
 
 menu "video command"
commands/Makefile +0 -1
index 359f566..3145685 100644
@@ -7,7 +7,6 @@ obj-$(CONFIG_CMD_LOADY)		+= loadxy.o
 obj-$(CONFIG_CMD_LOADS)		+= loads.o
 obj-$(CONFIG_CMD_ECHO)		+= echo.o
 obj-$(CONFIG_CMD_MEMORY)	+= mem.o
-obj-$(CONFIG_CMD_MTEST)		+= memtest.o
 obj-$(CONFIG_CMD_EDIT)		+= edit.o
 obj-$(CONFIG_CMD_EXEC)		+= exec.o
 obj-$(CONFIG_CMD_SLEEP)		+= sleep.o
commands/memtest.c deleted +0 -351

351 lines not on this page · raw message

Signature · 7 lines
1.8.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw

PATCH v2 6/8 barebox-data: add barebox-data sections

In reply to Alexander Aring

Add barebox-data section in arm branch to get complete barebox regions in sdram regions tree.

---
 arch/arm/lib/barebox.lds.S                       | 2 ++
 arch/blackfin/boards/ipe337/barebox.lds.S        | 2 ++
 arch/mips/lib/barebox.lds.S                      | 2 ++
 arch/nios2/cpu/barebox.lds.S                     | 1 +
 arch/ppc/boards/freescale-p2020rdb/barebox.lds.S | 1 +
 arch/ppc/boards/pcm030/barebox.lds.S             | 1 +
 arch/x86/lib/barebox.lds.S                       | 2 ++
 common/memory.c                                  | 4 ++++
 include/asm-generic/sections.h                   | 1 +
 9 files changed, 16 insertions(+)
arch/arm/lib/barebox.lds.S +2 -0
index bac1a04..e5aee8c 100644
@@ -66,6 +66,7 @@ SECTIONS
 	}
 #endif
 	_etext = .;			/* End of text and rodata section */
+	_sdata = .;
 
 	. = ALIGN(4);
 	.data : { *(.data*) }
@@ -87,6 +88,7 @@ SECTIONS
 	__usymtab : { BAREBOX_SYMS }
 	__usymtab_end = .;
 
+	_edata = .;
 	. = ALIGN(4);
 	__bss_start = .;
 	.bss : { *(.bss*) }
arch/blackfin/boards/ipe337/barebox.lds.S +2 -0
index 6a07b43..a063841 100644
@@ -55,6 +55,7 @@ SECTIONS
 	.rodata : { *(.rodata) }
 
 	__etext = .;			/* End of text and rodata section */
+	_sdata = .;
 
 	. = ALIGN(4);
 	.data : { *(.data) }
@@ -79,6 +80,7 @@ SECTIONS
 	__usymtab : { BAREBOX_SYMS }
 	___usymtab_end = .;
 
+	_edata - .;
 	. = ALIGN(4);
 	___bss_start = .;
 	.bss : { *(.bss) }
arch/mips/lib/barebox.lds.S +2 -0
index 0cbf2d7..5b3d45d 100644
@@ -44,6 +44,7 @@ SECTIONS
 	.rodata : { *(.rodata*) }
 
 	_etext = .;			/* End of text and rodata section */
+	_sdata = .;
 
 	. = ALIGN(4);
 	.data : { *(.data*) }
@@ -68,6 +69,7 @@ SECTIONS
 	__usymtab : { BAREBOX_SYMS }
 	__usymtab_end = .;
 
+	_edata = .;
 	. = ALIGN(4);
 	__bss_start = .;
 	.bss : { *(.bss*) }
arch/nios2/cpu/barebox.lds.S +1 -0
index af7be4d..943c507 100644
@@ -74,6 +74,7 @@ SECTIONS
 	 * adjacent to simplify the startup code -- and provide
 	 * the global pointer for gp-relative access.
 	 */
+	_sdata = .;
 	_data = .;
 	.data :
 	{
arch/ppc/boards/freescale-p2020rdb/barebox.lds.S +1 -0
index 95033d4..85a864e 100644
@@ -41,6 +41,7 @@ SECTIONS
 
   _etext = .;
   PROVIDE (etext = .);
+  _sdata = .;
 
   .rodata    :
   {
arch/ppc/boards/pcm030/barebox.lds.S +1 -0
index cc86d82..20ac0d8 100644
@@ -69,6 +69,7 @@ SECTIONS
   . = (. + 0x0FFF) & 0xFFFFF000;
   _etext = .;
   PROVIDE (erotext = .);
+  _sdata = .;
   .reloc   :
   {
     *(.got)
arch/x86/lib/barebox.lds.S +2 -0
index 8bd2a7b..05d0f77 100644
@@ -153,6 +153,7 @@ SECTIONS
 	} > barebox
 	BAREBOX_BARE_INIT_SIZE
 
+	_sdata = .;
 	.data : AT ( LOADADDR(.text) + SIZEOF(.text) ) {
 		*(.data*)
 		. = ALIGN(4);
@@ -191,6 +192,7 @@ SECTIONS
 		. = ALIGN(4);
 	} > barebox
 
+	_edata = .;
 	.bss : {
 		__bss_start = .;
 		*(.bss*);
common/memory.c +4 -0
index f9192ab..d2e9164 100644
@@ -75,6 +75,10 @@ static int mem_malloc_resource(void)
 			(unsigned long)&_stext,
 			(unsigned long)&_etext -
 			(unsigned long)&_stext);
+	request_sdram_region("barebox data",
+			(unsigned long)&_sdata,
+			(unsigned long)&_edata -
+			(unsigned long)&_sdata);
 	request_sdram_region("bss",
 			(unsigned long)&__bss_start,
 			(unsigned long)&__bss_stop -
include/asm-generic/sections.h +1 -0
index 17d5fd1..5492aa4 100644
@@ -3,6 +3,7 @@
 
 extern char _text[], _stext[], _etext[];
 extern char __bss_start[], __bss_stop[];
+extern char _sdata[], _edata[];
 extern char __bare_init_start[], __bare_init_end[];
 extern char _end[];
 extern void *_barebox_image_size;
Signature · 7 lines
1.8.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#8 lore raw

PATCH v2 8/8 memtest: add rewritten memtest command

In reply to Alexander Aring

Rewrite memtest command:
- Skip barebox sdram regions.
- Uncache unused mem regions while testing.
- Add iteration parameter.
- Add parameter to do only bus testing.
- Check start and end addresses.
- Testing all banks if no start and end address are given.

- Add sha changes (thanks):
- fix calculation of regions to test. When we use PAGE_ALIGN on size, size can be to high.
- start address has to be aligned up
- end address has to be aligned down
- then size can be calculated as end - start + 1
- Add ctrlc() to the longer loops
- Add a progress bar to give some visual feedback that something issues
still going on.

- Change to use end element instead of size in region struct.
- Fix some newline issues.

- Add '-c' parameter if CONFIG_MMU enabled to test with enabled cache.
- Fix some size calculation.
- set start address to 0xffffffff

---
 commands/Kconfig   |   9 +
 commands/Makefile  |   1 +
 commands/memtest.c | 698 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 708 insertions(+)
 create mode 100644 commands/memtest.c
commands/Kconfig +9 -0
index fc0e448..f027a7e 100644
@@ -496,6 +496,15 @@ config CMD_NANDTEST
 	select PARTITION_NEED_MTD
 	prompt "nandtest"
 
+config CMD_MEMTEST
+    tristate
+    prompt "memtest"
+	help
+	  This command enables a memtest to test installed memory.
+	  During this test allocated iomem regions will be skipped.
+	  If tested architecture has MMU with PTE flags support,
+	  caching can be set enabled or disabled.
+
 endmenu
 
 menu "video command"
commands/Makefile +1 -0
index 3145685..6b4d9cb 100644
@@ -7,6 +7,7 @@ obj-$(CONFIG_CMD_LOADY)		+= loadxy.o
 obj-$(CONFIG_CMD_LOADS)		+= loads.o
 obj-$(CONFIG_CMD_ECHO)		+= echo.o
 obj-$(CONFIG_CMD_MEMORY)	+= mem.o
+obj-$(CONFIG_CMD_MEMTEST)   += memtest.o
 obj-$(CONFIG_CMD_EDIT)		+= edit.o
 obj-$(CONFIG_CMD_EXEC)		+= exec.o
 obj-$(CONFIG_CMD_SLEEP)		+= sleep.o
commands/memtest.c new file +698 -0

698 lines not on this page · raw message

Signature · 7 lines
1.8.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#9 lore raw

Re: [PATCH 8/8] memtest: add rewritten memtest command

Quoted 124 lines · Alexander Aring

Rewrite memtest command:
- Skip barebox sdram regions.
- Uncache unused mem regions while testing.
- Add iteration parameter.
- Add parameter to do only bus testing.
- Check start and end addresses.
- Testing all banks if no start and end address are given.

- Add sha changes (thanks):
- fix calculation of regions to test. When we use PAGE_ALIGN on size, size can be to high.
- start address has to be aligned up
- end address has to be aligned down
- then size can be calculated as end - start + 1
- Add ctrlc() to the longer loops
- Add a progress bar to give some visual feedback that something issues
still going on.

- Change to use end element instead of size in region struct.
- Fix some newline issues.

- Add '-c' parameter if CONFIG_MMU enabled to test with enabled cache.
- Fix some size calculation.
- set start address to 0xffffffff

---
 commands/Kconfig   |   9 +
 commands/Makefile  |   1 +
 commands/memtest.c | 698 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 708 insertions(+)
 create mode 100644 commands/memtest.c
commands/Kconfig +9 -0
index fc0e448..f027a7e 100644
@@ -496,6 +496,15 @@ config CMD_NANDTEST
 	select PARTITION_NEED_MTD
 	prompt "nandtest"
 
+config CMD_MEMTEST
+    tristate
+    prompt "memtest"
+	help
+	  This command enables a memtest to test installed memory.
+	  During this test allocated iomem regions will be skipped.
+	  If tested architecture has MMU with PTE flags support,
+	  caching can be set enabled or disabled.
+
 endmenu
 
 menu "video command"
commands/Makefile +1 -0
index 3145685..6b4d9cb 100644
@@ -7,6 +7,7 @@ obj-$(CONFIG_CMD_LOADY)		+= loadxy.o
 obj-$(CONFIG_CMD_LOADS)		+= loads.o
 obj-$(CONFIG_CMD_ECHO)		+= echo.o
 obj-$(CONFIG_CMD_MEMORY)	+= mem.o
+obj-$(CONFIG_CMD_MEMTEST)   += memtest.o
 obj-$(CONFIG_CMD_EDIT)		+= edit.o
 obj-$(CONFIG_CMD_EXEC)		+= exec.o
 obj-$(CONFIG_CMD_SLEEP)		+= sleep.o
commands/memtest.c new file +50 -0
new file mode 100644
index 0000000..c31e553
@@ -0,0 +1,698 @@
+/*
+ * memtest - Perform a memory test
+ *
+ * (C) Copyright 2013
+ * Alexander Aring <[email protected]>
+ *
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, [email protected].
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <command.h>
+#include <types.h>
+#include <getopt.h>
+#include <memory.h>
+#include <errno.h>
+#include <progress.h>
+#include <asm/mmu.h>
+
+static const vu_long bitpattern[] = {
+	0x00000001,	/* single bit */
+	0x00000003,	/* two adjacent bits */
+	0x00000007,	/* three adjacent bits */
+	0x0000000F,	/* four adjacent bits */
+	0x00000005,	/* two non-adjacent bits */
+	0x00000015,	/* three non-adjacent bits */
+	0x00000055,	/* four non-adjacent bits */
+	0xAAAAAAAA,	/* alternating 1/0 */
+};
+
+/*
+ * In CONFIG_MMU we have a special c flag.

commands/memtest.c line 60

Quoted 10 lines
commands/memtest.c new file +10 -0
+ */
+#ifdef CONFIG_MMU
+static char optstr[] = "s:e:i:cb";
+
+/*
+ * PTE flags variables to set cached and
+ * uncached regions.
+ */
+static uint32_t PTE_FLAGS_CACHED;
+static uint32_t PTE_FLAGS_UNCACHED;

Please no uppercase letters for variable names.

commands/memtest.c line 70

Quoted 10 lines
commands/memtest.c new file +10 -0
+#else
+static char optstr[] = "s:e:i:b";
+#endif
+
+/*
+ * Perform a memory test. The complete test
+ * loops until interrupted by ctrl-c.
+ */
+static int mem_test(vu_long _start, vu_long _end,
+		int bus_only)

It would be good to move this function to common/memory_test.c. This way it could be called from C. Especially testing memory might be called from some early small (no shell) development binaries which are running from some internal SRAM.

Quoted 13 lines
commands/memtest.c new file +13 -0
+{
+	vu_long *start = (vu_long *)_start;
+	/* Point the dummy to start[1] */
+	vu_long *dummy = start+1;
+
+	vu_long val;
+	vu_long readback;
+	vu_long offset;
+	vu_long pattern;
+	vu_long test_offset;
+	vu_long temp;
+	vu_long anti_pattern;
+	vu_long num_words;

commands/memtest.c line 93

Quoted 10 lines
commands/memtest.c new file +10 -0
+
+	int i;
+	int ret;
+
+	if (!IS_ALIGNED(_end - _start + 1, sizeof(vu_long))) {
+		printf("Testing memarea size (0x%08lx) not a multiple"
+				"of size 0x%x, please change start or end address.",
+				_end - _start + 1, sizeof(vu_long));
+		return -1;
+	}

I think this is both too restrictive and not restitrictive enough. How about quietly aligning up the start to a multiple-of-4 boundary and the end down to a multiple-of-4 boundary?

The above requires me to enter a address containing a lot of 'f's and it will happily crash my system if I pass 0xa0000001 as start address.

Quoted 15 lines
commands/memtest.c new file +15 -0
+
+	num_words = (_end - _start + 1)/sizeof(vu_long);
+
+	printf("Starting data line test.\n");
+
+	/*
+	 * Data line test: write a pattern to the first
+	 * location, write the 1's complement to a 'parking'
+	 * address (changes the state of the data bus so a
+	 * floating bus doen't give a false OK), and then
+	 * read the value back. Note that we read it back
+	 * into a variable because the next time we read it,
+	 * it might be right (been there, tough to explain to
+	 * the quality guys why it prints a failure when the
+	 * "is" and "should be" are obviously the same in the

commands/memtest.c line 118

Quoted 10 lines
commands/memtest.c new file +10 -0
+	 * error message).
+	 *
+	 * Rather than exhaustively testing, we test some
+	 * patterns by shifting '1' bits through a field of
+	 * '0's and '0' bits through a field of '1's (i.e.
+	 * pattern and ~pattern).
+	 */
+	for (i = 0; i < sizeof(bitpattern)/
+			sizeof(bitpattern[0]); i++) {
+		ret = address_in_sdram_regions((vu_long)start);

Can't you just call request_sdram_region at the beginning of this function? Then you can be sure that you exclusivly own the region and do not have to test for it on and on again here.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#10 lore raw

Re: [PATCH 8/8] memtest: add rewritten memtest command

Hi,

thank you for reviewing this patch.

Quoted 129 lines · Sascha Hauer
Quoted 128 lines · Alexander Aring

Rewrite memtest command:
- Skip barebox sdram regions.
- Uncache unused mem regions while testing.
- Add iteration parameter.
- Add parameter to do only bus testing.
- Check start and end addresses.
- Testing all banks if no start and end address are given.

- Add sha changes (thanks):
- fix calculation of regions to test. When we use PAGE_ALIGN on size, size can be to high.
- start address has to be aligned up
- end address has to be aligned down
- then size can be calculated as end - start + 1
- Add ctrlc() to the longer loops
- Add a progress bar to give some visual feedback that something issues
still going on.

- Change to use end element instead of size in region struct.
- Fix some newline issues.

- Add '-c' parameter if CONFIG_MMU enabled to test with enabled cache.
- Fix some size calculation.
- set start address to 0xffffffff

---
 commands/Kconfig   |   9 +
 commands/Makefile  |   1 +
 commands/memtest.c | 698 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 708 insertions(+)
 create mode 100644 commands/memtest.c
commands/Kconfig +9 -0
index fc0e448..f027a7e 100644
@@ -496,6 +496,15 @@ config CMD_NANDTEST
 	select PARTITION_NEED_MTD
 	prompt "nandtest"
 
+config CMD_MEMTEST
+    tristate
+    prompt "memtest"
+	help
+	  This command enables a memtest to test installed memory.
+	  During this test allocated iomem regions will be skipped.
+	  If tested architecture has MMU with PTE flags support,
+	  caching can be set enabled or disabled.
+
 endmenu
 
 menu "video command"
commands/Makefile +1 -0
index 3145685..6b4d9cb 100644
@@ -7,6 +7,7 @@ obj-$(CONFIG_CMD_LOADY)		+= loadxy.o
 obj-$(CONFIG_CMD_LOADS)		+= loads.o
 obj-$(CONFIG_CMD_ECHO)		+= echo.o
 obj-$(CONFIG_CMD_MEMORY)	+= mem.o
+obj-$(CONFIG_CMD_MEMTEST)   += memtest.o
 obj-$(CONFIG_CMD_EDIT)		+= edit.o
 obj-$(CONFIG_CMD_EXEC)		+= exec.o
 obj-$(CONFIG_CMD_SLEEP)		+= sleep.o
commands/memtest.c new file +54 -0
new file mode 100644
index 0000000..c31e553
@@ -0,0 +1,698 @@
+/*
+ * memtest - Perform a memory test
+ *
+ * (C) Copyright 2013
+ * Alexander Aring <[email protected]>
+ *
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, [email protected].
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <command.h>
+#include <types.h>
+#include <getopt.h>
+#include <memory.h>
+#include <errno.h>
+#include <progress.h>
+#include <asm/mmu.h>
+
+static const vu_long bitpattern[] = {
+	0x00000001,	/* single bit */
+	0x00000003,	/* two adjacent bits */
+	0x00000007,	/* three adjacent bits */
+	0x0000000F,	/* four adjacent bits */
+	0x00000005,	/* two non-adjacent bits */
+	0x00000015,	/* three non-adjacent bits */
+	0x00000055,	/* four non-adjacent bits */
+	0xAAAAAAAA,	/* alternating 1/0 */
+};
+
+/*
+ * In CONFIG_MMU we have a special c flag.
+ */
+#ifdef CONFIG_MMU
+static char optstr[] = "s:e:i:cb";
+
Quoted 9 lines

commands/memtest.c line 60

Quoted 6 lines
commands/memtest.c new file +6 -0
+/*
+ * PTE flags variables to set cached and
+ * uncached regions.
+ */
+static uint32_t PTE_FLAGS_CACHED;
+static uint32_t PTE_FLAGS_UNCACHED;

Please no uppercase letters for variable names.

Ok. I took it from mach/arm/cpu/mmu.c, should I create a patch which rename it in arch/arm/cpu/mmu.c lower case, too?

Quoted 7 lines
Quoted 7 lines
commands/memtest.c new file +7 -0
+#else
+static char optstr[] = "s:e:i:b";
+#endif
+
+/*
+ * Perform a memory test. The complete test
+ * loops until interrupted by ctrl-c.
Quoted 9 lines

commands/memtest.c line 70

Quoted 3 lines
commands/memtest.c new file +3 -0
+ */
+static int mem_test(vu_long _start, vu_long _end,
+		int bus_only)

It would be good to move this function to common/memory_test.c. This way it could be called from C. Especially testing memory might be called from some early small (no shell) development binaries which are running from some internal SRAM.

Ok.
Maybe we can do a menu entry via Kconfig or something else to run a memtest after booting automatically.

Quoted 19 lines
Quoted 19 lines
commands/memtest.c new file +19 -0
+{
+	vu_long *start = (vu_long *)_start;
+	/* Point the dummy to start[1] */
+	vu_long *dummy = start+1;
+
+	vu_long val;
+	vu_long readback;
+	vu_long offset;
+	vu_long pattern;
+	vu_long test_offset;
+	vu_long temp;
+	vu_long anti_pattern;
+	vu_long num_words;
+
+	int i;
+	int ret;
+
+	if (!IS_ALIGNED(_end - _start + 1, sizeof(vu_long))) {
+		printf("Testing memarea size (0x%08lx) not a multiple"
Quoted 8 lines

commands/memtest.c line 93

Quoted 4 lines
commands/memtest.c new file +4 -0
+				"of size 0x%x, please change start or end address.",
+				_end - _start + 1, sizeof(vu_long));
+		return -1;
+	}

I think this is both too restrictive and not restitrictive enough. How about quietly aligning up the start to a multiple-of-4 boundary and the end down to a multiple-of-4 boundary?

Ok, I change it to do a align.

Quoted 25 lines

The above requires me to enter a address containing a lot of 'f's and it will happily crash my system if I pass 0xa0000001 as start address.

Quoted 21 lines
commands/memtest.c new file +21 -0
+
+	num_words = (_end - _start + 1)/sizeof(vu_long);
+
+	printf("Starting data line test.\n");
+
+	/*
+	 * Data line test: write a pattern to the first
+	 * location, write the 1's complement to a 'parking'
+	 * address (changes the state of the data bus so a
+	 * floating bus doen't give a false OK), and then
+	 * read the value back. Note that we read it back
+	 * into a variable because the next time we read it,
+	 * it might be right (been there, tough to explain to
+	 * the quality guys why it prints a failure when the
+	 * "is" and "should be" are obviously the same in the
+	 * error message).
+	 *
+	 * Rather than exhaustively testing, we test some
+	 * patterns by shifting '1' bits through a field of
+	 * '0's and '0' bits through a field of '1's (i.e.
+	 * pattern and ~pattern).
Quoted 8 lines

commands/memtest.c line 118

Quoted 4 lines
commands/memtest.c new file +4 -0
+	 */
+	for (i = 0; i < sizeof(bitpattern)/
+			sizeof(bitpattern[0]); i++) {
+		ret = address_in_sdram_regions((vu_long)start);

Can't you just call request_sdram_region at the beginning of this function? Then you can be sure that you exclusivly own the region and do not have to test for it on and on again here.

Ok, sure I didn't see that.

Quoted 8 lines

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#11 lore raw

Re: [PATCH 8/8] memtest: add rewritten memtest command

Hi Alexander,

Quoted 11 lines · Alexander Aring
Quoted 9 lines

commands/memtest.c line 60

Quoted 6 lines
commands/memtest.c new file +6 -0
+/*
+ * PTE flags variables to set cached and
+ * uncached regions.
+ */
+static uint32_t PTE_FLAGS_CACHED;
+static uint32_t PTE_FLAGS_UNCACHED;

Please no uppercase letters for variable names.

Ok. I took it from mach/arm/cpu/mmu.c, should I create a patch which rename it in arch/arm/cpu/mmu.c lower case, too?

Yes, that would be great. I must have forgotten reviewing my own patch ;)

Quoted 17 lines
Quoted 17 lines

commands/memtest.c line 70

Quoted 11 lines
commands/memtest.c new file +10 -0
+#else
+static char optstr[] = "s:e:i:b";
+#endif
+
+/*
+ * Perform a memory test. The complete test
+ * loops until interrupted by ctrl-c.
+ */
+static int mem_test(vu_long _start, vu_long _end,
+		int bus_only)

It would be good to move this function to common/memory_test.c. This way it could be called from C. Especially testing memory might be called from some early small (no shell) development binaries which are running from some internal SRAM.

Quoted 3 lines

Ok.
Maybe we can do a menu entry via Kconfig or something else to run a memtest after booting automatically.

Maybe this could be added as an init script in the environment, but personally I don't think I'll run it by default on our boards. We are more into booting fast.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#12 lore raw

Re: [PATCH 8/8] memtest: add rewritten memtest command

Hi Sascha,

Quoted 35 lines · Sascha Hauer

Hi Alexander,

Quoted 11 lines · Alexander Aring
Quoted 9 lines

commands/memtest.c line 60

Quoted 6 lines
commands/memtest.c new file +6 -0
+/*
+ * PTE flags variables to set cached and
+ * uncached regions.
+ */
+static uint32_t PTE_FLAGS_CACHED;
+static uint32_t PTE_FLAGS_UNCACHED;

Please no uppercase letters for variable names.

Ok. I took it from mach/arm/cpu/mmu.c, should I create a patch which rename it in arch/arm/cpu/mmu.c lower case, too?

Yes, that would be great. I must have forgotten reviewing my own patch ;)

Quoted 17 lines
Quoted 17 lines

commands/memtest.c line 70

Quoted 11 lines
commands/memtest.c new file +10 -0
+#else
+static char optstr[] = "s:e:i:b";
+#endif
+
+/*
+ * Perform a memory test. The complete test
+ * loops until interrupted by ctrl-c.
+ */
+static int mem_test(vu_long _start, vu_long _end,
+		int bus_only)

It would be good to move this function to common/memory_test.c. This way it could be called from C. Especially testing memory might be called from some early small (no shell) development binaries which are running from some internal SRAM.

Quoted 7 lines
Quoted 3 lines

Ok.
Maybe we can do a menu entry via Kconfig or something else to run a memtest after booting automatically.

Maybe this could be added as an init script in the environment, but personally I don't think I'll run it by default on our boards. We are more into booting fast.

But how will you run the memtest command in a (no shell) environment? :)

Quoted 8 lines

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#13 lore raw

Re: [PATCH 8/8] memtest: add rewritten memtest command

Quoted 38 lines · Alexander Aring

Hi Sascha,

Quoted 35 lines · Sascha Hauer

Hi Alexander,

Quoted 11 lines · Alexander Aring
Quoted 9 lines

commands/memtest.c line 60

Quoted 6 lines
commands/memtest.c new file +6 -0
+/*
+ * PTE flags variables to set cached and
+ * uncached regions.
+ */
+static uint32_t PTE_FLAGS_CACHED;
+static uint32_t PTE_FLAGS_UNCACHED;

Please no uppercase letters for variable names.

Ok. I took it from mach/arm/cpu/mmu.c, should I create a patch which rename it in arch/arm/cpu/mmu.c lower case, too?

Yes, that would be great. I must have forgotten reviewing my own patch ;)

Quoted 17 lines
Quoted 17 lines

commands/memtest.c line 70

Quoted 11 lines
commands/memtest.c new file +10 -0
+#else
+static char optstr[] = "s:e:i:b";
+#endif
+
+/*
+ * Perform a memory test. The complete test
+ * loops until interrupted by ctrl-c.
+ */
+static int mem_test(vu_long _start, vu_long _end,
+		int bus_only)

It would be good to move this function to common/memory_test.c. This way it could be called from C. Especially testing memory might be called from some early small (no shell) development binaries which are running from some internal SRAM.

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

Ok.
Maybe we can do a menu entry via Kconfig or something else to run a memtest after booting automatically.

Maybe this could be added as an init script in the environment, but personally I don't think I'll run it by default on our boards. We are more into booting fast.

But how will you run the memtest command in a (no shell) environment? :)

make as an option but this will be board specific

I do not want it by default too

booting time are critical for a lost of client

Best Regards,
J.

Quoted 10 lines
Quoted 9 lines

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
Quoted 4 lines

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#14 lore raw

Re: [PATCH 8/8] memtest: add rewritten memtest command

Quoted 47 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 38 lines · Alexander Aring

Hi Sascha,

Quoted 35 lines · Sascha Hauer

Hi Alexander,

Quoted 11 lines · Alexander Aring
Quoted 9 lines

commands/memtest.c line 60

Quoted 6 lines
commands/memtest.c new file +6 -0
+/*
+ * PTE flags variables to set cached and
+ * uncached regions.
+ */
+static uint32_t PTE_FLAGS_CACHED;
+static uint32_t PTE_FLAGS_UNCACHED;

Please no uppercase letters for variable names.

Ok. I took it from mach/arm/cpu/mmu.c, should I create a patch which rename it in arch/arm/cpu/mmu.c lower case, too?

Yes, that would be great. I must have forgotten reviewing my own patch ;)

Quoted 17 lines
Quoted 17 lines

commands/memtest.c line 70

Quoted 11 lines
commands/memtest.c new file +10 -0
+#else
+static char optstr[] = "s:e:i:b";
+#endif
+
+/*
+ * Perform a memory test. The complete test
+ * loops until interrupted by ctrl-c.
+ */
+static int mem_test(vu_long _start, vu_long _end,
+		int bus_only)

It would be good to move this function to common/memory_test.c. This way it could be called from C. Especially testing memory might be called from some early small (no shell) development binaries which are running from some internal SRAM.

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

Ok.
Maybe we can do a menu entry via Kconfig or something else to run a memtest after booting automatically.

Maybe this could be added as an init script in the environment, but personally I don't think I'll run it by default on our boards. We are more into booting fast.

But how will you run the memtest command in a (no shell) environment? :)

Quoted 8 lines

make as an option but this will be board specific

I do not want it by default too

booting time are critical for a lost of client

Best Regards,
J.

Ok, hold on.
We want this to move it in common/memory_test.c to call memtest in a (no shell) environment for a small barebox which running in the internal sram(like omap MLO), not in the connected "ram".

This can be useful to test the complete "connected ram" without allocated barebox regions.

But to do this in a (no shell) environment, somebody need to modify some code to call memtest at barebox boot. Or?

Regards
Alex

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
Quoted 4 lines
Quoted 4 lines

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#15 lore raw

Re: [PATCH 8/8] memtest: add rewritten memtest command

Quoted 61 lines · Alexander Aring
Quoted 47 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 38 lines · Alexander Aring

Hi Sascha,

Quoted 35 lines · Sascha Hauer

Hi Alexander,

Quoted 11 lines · Alexander Aring
Quoted 9 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+/*
+ * PTE flags variables to set cached and
+ * uncached regions.
+ */
+static uint32_t PTE_FLAGS_CACHED;
+static uint32_t PTE_FLAGS_UNCACHED;

Please no uppercase letters for variable names.

Ok. I took it from mach/arm/cpu/mmu.c, should I create a patch which rename it in arch/arm/cpu/mmu.c lower case, too?

Yes, that would be great. I must have forgotten reviewing my own patch ;)

Quoted 17 lines
Quoted 17 lines

Review

Quoted 11 lines
(quoted diff) +10 -0
+#else
+static char optstr[] = "s:e:i:b";
+#endif
+
+/*
+ * Perform a memory test. The complete test
+ * loops until interrupted by ctrl-c.
+ */
+static int mem_test(vu_long _start, vu_long _end,
+		int bus_only)

It would be good to move this function to common/memory_test.c. This way it could be called from C. Especially testing memory might be called from some early small (no shell) development binaries which are running from some internal SRAM.

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

Ok.
Maybe we can do a menu entry via Kconfig or something else to run a memtest after booting automatically.

Maybe this could be added as an init script in the environment, but personally I don't think I'll run it by default on our boards. We are more into booting fast.

But how will you run the memtest command in a (no shell) environment? :)

Quoted 8 lines

make as an option but this will be board specific

I do not want it by default too

booting time are critical for a lost of client

Best Regards,
J.

Ok, hold on.
We want this to move it in common/memory_test.c to call memtest in a (no shell) environment for a small barebox which running in the internal sram(like omap MLO), not in the connected "ram".

Quoted 5 lines

This can be useful to test the complete "connected ram" without allocated barebox regions.

But to do this in a (no shell) environment, somebody need to modify some code to call memtest at barebox boot. Or?

Yes, he would have to modify code. I assumed that he is in the middle of bootstrapping a new board, so he will be writing code anyway. If that assumption is wrong such an option might indeed be useful.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox