After `jailhouse disable`, there is still an IO entry from /proc/iomem for jailhouse, so call jailhouse_firmware_free when disabling jailhouse for fix this. Also drop the call to jailhouse_firmware_free when enabling jailhouse.
Signed-off-by: Peng Fan <[email protected]> --- driver/main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/driver/main.c b/driver/main.c index fe752753..5cdb5892 100644 --- a/driver/main.c +++ b/driver/main.c @@ -306,8 +306,11 @@ static void jailhouse_firmware_free(void) resource_size(hypervisor_mem_res)); hypervisor_mem_res = NULL; } - vunmap(hypervisor_mem); - hypervisor_mem = NULL; + + if (hypervisor_mem) { + vunmap(hypervisor_mem); + hypervisor_mem = NULL; + } } int jailhouse_console_dump_delta(char *dst, unsigned int head, @@ -437,10 +440,6 @@ static int jailhouse_cmd_enable(struct jailhouse_system __user *arg) #ifdef JAILHOUSE_BORROW_ROOT_PT remap_addr = JAILHOUSE_BASE; #endif - /* Unmap hypervisor_mem from a previous "enable". The mapping has to be - * redone since the root-cell config might have changed. */ - jailhouse_firmware_free(); - hypervisor_mem_res = request_mem_region(hv_mem->phys_start, hv_mem->size, "Jailhouse hypervisor"); @@ -701,6 +700,7 @@ static int jailhouse_cmd_disable(void) update_last_console(); jailhouse_cell_delete_root(); + jailhouse_firmware_free(); jailhouse_enabled = false; module_put(THIS_MODULE); -- 2.16.4 -- 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]. For more options, visit https://groups.google.com/d/optout.
