From 86c5c25b6ca99025ac8ebcbe5c53ea0f398d1f44 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Fri, 22 Aug 2025 20:18:46 +0200 Subject: memtest: don't volatile-qualify local variables It is obviously important that the addr pointer used to access the memory region being tested is volatile-qualified, to prevent the compiler from optimizing out the "write this value, read it back, check that it is what we expect". However, none of these auxiliary variables have any such need for, effectively, being forced to live on the stack and cause each and every reference to them to do a memory access. This makes the memtest about 15% faster on a beagleboneblack. Before: => dcache off => time mtest 0x81000000 0x81100000 0 1 Testing 81000000 ... 81100000: Iteration: 1 Tested 1 iteration(s) with 0 errors. time: 10.868 seconds After: => dcache off => time mtest 0x81000000 0x81100000 0 1 Testing 81000000 ... 81100000: Iteration: 1 Tested 1 iteration(s) with 0 errors. time: 9.209 seconds [Without the 'dcache off', there's no difference in the time, about 0.6s, but the memtest cannot usefully be done with dcache enabled.] Signed-off-by: Rasmus Villemoes Tested-by: Anshul Dalal --- cmd/mem.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'cmd') diff --git a/cmd/mem.c b/cmd/mem.c index b8afe62e474..3bba46ad7da 100644 --- a/cmd/mem.c +++ b/cmd/mem.c @@ -719,12 +719,9 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, ulong errs = 0; ulong val, readback; int j; - vu_long offset; - vu_long test_offset; - vu_long pattern; - vu_long temp; - vu_long anti_pattern; - vu_long num_words; + ulong offset, test_offset; + ulong pattern, anti_pattern; + ulong temp, num_words; static const ulong bitpattern[] = { 0x00000001, /* single bit */ 0x00000003, /* two adjacent bits */ -- cgit v1.2.3 From 835915bb7d2b76d7e422b6d60628a0f7cef30ddb Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Fri, 22 Aug 2025 20:18:47 +0200 Subject: memtest: only call schedule() once for every 256 words A function call itself for every word written or read+written in these loops is bad enough. But since the memory test must be run with dcache disabled, the schedule() call, traversing the linked list of registered cyclic clients, and accessing the 'struct cyclic_info' for each to see if any are due for a callback, is quite expensive. On a beagleboneblack, testing a modest 16MiB region takes 2.5 minutes: => dcache off => time mtest 0x81000000 0x82000000 0 1 Testing 81000000 ... 82000000: Iteration: 1 Tested 1 iteration(s) with 0 errors. time: 2 minutes, 28.946 seconds There is really no need for calling schedule() so frequently. It is quite easy to limit the calls to once for every 256 words by using a u8 variable. With that, the same test as above becomes 37 times faster: => dcache off => time mtest 0x81000000 0x82000000 0 1 Testing 81000000 ... 82000000: Iteration: 1 Tested 1 iteration(s) with 0 errors. time: 4.052 seconds Note that we are still making a total of 3 loops * (4 * 2^20 words/loop) / (256 words/call) = 49152 calls during those ~4000 milliseconds, so the schedule() calls are still done less than 0.1ms apart. These numbers are just for a beagleboneblack, other boards may have a slower memory, but we are _two orders of magnitude_ away from schedule() "only" being called at 100Hz, which is still more than enough to ensure any watchdog is kept happy. Signed-off-by: Rasmus Villemoes Tested-by: Anshul Dalal --- cmd/mem.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/mem.c b/cmd/mem.c index 3bba46ad7da..b67368dfba5 100644 --- a/cmd/mem.c +++ b/cmd/mem.c @@ -732,6 +732,8 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, 0x00000055, /* four non-adjacent bits */ 0xaaaaaaaa, /* alternating 1/0 */ }; + /* Rate-limit schedule() calls to one for every 256 words. */ + u8 count = 0; num_words = (end_addr - start_addr) / sizeof(vu_long); @@ -887,7 +889,8 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, * Fill memory with a known pattern. */ for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) { - schedule(); + if (!count++) + schedule(); addr[offset] = pattern; } @@ -895,7 +898,8 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, * Check each location and invert it for the second pass. */ for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) { - schedule(); + if (!count++) + schedule(); temp = addr[offset]; if (temp != pattern) { printf("\nFAILURE (read/write) @ 0x%.8lx:" @@ -915,7 +919,8 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, * Check each location for the inverted pattern and zero it. */ for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) { - schedule(); + if (!count++) + schedule(); anti_pattern = ~pattern; temp = addr[offset]; if (temp != anti_pattern) { -- cgit v1.2.3 From 42529beba5a262992b53893477e0de646c1754b6 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Fri, 22 Aug 2025 20:18:48 +0200 Subject: memtest: remove use of vu_long typedef in mem_test_alt Hiding a qualifier such as "volatile" inside a typedef makes the code much harder to understand. Since addr and dummy being volatile-qualified are important for the correctness of the test code, make it more obvious by spelling it out as "volatile ulong". Signed-off-by: Rasmus Villemoes Tested-by: Anshul Dalal --- cmd/mem.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'cmd') diff --git a/cmd/mem.c b/cmd/mem.c index b67368dfba5..d5d7ca2790b 100644 --- a/cmd/mem.c +++ b/cmd/mem.c @@ -712,10 +712,10 @@ static int do_mem_loopw(struct cmd_tbl *cmdtp, int flag, int argc, #endif /* CONFIG_LOOPW */ #ifdef CONFIG_CMD_MEMTEST -static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, - vu_long *dummy) +static ulong mem_test_alt(volatile ulong *buf, ulong start_addr, ulong end_addr, + volatile ulong *dummy) { - vu_long *addr; + volatile ulong *addr; ulong errs = 0; ulong val, readback; int j; @@ -735,7 +735,7 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, /* Rate-limit schedule() calls to one for every 256 words. */ u8 count = 0; - num_words = (end_addr - start_addr) / sizeof(vu_long); + num_words = (end_addr - start_addr) / sizeof(ulong); /* * Data line test: write a pattern to the first @@ -817,8 +817,8 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, * * Returns: 0 if the test succeeds, 1 if the test fails. */ - pattern = (vu_long)0xaaaaaaaaaaaaaaaa; - anti_pattern = (vu_long)0x5555555555555555; + pattern = (ulong)0xaaaaaaaaaaaaaaaa; + anti_pattern = (ulong)0x5555555555555555; debug("%s:%d: length = 0x%.8lx\n", __func__, __LINE__, num_words); /* @@ -839,7 +839,7 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, if (temp != pattern) { printf("\nFAILURE: Address bit stuck high @ 0x%.8lx:" " expected 0x%.8lx, actual 0x%.8lx\n", - start_addr + offset*sizeof(vu_long), + start_addr + offset*sizeof(ulong), pattern, temp); errs++; if (ctrlc()) @@ -861,7 +861,7 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, printf("\nFAILURE: Address bit stuck low or" " shorted @ 0x%.8lx: expected 0x%.8lx," " actual 0x%.8lx\n", - start_addr + offset*sizeof(vu_long), + start_addr + offset*sizeof(ulong), pattern, temp); errs++; if (ctrlc()) @@ -904,7 +904,7 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, if (temp != pattern) { printf("\nFAILURE (read/write) @ 0x%.8lx:" " expected 0x%.8lx, actual 0x%.8lx)\n", - start_addr + offset*sizeof(vu_long), + start_addr + offset*sizeof(ulong), pattern, temp); errs++; if (ctrlc()) @@ -926,7 +926,7 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, if (temp != anti_pattern) { printf("\nFAILURE (read/write): @ 0x%.8lx:" " expected 0x%.8lx, actual 0x%.8lx)\n", - start_addr + offset*sizeof(vu_long), + start_addr + offset*sizeof(ulong), anti_pattern, temp); errs++; if (ctrlc()) -- cgit v1.2.3 From bbc9347a98c3fb32610d4324c9e0f6239f013143 Mon Sep 17 00:00:00 2001 From: Aditya Dutt Date: Fri, 5 Sep 2025 19:36:11 +0530 Subject: cmd: terminal: avoid serial_reinit_all() with DM_SERIAL enabled serial_reinit_all() is only available when CONFIG DM_SERIAL is disabled and CONFIG_SERIAL is enabled. Signed-off-by: Aditya Dutt --- cmd/terminal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/terminal.c b/cmd/terminal.c index d803bc6c896..14610694255 100644 --- a/cmd/terminal.c +++ b/cmd/terminal.c @@ -24,7 +24,7 @@ int do_terminal(struct cmd_tbl *cmd, int flag, int argc, char *const argv[]) if (!dev) return -1; - if (IS_ENABLED(CONFIG_SERIAL)) + if (IS_ENABLED(CONFIG_SERIAL) && !IS_ENABLED(CONFIG_DM_SERIAL)) serial_reinit_all(); printf("Entering terminal mode for port %s\n", dev->name); -- cgit v1.2.3 From 5d0b813d6e4749da2cc8672216ea0f5b9b1b350f Mon Sep 17 00:00:00 2001 From: Osama Abdelkader Date: Sun, 14 Sep 2025 17:27:51 +0200 Subject: imls: remove return parentheses return is not a function, parentheses are not required Signed-off-by: Osama Abdelkader --- cmd/bootm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/bootm.c b/cmd/bootm.c index bee683d0580..2c5aea26d98 100644 --- a/cmd/bootm.c +++ b/cmd/bootm.c @@ -572,7 +572,7 @@ static int do_imls(struct cmd_tbl *cmdtp, int flag, int argc, if (ret_nand) return ret_nand; - return (0); + return 0; } U_BOOT_CMD( -- cgit v1.2.3 From 601cebc29d2a41846bbad36453b97b065db656dd Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Mon, 15 Sep 2025 13:05:48 -0600 Subject: cmd: spl: Remove ATAG support from this command While we continue to have some systems which support extremely legacy OS booting methods, we do not have use cases for supporting this in Falcon mode anymore. Remove this support and references from the documentation. Co-developed-by: Anshul Dalal Signed-off-by: Tom Rini --- cmd/spl.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) (limited to 'cmd') diff --git a/cmd/spl.c b/cmd/spl.c index 379b512f1ff..f591dc07fb6 100644 --- a/cmd/spl.c +++ b/cmd/spl.c @@ -27,19 +27,6 @@ static const char **subcmd_list[] = { "cmdline", "bdt", "prep", -#endif - NULL, - }, - [SPL_EXPORT_ATAGS] = (const char * []) { -#ifdef CONFIG_SUPPORT_PASSING_ATAGS - "start", - "loados", -#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH - "ramdisk", -#endif - "cmdline", - "bdt", - "prep", #endif NULL, }, @@ -96,7 +83,6 @@ static int call_bootm(int argc, char *const argv[], const char *subcommand[]) static struct cmd_tbl cmd_spl_export_sub[] = { U_BOOT_CMD_MKENT(fdt, 0, 1, (void *)SPL_EXPORT_FDT, "", ""), - U_BOOT_CMD_MKENT(atags, 0, 1, (void *)SPL_EXPORT_ATAGS, "", ""), }; static int spl_export(struct cmd_tbl *cmdtp, int flag, int argc, @@ -128,10 +114,6 @@ static int spl_export(struct cmd_tbl *cmdtp, int flag, int argc, #endif break; #endif - case SPL_EXPORT_ATAGS: - printf("Argument image is now in RAM at: 0x%p\n", - (void *)gd->bd->bi_boot_params); - break; } } else { /* Unrecognized command */ @@ -176,11 +158,10 @@ static int do_spl(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) U_BOOT_CMD( spl, 6 , 1, do_spl, "SPL configuration", - "export [kernel_addr] [initrd_addr] [fdt_addr]\n" - "\timg\t\t\"atags\" or \"fdt\"\n" + "export fdt [kernel_addr] [initrd_addr] [fdt_addr]\n" "\tkernel_addr\taddress where a kernel image is stored.\n" "\t\t\tkernel is loaded as part of the boot process, but it is not started.\n" "\tinitrd_addr\taddress of initial ramdisk\n" "\t\t\tcan be set to \"-\" if fdt_addr without initrd_addr is used.\n" - "\tfdt_addr\tin case of fdt, the address of the device tree.\n" + "\tfdt_addr\tthe address of the device tree.\n" ); -- cgit v1.2.3