From 13b9de78f3d04e4f97f359354b193b3a321ecd92 Mon Sep 17 00:00:00 2001 From: Gerwin Klein Date: Thu, 20 Jun 2024 17:15:34 +1000 Subject: [PATCH] cache: only expect errors for EL1 armv8-a On armv7-a and in EL-2, the corresponding operations are safe for the kernel to perform. Signed-off-by: Gerwin Klein --- apps/sel4test-tests/src/tests/cache.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/sel4test-tests/src/tests/cache.c b/apps/sel4test-tests/src/tests/cache.c index 5fcdc3ac..8582df56 100644 --- a/apps/sel4test-tests/src/tests/cache.c +++ b/apps/sel4test-tests/src/tests/cache.c @@ -386,6 +386,10 @@ static int test_cache_invalid(env_t env) return sel4test_get_result(); } +static inline int CONST invalidate_should_fail() { + return config_set(CONFIG_ARCH_AARCH64) && !config_set(CONFIG_ARM_HYPERVISOR_SUPPORT); +} + static int test_cache_kernel_only(env_t env) { /* @@ -423,7 +427,7 @@ static int test_cache_kernel_only(env_t env) err = seL4_ARCH_PageDirectory_Clean_Data(env->page_directory, vstart, vstart + PAGE_SIZE_4K); test_error_eq(err, seL4_NoError); err = seL4_ARCH_PageDirectory_Invalidate_Data(env->page_directory, vstart, vstart + PAGE_SIZE_4K); - test_error_eq(err, seL4_IllegalOperation); + test_error_eq(err, invalidate_should_fail() ? seL4_IllegalOperation : seL4_NoError); err = seL4_ARCH_PageDirectory_CleanInvalidate_Data(env->page_directory, vstart, vstart + PAGE_SIZE_4K); test_error_eq(err, seL4_NoError); err = seL4_ARCH_PageDirectory_Unify_Instruction(env->page_directory, vstart, vstart + PAGE_SIZE_4K); @@ -432,7 +436,7 @@ static int test_cache_kernel_only(env_t env) err = seL4_ARM_Page_Clean_Data(frame, 0, PAGE_SIZE_4K); test_error_eq(err, seL4_NoError); err = seL4_ARM_Page_Invalidate_Data(frame, 0, PAGE_SIZE_4K); - test_error_eq(err, seL4_IllegalOperation); + test_error_eq(err, invalidate_should_fail() ? seL4_IllegalOperation : seL4_NoError); err = seL4_ARM_Page_CleanInvalidate_Data(frame, 0, PAGE_SIZE_4K); test_error_eq(err, seL4_NoError); err = seL4_ARM_Page_Unify_Instruction(frame, 0, PAGE_SIZE_4K); @@ -525,7 +529,7 @@ static int test_cache_read_only(env_t env) err = seL4_ARCH_PageDirectory_Clean_Data(env->page_directory, vstart, vstart + PAGE_SIZE_4K); test_error_eq(err, seL4_NoError); err = seL4_ARCH_PageDirectory_Invalidate_Data(env->page_directory, vstart, vstart + PAGE_SIZE_4K); - test_error_eq(err, seL4_IllegalOperation); + test_error_eq(err, invalidate_should_fail() ? seL4_IllegalOperation : seL4_NoError); err = seL4_ARCH_PageDirectory_CleanInvalidate_Data(env->page_directory, vstart, vstart + PAGE_SIZE_4K); test_error_eq(err, seL4_NoError); err = seL4_ARCH_PageDirectory_Unify_Instruction(env->page_directory, vstart, vstart + PAGE_SIZE_4K); @@ -534,7 +538,7 @@ static int test_cache_read_only(env_t env) err = seL4_ARM_Page_Clean_Data(frame, 0, PAGE_SIZE_4K); test_error_eq(err, seL4_NoError); err = seL4_ARM_Page_Invalidate_Data(frame, 0, PAGE_SIZE_4K); - test_error_eq(err, seL4_IllegalOperation); + test_error_eq(err, invalidate_should_fail() ? seL4_IllegalOperation : seL4_NoError); err = seL4_ARM_Page_CleanInvalidate_Data(frame, 0, PAGE_SIZE_4K); test_error_eq(err, seL4_NoError); err = seL4_ARM_Page_Unify_Instruction(frame, 0, PAGE_SIZE_4K);