---
driver/cell.c | 10 +++++++++-
driver/cell.h | 1 +
driver/main.c | 4 ++++
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/driver/cell.c b/driver/cell.c
index ade61edb..8a9fccb4 100644
--- a/driver/cell.c
+++ b/driver/cell.c
@@ -333,7 +333,15 @@ static int load_image(struct cell *cell,
if (regions == 0)
return -EINVAL;
- phys_start = (mem->phys_start + image_offset) & PAGE_MASK;
+ if (mem->flags & JAILHOUSE_MEM_COLORED) {
+ /* Tweak the base address to request remapping of
+ * a reserved, high memory region.
+ */
+ phys_start = (mem->virt_start + image_offset +
+ root_cell->color_root_map_offset) & PAGE_MASK;
+ } else {
+ 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));
diff --git a/driver/cell.h b/driver/cell.h
index 92afbff8..51afe6d8 100644
--- a/driver/cell.h
+++ b/driver/cell.h
@@ -32,6 +32,7 @@ struct cell {
cpumask_t cpus_assigned;
u32 num_memory_regions;
struct jailhouse_memory *memory_regions;
+ u64 color_root_map_offset;
#ifdef CONFIG_PCI
u32 num_pci_devices;
struct jailhouse_pci_device *pci_devices;
diff --git a/driver/main.c b/driver/main.c
index 64e2b9a4..bdf4f8a1 100644
--- a/driver/main.c
+++ b/driver/main.c
@@ -579,6 +579,10 @@ static int jailhouse_cmd_enable(struct jailhouse_system
__user *arg)
if (err)
goto error_unmap;
+ /* coloring temporary load-mapping address */
+ root_cell->color_root_map_offset =
+ config->platform_info.color.root_map_offset;
+
error_code = 0;
preempt_disable();
--
2.30.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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jailhouse-dev/20210322194507.82643-4-andrea.bastoni%40tum.de.