From: Luca Miccio <[email protected]>

Do not use the memory physical address start when loading into colored
regions. Map the memory starting at col_load_address instead.
That region has been mapped by Jailhouse with the same color
configuration as the inmate and exposed as a virtually contiguous space.

Signed-off-by: Luca Miccio <[email protected]>
Signed-off-by: Marco Solieri <[email protected]>
---
 driver/cell.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/driver/cell.c b/driver/cell.c
index 50e344e5..f4bb8986 100644
--- a/driver/cell.c
+++ b/driver/cell.c
@@ -325,7 +325,13 @@ static int load_image(struct cell *cell,
        if (regions == 0)
                return -EINVAL;
 
-       phys_start = (mem->phys_start + image_offset) & PAGE_MASK;
+#ifdef CONFIG_COLORING
+       if (mem->flags & JAILHOUSE_MEM_COLORED)
+               phys_start = (root_cell->col_load_address + image_offset)
+                       & PAGE_MASK;
+       else
+#endif
+               phys_start = (mem->phys_start + image_offset) & PAGE_MASK;
        page_offs = offset_in_page(image_offset);
        image_mem = jailhouse_ioremap(phys_start, 0,
                                      PAGE_ALIGN(image.size + page_offs));
-- 
2.25.1

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/20200421100351.292395-7-ms%40xt3.it.

Reply via email to