]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
core: add memory flag ROOTSHARED and use it
authorHenning Schild <henning.schild@siemens.com>
Mon, 24 Nov 2014 17:54:03 +0000 (18:54 +0100)
committerJan Kiszka <jan.kiszka@siemens.com>
Tue, 25 Nov 2014 12:19:00 +0000 (13:19 +0100)
This patch introduces a memory flag to express shared memory with the
root cell. Memory regions with that flag will stay mapped in the root
cell on non-root-cell creation and do not need to be mapped back into
the root cell on non-root-cell destruction.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
hypervisor/control.c
hypervisor/include/jailhouse/cell-config.h

index dc371145a88c87f3028037b7efdecfa1b0e016ff..8c53b4b5f50fe72ca26b7bd3e9bb755733140ecf 100644 (file)
@@ -334,7 +334,8 @@ static void cell_destroy_internal(struct per_cpu *cpu_data, struct cell *cell)
                 * thus no hugepages need to be broken up to unmap it.
                 */
                arch_unmap_memory_region(cell, mem);
-               if (!(mem->flags & JAILHOUSE_MEM_COMM_REGION))
+               if (!(mem->flags & (JAILHOUSE_MEM_COMM_REGION |
+                                   JAILHOUSE_MEM_ROOTSHARED)))
                        remap_to_root_cell(mem, WARN_ON_ERROR);
        }
 
@@ -452,8 +453,10 @@ static int cell_create(struct per_cpu *cpu_data, unsigned long config_address)
                /*
                 * Unmap exceptions:
                 *  - the communication region is not backed by root memory
+                *  - regions that may be shared with the root cell
                 */
-               if (!(mem->flags & JAILHOUSE_MEM_COMM_REGION)) {
+               if (!(mem->flags & (JAILHOUSE_MEM_COMM_REGION |
+                                   JAILHOUSE_MEM_ROOTSHARED))) {
                        err = unmap_from_root_cell(mem);
                        if (err)
                                goto err_destroy_cell;
index d65894f43ac50e3504e8208614c7df0f8ad6a9fa..23145b828f8ac95a0d61446dc84279b9ba48decb 100644 (file)
@@ -35,13 +35,15 @@ struct jailhouse_cell_desc {
 #define JAILHOUSE_MEM_DMA              0x0008
 #define JAILHOUSE_MEM_COMM_REGION      0x0010
 #define JAILHOUSE_MEM_LOADABLE         0x0020
+#define JAILHOUSE_MEM_ROOTSHARED       0x0040
 
 #define JAILHOUSE_MEM_VALID_FLAGS      (JAILHOUSE_MEM_READ | \
                                         JAILHOUSE_MEM_WRITE | \
                                         JAILHOUSE_MEM_EXECUTE | \
                                         JAILHOUSE_MEM_DMA | \
                                         JAILHOUSE_MEM_COMM_REGION | \
-                                        JAILHOUSE_MEM_LOADABLE)
+                                        JAILHOUSE_MEM_LOADABLE | \
+                                        JAILHOUSE_MEM_ROOTSHARED)
 
 struct jailhouse_memory {
        __u64 phys_start;