Signed-off-by: Andrea Bastoni <andrea.bast...@tum.de>
---
 hypervisor/arch/arm64/include/asm/coloring.h | 21 ++++++++------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/hypervisor/arch/arm64/include/asm/coloring.h 
b/hypervisor/arch/arm64/include/asm/coloring.h
index f8bc1107..b2911a4b 100644
--- a/hypervisor/arch/arm64/include/asm/coloring.h
+++ b/hypervisor/arch/arm64/include/asm/coloring.h
@@ -21,6 +21,7 @@
 #include <jailhouse/utils.h>
 #include <jailhouse/control.h>
 #include <jailhouse/assert.h>
+#include <jailhouse/panic.h>
 #include <asm/cache_layout.h>
 
 #ifdef CONFIG_DEBUG
@@ -76,10 +77,6 @@ static inline void arm_color_init(void)
        if (coloring_way_size == 0) {
                coloring_way_size = arm_cache_layout_detect();
        }
-
-       if (coloring_way_size == 0) {
-               col_print("Warning: no way size configured.\n");
-       }
 #endif
        coloring_root_map_offset =
                system_config->platform_info.color.root_map_offset;
@@ -107,8 +104,12 @@ static inline int arch_color_map_memory_region(
                struct cell *cell,
                const struct jailhouse_memory *mr)
 {
+       /* Cell create is the first action that can request a color
+        * operation. Panic if we cannot perform it.
+        */
        if (coloring_way_size == 0) {
-               return -ENODEV;
+               printk("[COL] Way size = 0, but coloring requested\n");
+               panic_stop();
        }
 
        assert(!JAILHOUSE_MEMORY_IS_SUBPAGE(mr));
@@ -118,19 +119,13 @@ static inline int arch_color_map_memory_region(
 
 static inline int arch_color_remap_to_root(const struct jailhouse_memory *mr)
 {
-       if (coloring_way_size == 0) {
-               return -ENODEV;
-       }
-
+       assert(coloring_way_size != 0);
        return color_cell_op(&root_cell, mr, COL_OP_LOAD, 0);
 }
 
 static inline int arch_color_unmap_from_root(const struct jailhouse_memory *mr)
 {
-       if (coloring_way_size == 0) {
-               return -ENODEV;
-       }
-
+       assert(coloring_way_size != 0);
        return color_cell_op(&root_cell, mr, COL_OP_START, 0);
 }
 
-- 
2.29.2

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/20210125120044.56794-16-andrea.bastoni%40tum.de.

Reply via email to