aboutsummaryrefslogtreecommitdiff
path: root/accel
diff options
context:
space:
mode:
authorEmilio G. Cota <cota@braap.org>2020-06-12 20:02:26 +0100
committerAlex Bennée <alex.bennee@linaro.org>2020-06-16 14:49:05 +0100
commit816d9be5ea31d848ee090eca4a2bf185bd609066 (patch)
tree2783dc7a4bcac84b1f55a6e952b3c7115b5e22fb /accel
parent4384a70d0188a356d85a80c62ae88ec5aef8b3ee (diff)
downloadqemu-816d9be5ea31d848ee090eca4a2bf185bd609066.zip
qemu-816d9be5ea31d848ee090eca4a2bf185bd609066.tar.gz
qemu-816d9be5ea31d848ee090eca4a2bf185bd609066.tar.bz2
cputlb: destroy CPUTLB with tlb_destroy
I was after adding qemu_spin_destroy calls, but while at it I noticed that we are leaking some memory. Signed-off-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Robert Foley <robert.foley@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20200609200738.445-5-robert.foley@linaro.org> Message-Id: <20200612190237.30436-8-alex.bennee@linaro.org>
Diffstat (limited to 'accel')
-rw-r--r--accel/tcg/cputlb.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index eb2cf9d..1e81535 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -270,6 +270,21 @@ void tlb_init(CPUState *cpu)
}
}
+void tlb_destroy(CPUState *cpu)
+{
+ CPUArchState *env = cpu->env_ptr;
+ int i;
+
+ qemu_spin_destroy(&env_tlb(env)->c.lock);
+ for (i = 0; i < NB_MMU_MODES; i++) {
+ CPUTLBDesc *desc = &env_tlb(env)->d[i];
+ CPUTLBDescFast *fast = &env_tlb(env)->f[i];
+
+ g_free(fast->table);
+ g_free(desc->iotlb);
+ }
+}
+
/* flush_all_helper: run fn across all cpus
*
* If the wait flag is set then the src cpu's helper will be queued as