mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master 1/2] test: self: mmu: remap buffer with default attributes on exit
@ 2023-05-23  9:42 Ahmad Fatoum
  2023-05-23  9:42 ` [PATCH master 2/2] test: self: mmu: fix invalid use of __is_defined Ahmad Fatoum
  2023-05-25  6:50 ` [PATCH master 1/2] test: self: mmu: remap buffer with default attributes on exit Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2023-05-23  9:42 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

For inspection with mmuinfo, I had inserted a return before remapping
with default attributes. Drop it, so we can test that default attributes
work and to free the memory allocated.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 test/self/mmu.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/test/self/mmu.c b/test/self/mmu.c
index ee6c1cd45e7e..48515b30aeb8 100644
--- a/test/self/mmu.c
+++ b/test/self/mmu.c
@@ -142,7 +142,6 @@ static void test_remap(void)
 	}
 
 	expect_success(ret, "asserting mirroring after remap (virt += 4K)");
-	return;
 
 	ret = remap_range(buffer, SZ_8M, MAP_DEFAULT);
 	expect_success(ret, "remapping buffer with default attrs");
-- 
2.39.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH master 2/2] test: self: mmu: fix invalid use of __is_defined
  2023-05-23  9:42 [PATCH master 1/2] test: self: mmu: remap buffer with default attributes on exit Ahmad Fatoum
@ 2023-05-23  9:42 ` Ahmad Fatoum
  2023-05-25  6:50 ` [PATCH master 1/2] test: self: mmu: remap buffer with default attributes on exit Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2023-05-23  9:42 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

__is_defined is only usable for undefined macros and defined macros with
a value. __is_defined on a defined macro without a value are will yield
zero, which is unfortunate as ARCH_HAS_REMAP is defined without a value
for the architectures that define it. The header has an arch_can_remap()
helper that's already used to guard remapping code in the memtest
command, so let's make use of it instead. While at it, fix the skipped
test count to correctly reflect the number of tests skipped.

This should fix failure of the test on x86, where remapping is not
supported as we run under EFI and don't touch page tables.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 test/self/mmu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/self/mmu.c b/test/self/mmu.c
index 48515b30aeb8..5e630e708f02 100644
--- a/test/self/mmu.c
+++ b/test/self/mmu.c
@@ -79,8 +79,8 @@ static void test_remap(void)
 	memtest(buffer, SZ_8M, "cached buffer");
 	memtest(mirror, SZ_8M, "cached mirror");
 
-	if (__is_defined(ARCH_HAS_REMAP)) {
-		skipped_tests += 10;
+	if (!arch_can_remap()) {
+		skipped_tests += 18;
 		goto out;
 	}
 
-- 
2.39.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH master 1/2] test: self: mmu: remap buffer with default attributes on exit
  2023-05-23  9:42 [PATCH master 1/2] test: self: mmu: remap buffer with default attributes on exit Ahmad Fatoum
  2023-05-23  9:42 ` [PATCH master 2/2] test: self: mmu: fix invalid use of __is_defined Ahmad Fatoum
@ 2023-05-25  6:50 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2023-05-25  6:50 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Tue, May 23, 2023 at 11:42:07AM +0200, Ahmad Fatoum wrote:
> For inspection with mmuinfo, I had inserted a return before remapping
> with default attributes. Drop it, so we can test that default attributes
> work and to free the memory allocated.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  test/self/mmu.c | 1 -
>  1 file changed, 1 deletion(-)

Applied, thanks

Sascha

> 
> diff --git a/test/self/mmu.c b/test/self/mmu.c
> index ee6c1cd45e7e..48515b30aeb8 100644
> --- a/test/self/mmu.c
> +++ b/test/self/mmu.c
> @@ -142,7 +142,6 @@ static void test_remap(void)
>  	}
>  
>  	expect_success(ret, "asserting mirroring after remap (virt += 4K)");
> -	return;
>  
>  	ret = remap_range(buffer, SZ_8M, MAP_DEFAULT);
>  	expect_success(ret, "remapping buffer with default attrs");
> -- 
> 2.39.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-25  6:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-23  9:42 [PATCH master 1/2] test: self: mmu: remap buffer with default attributes on exit Ahmad Fatoum
2023-05-23  9:42 ` [PATCH master 2/2] test: self: mmu: fix invalid use of __is_defined Ahmad Fatoum
2023-05-25  6:50 ` [PATCH master 1/2] test: self: mmu: remap buffer with default attributes on exit Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox