Skip to content

Commit

Permalink
cache: only expect errors for EL1 armv8-a
Browse files Browse the repository at this point in the history
On armv7-a and in EL-2, the corresponding operations are safe for the
kernel to perform.

Signed-off-by: Gerwin Klein <[email protected]>
  • Loading branch information
lsf37 committed Jul 3, 2024
1 parent 36dd4cf commit 13b9de7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions apps/sel4test-tests/src/tests/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
/*
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 13b9de7

Please sign in to comment.