diff mbox series

test: cpu: Handle both 32bit and 64bit CPUs

Message ID 20230813195219.159629-1-marek.vasut+renesas@mailbox.org
State Accepted
Commit 25a9be71ec1ca779aac8bcb1d8a363725ff0ac7f
Delegated to: Simon Glass
Headers show
Series test: cpu: Handle both 32bit and 64bit CPUs | expand

Commit Message

Marek Vasut Aug. 13, 2023, 7:52 p.m. UTC
Handle both 32bit and 64bit systems, i.e. sandbox and sandbox64
the same way drivers/cpu/cpu_sandbox.c does, that is in case
CONFIG_PHYS_64BIT is enabled, assume 64bit address width, else
assume 32bit address width. This fixes ut_dm_dm_test_cpu test
failure on sandbox64.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: Simon Glass <sjg@chromium.org>
---
 test/dm/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Glass Aug. 14, 2023, 10:42 p.m. UTC | #1
On Sun, 13 Aug 2023 at 13:52, Marek Vasut
<marek.vasut+renesas@mailbox.org> wrote:
>
> Handle both 32bit and 64bit systems, i.e. sandbox and sandbox64
> the same way drivers/cpu/cpu_sandbox.c does, that is in case
> CONFIG_PHYS_64BIT is enabled, assume 64bit address width, else
> assume 32bit address width. This fixes ut_dm_dm_test_cpu test
> failure on sandbox64.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> ---
> Cc: Simon Glass <sjg@chromium.org>
> ---
>  test/dm/cpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Simon Glass Aug. 20, 2023, 9:57 p.m. UTC | #2
On Sun, 13 Aug 2023 at 13:52, Marek Vasut
<marek.vasut+renesas@mailbox.org> wrote:
>
> Handle both 32bit and 64bit systems, i.e. sandbox and sandbox64
> the same way drivers/cpu/cpu_sandbox.c does, that is in case
> CONFIG_PHYS_64BIT is enabled, assume 64bit address width, else
> assume 32bit address width. This fixes ut_dm_dm_test_cpu test
> failure on sandbox64.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> ---
> Cc: Simon Glass <sjg@chromium.org>
> ---
>  test/dm/cpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/test/dm/cpu.c b/test/dm/cpu.c
index d7e596ee396..5734cd0a92d 100644
--- a/test/dm/cpu.c
+++ b/test/dm/cpu.c
@@ -37,7 +37,7 @@  static int dm_test_cpu(struct unit_test_state *uts)
 	ut_assertok(cpu_get_info(dev, &info));
 	ut_asserteq(info.cpu_freq, 42 * 42 * 42 * 42 * 42);
 	ut_asserteq(info.features, 0x42424242);
-	ut_asserteq(info.address_width, 32);
+	ut_asserteq(info.address_width, IS_ENABLED(CONFIG_PHYS_64BIT) ? 64 : 32);
 
 	ut_asserteq(cpu_get_count(dev), 42);