Another try for a new memtest implementation
cover Another try for a new memtest implementation
Hi,
this is a new try to get a new memtest implementation into barebox.
I removed the ADDRESS_IN_REGIONS macro, which was a very ugly solution. The new memtest command used a list and save all unused sdram_regions of each bank. Then running the mem_test routine on these regions. After that the memtest command will release the requested sdram_regions.
I removed the start and stop command arguments to make the implementation easier/understandable and it's not necessary anyway.
Maybe it's better to remove the silent ALIGN and ALIGN_DOWN from the start and end address in the common mem_test routine, because addresses are already align.
It is difficult to explain because a end address has the form of 0xXXXXffff and a ALIGN_DOWN on it with a mask of 3 we have a calculated end address of 0xXXXXfffA which is wrong. (0xXXXXffff - 4) - 1...
Another question is:
Can someone test it with more than one bank, please? :-)
Regards
Alex
Alexander Aring (5):
common: fix codestyle in ALIGN macros
common: add ALIGN_DOWN macro
memtest: remove memtest command
common: add memtest.c with mem_test routine
commands: add new memtest command
commands/Kconfig | 17 +- commands/Makefile | 2 +- commands/memtest.c | 489 +++++++++++++++++++++-------------------------------- common/Makefile | 1 + common/memtest.c | 313 ++++++++++++++++++++++++++++++++++ include/common.h | 5 +- include/memtest.h | 14 ++ 7 files changed, 535 insertions(+), 306 deletions(-) create mode 100644 common/memtest.c create mode 100644 include/memtest.h
Signature · 7 lines
1.8.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/5 common: fix codestyle in ALIGN macros
--- include/common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/common.h +2 -2
@@ -182,8 +182,8 @@ int run_shell(void);#define BUILD_BUG_ON_ZERO (e) (sizeof(struct { int:-!!(e); }))#define BUILD_BUG_ON_NULL (e) ((void *)sizeof(struct { int:-!!(e); })) -#define ALIGN (x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) -#define __ALIGN_MASK (x,mask) (((x)+(mask))&~(mask)) +#define ALIGN (x, a) __ALIGN_MASK(x, (typeof(x))(a) - 1) +#define __ALIGN_MASK (x, mask) (((x) + (mask)) & ~(mask))#define PTR_ALIGN (p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))#define IS_ALIGNED (x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
Signature · 7 lines
1.8.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/5 common: add ALIGN_DOWN macro
In reply to Alexander Aring--- include/common.h | 1 + 1 file changed, 1 insertion(+)
include/common.h +1 -0
@@ -184,6 +184,7 @@ int run_shell(void);#define ALIGN (x, a) __ALIGN_MASK(x, (typeof(x))(a) - 1)#define __ALIGN_MASK (x, mask) (((x) + (mask)) & ~(mask)) +#define ALIGN_DOWN (x, a) ((x) & ~((typeof(x))(a) - 1))#define PTR_ALIGN (p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))#define IS_ALIGNED (x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
Signature · 7 lines
1.8.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 3/5 memtest: remove memtest command
In reply to Alexander AringRemove 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
@@ -561,15 +561,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
@@ -13,7 +13,6 @@ obj-$(CONFIG_CMD_MW) += mw.o obj-$(CONFIG_CMD_MEMCMP) += memcmp.o obj-$(CONFIG_CMD_MEMCPY) += memcpy.o obj-$(CONFIG_CMD_MEMSET) += memset.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.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 4/5 common: add memtest.c with mem_test routine
In reply to Alexander AringAdd mem_test routine. Useful to detect timing problems if someone porting a new device to barebox. This test includes a data bus test, address bus test and integrity check of memory.
This mem_test routine has as parameter start and end address of testing space. The last parameter can skip the integrity check.
--- common/Makefile | 1 + common/memtest.c | 313 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/memtest.h | 14 +++ 3 files changed, 328 insertions(+) create mode 100644 common/memtest.c create mode 100644 include/memtest.h
common/Makefile +1 -0
@@ -18,6 +18,7 @@ obj-$(CONFIG_MALLOC_DLMALLOC) += dlmalloc.o obj-$(CONFIG_MALLOC_TLSF) += tlsf_malloc.o obj-$(CONFIG_MALLOC_TLSF) += tlsf.o obj-$(CONFIG_MALLOC_DUMMY) += dummy_malloc.o +obj-$(CONFIG_CMD_MEMTEST) += memtest.o obj-y += clock.o obj-$(CONFIG_BANNER) += version.o obj-$(CONFIG_MEMINFO) += meminfo.o
common/memtest.c new file +313 -0
313 lines not on this page · raw message
include/memtest.h new file +14 -0
@@ -0,0 +1,14 @@ +#ifndef __MEMTEST_H +#define __MEMTEST_H + +#include <linux/ioport.h> + +struct mem_test_resource { +struct resource *r; +struct list_head list; +}; + +int mem_test (resource_size_t _start, +resource_size_t _end,int bus_only); + +#endif /* __MEMTEST_H */
Signature · 7 lines
1.8.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 5/5 commands: add new memtest command
In reply to Alexander AringThis new memtest can test the whole unused memory. The new memtest command try to request the whole unused sdram regions on all banks and run the mem_test routine from common/memtest.c on it.
The memtest command has only two parameters;
-i Amount of iterations, default 1, iteration of 0 is endless.
-b Set this to skip integrity check.(Do only a fast test for bus lines)
If MMU support is enable, memtest try to run memtest twice. The first with cache enabled, the second with cache disabled.
--- commands/Kconfig | 10 +++ commands/Makefile | 1 + commands/memtest.c | 250 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 261 insertions(+) create mode 100644 commands/memtest.c
commands/Kconfig +10 -0
@@ -561,6 +561,16 @@ config CMD_NANDTEST select PARTITION_NEED_MTD prompt "nandtest" +config CMD_MEMTEST + tristate + prompt "memtest" + help + The memtest command can test the registered barebox memory. + During this test barebox memory regions like heap, stack, ... + will be skipped. If the tested architecture has MMU with PTE + flags support, the memtest is running twice with cache enabled + and with cache disabled + endmenu menu "video command"
commands/Makefile +1 -0
@@ -48,6 +48,7 @@ obj-$(CONFIG_CMD_SAVEENV) += saveenv.o obj-$(CONFIG_CMD_LOADENV) += loadenv.o obj-$(CONFIG_CMD_NAND) += nand.o obj-$(CONFIG_CMD_NANDTEST) += nandtest.o +obj-$(CONFIG_CMD_MEMTEST) += memtest.o obj-$(CONFIG_CMD_TRUE) += true.o obj-$(CONFIG_CMD_FALSE) += false.o obj-$(CONFIG_CMD_VERSION) += version.o
commands/memtest.c new file +250 -0
250 lines not on this page · raw message
Signature · 7 lines
1.8.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Hi Alex,
Quoted 5 lines · Alexander Aring
Hi,
this is a new try to get a new memtest implementation into barebox.
I removed the
ADDRESS_IN_REGIONSmacro, which was a very ugly solution.
Indeed, much nicer now.
Quoted 6 lines
The new memtest command used a list and save all unused
sdram_regionsof each bank. Then running themem_testroutine on these regions. After that the memtest command will release the requestedsdram_regions.I removed the start and stop command arguments to make the implementation easier/understandable and it's not necessary anyway.
Specifying a region would be nice, but not really necessary.
Quoted 10 lines
Maybe it's better to remove the silent ALIGN and
ALIGN_DOWNfrom the start and end address in the commonmem_testroutine, because addresses are already align.
It is difficult to explain because a end address has the form of 0xXXXXffff and aALIGN_DOWNon it with a mask of 3 we have a calculated end address of 0xXXXXfffA which is wrong. (0xXXXXffff - 4) - 1...Another question is:
Can someone test it with more than one bank, please? :-)
I gave it a test on a karo tx25 board which has two memory banks. It works just like expected :)
Overall this looks really good now. I just applied it to -next.
Thanks
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
Quoted 4 lines · On Tue, 4 Jun 2013 01:13:47 +0200 Alexander Aring <[email protected]> wrote:
Hi,
this is a new try to get a new memtest implementation into barebox.
I have got the new memtest command from the next branch.
Here is my MIPS qemu-malta build log:
CC commands/memtest.ocommands/memtest.c: In function `alloc_memtest_region':commands/memtest.c:39: warning: implicit declaration of function xzalloc' commands/memtest.c:39: warning: assignment makes pointer from integer without a cast commands/memtest.c:42: error: EINVAL' undeclared (first use in this function) commands/memtest.c:42: error: (Each undeclared identifier is reported only once commands/memtest.c:42: error: for each function it appears in.) commands/memtest.c: In function `request_memtest_regions':commands/memtest.c:57: warning: implicit declaration of function container_of' commands/memtest.c:57: error: syntax error before "typeof" commands/memtest.c:57: error: syntax error before "typeof" commands/memtest.c:64: warning: implicit declaration of function PAGE_ALIGN_DOWN' commands/memtest.c:71: error: continue statement not within a loop commands/memtest.c: At top level:commands/memtest.c:79: error: syntax error before "for" commands/memtest.c:79: error: syntax error before '->' token commands/memtest.c:79: warning: type defaults to int' in declaration of prefetch' commands/memtest.c:79: warning: function declaration isn't a prototype commands/memtest.c:79: error: conflicting types for 'prefetch' include/linux/list.h:18: error: previous definition of 'prefetch' was here commands/memtest.c:79: warning: type defaults to int' in declaration of r' commands/memtest.c:79: error: invalid type argument of ->' commands/memtest.c:79: error: syntax error before "typeof" commands/memtest.c:88: warning: type defaults to int' in declaration of end' commands/memtest.c:88: error: invalid type argument of ->' commands/memtest.c:88: error: initializer element is not constant commands/memtest.c:88: warning: data definition has no type or storage class commands/memtest.c:89: warning: type defaults to int' in declaration of size' commands/memtest.c:89: error: start' undeclared here (not in a function) commands/memtest.c:89: warning: data definition has no type or storage class commands/memtest.c:90: warning: type defaults to int' in declaration of `r_prev' commands/memtest.c:90: error: initializer element is not constant commands/memtest.c:90: warning: data definition has no type or storage class commands/memtest.c:91: error: syntax error before "if" commands/memtest.c:94: warning: type defaults to int' in declaration of ret' commands/memtest.c:94: error: `list' undeclared here (not in a function) commands/memtest.c:94: error: initializer element is not constant commands/memtest.c:94: warning: data definition has no type or storage class commands/memtest.c:95: error: syntax error before "if" commands/memtest.c:102: warning: type defaults to int' in declaration of start' commands/memtest.c:102: warning: implicit declaration of function PAGE_ALIGN' commands/memtest.c:102: error: invalid type argument of ->' commands/memtest.c:102: error: initializer element is not constant commands/memtest.c:102: warning: data definition has no type or storage class commands/memtest.c:103: warning: type defaults to int' in declaration of end' commands/memtest.c:103: error: redefinition of 'end' commands/memtest.c:88: error: previous definition of 'end' was here commands/memtest.c:103: error: invalid type argument of ->' commands/memtest.c:103: error: initializer element is not constant commands/memtest.c:103: warning: data definition has no type or storage class commands/memtest.c:104: warning: type defaults to int' in declaration of `size' commands/memtest.c:104: error: redefinition of 'size' commands/memtest.c:89: error: previous definition of 'size' was here commands/memtest.c:104: error: initializer element is not constant commands/memtest.c:104: warning: data definition has no type or storage class commands/memtest.c:105: warning: type defaults to int' in declaration of r_prev' commands/memtest.c:105: error: redefinition of 'r_prev' commands/memtest.c:90: error: previous definition of 'r_prev' was here commands/memtest.c:105: error: initializer element is not constant commands/memtest.c:105: warning: data definition has no type or storage class commands/memtest.c:106: error: syntax error before "if" commands/memtest.c:109: warning: type defaults to int' in declaration of ret' commands/memtest.c:109: error: redefinition of 'ret' commands/memtest.c:94: error: previous definition of 'ret' was here commands/memtest.c:109: error: initializer element is not constant commands/memtest.c:109: warning: data definition has no type or storage class commands/memtest.c:110: error: syntax error before "if" commands/memtest.c:118: warning: type defaults to int' in declaration of end' commands/memtest.c:118: error: redefinition of 'end' commands/memtest.c:103: error: previous definition of 'end' was here commands/memtest.c:118: error: redefinition of 'end' commands/memtest.c:103: error: previous definition of 'end' was here commands/memtest.c:118: error: `bank' undeclared here (not in a function) commands/memtest.c:118: error: initializer element is not constant commands/memtest.c:118: warning: data definition has no type or storage class commands/memtest.c:119: warning: type defaults to int' in declaration of size' commands/memtest.c:119: error: redefinition of 'size' commands/memtest.c:104: error: previous definition of 'size' was here commands/memtest.c:119: error: redefinition of 'size' commands/memtest.c:104: error: previous definition of 'size' was here commands/memtest.c:119: error: initializer element is not constant commands/memtest.c:119: warning: data definition has no type or storage class commands/memtest.c:120: error: syntax error before "if" commands/memtest.c:123: warning: type defaults to int' in declaration of ret' commands/memtest.c:123: error: redefinition of 'ret' commands/memtest.c:109: error: previous definition of 'ret' was here commands/memtest.c:123: error: redefinition of 'ret' commands/memtest.c:109: error: previous definition of 'ret' was here commands/memtest.c:123: error: initializer element is not constant commands/memtest.c:123: warning: data definition has no type or storage class commands/memtest.c:124: error: syntax error before "if" commands/memtest.c: In function `__do_memtest':commands/memtest.c:139: error: syntax error before "typeof" commands/memtest.c:139: error: syntax error before "typeof" commands/memtest.c:149: warning: implicit declaration of function `printf' commands/memtest.c: At top level:commands/memtest.c:152: error: syntax error before "return" commands/memtest.c: In function `do_memtest':commands/memtest.c:165: warning: implicit declaration of function `simple_strtoul' commands/memtest.c:214: error: syntax error before "typeof" commands/memtest.c:214: error: syntax error before "typeof" commands/memtest.c:221: warning: implicit declaration of function `free' commands/memtest.c: At top level:commands/memtest.c:224: error: syntax error before "if" commands/memtest.c:232: error: syntax error before string constant commands/memtest.c:232: warning: type defaults to int' in declaration of printf' commands/memtest.c:232: warning: function declaration isn't a prototype commands/memtest.c:232: warning: data definition has no type or storage class make[1]: *** [commands/memtest.o] Error 1
make: *** [commands] Error 2
Signature · 8 lines
-- Best regards, Antony Pavlov _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Hi Antony,
Quoted 8 lines · On Thu, Jun 06, 2013 at 11:52:45AM +0400, [email protected] wrote:
Quoted 4 lines · On Tue, 4 Jun 2013 01:13:47 +0200 Alexander Aring <[email protected]> wrote:
Hi,
this is a new try to get a new memtest implementation into barebox.
Quoted 8 lines
I have got the new memtest command from the next branch.
Here is my MIPS qemu-malta build log:
CC
commands/memtest.ocommands/memtest.c: In function `alloc_memtest_region':commands/memtest.c:39: warning: implicit declaration of function `xzalloc'commands/memtest.c:39: warning: assignment makes pointer from integer without a cast
thanks for send this notice. I know why this happend.
We get an include from architecure specific header file "asm/mmu.h" and some mmu.h in other architecure don't include "inside of arch specific asm/mmu.h" headers like "malloc.h", "errno.h".
I simple forgot to handle this.
I will send a patch "for-next" to add these header files to memtest.
Regards
Alex
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox