From ff53f7f6221e8780667bbe509bd0a688f70734a8 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Mon, 13 Jul 2015 09:06:54 +0200 Subject: [PATCH] arm: Unmap virtual GIC on cell destruction This fixes a leak on cell destruction because we left the GICv2 mapped, thus didn't free all paging structures. This also means we need to run the irqchip cleanup before the cell MMU destruction. Signed-off-by: Jan Kiszka --- hypervisor/arch/arm/control.c | 4 ++-- hypervisor/arch/arm/gic-v2.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hypervisor/arch/arm/control.c b/hypervisor/arch/arm/control.c index bfd79c0..a077736 100644 --- a/hypervisor/arch/arm/control.c +++ b/hypervisor/arch/arm/control.c @@ -366,8 +366,6 @@ void arch_cell_destroy(struct cell *cell) unsigned int cpu; struct per_cpu *percpu; - arch_mmu_cell_destroy(cell); - for_each_cpu(cpu, cell->cpu_set) { percpu = per_cpu(cpu); /* Re-assign the physical IDs for the root cell */ @@ -376,6 +374,8 @@ void arch_cell_destroy(struct cell *cell) } irqchip_cell_exit(cell); + + arch_mmu_cell_destroy(cell); } /* Note: only supports synchronous flushing as triggered by config_commit! */ diff --git a/hypervisor/arch/arm/gic-v2.c b/hypervisor/arch/arm/gic-v2.c index a87894f..16937b1 100644 --- a/hypervisor/arch/arm/gic-v2.c +++ b/hypervisor/arch/arm/gic-v2.c @@ -198,6 +198,8 @@ static int gic_cell_init(struct cell *cell) static void gic_cell_exit(struct cell *cell) { + paging_destroy(&cell->arch.mm, (unsigned long)gicc_base, gicc_size, + PAGING_NON_COHERENT); /* Reset interrupt routing of the cell's spis */ gic_target_spis(cell, &root_cell); } -- 2.39.2