aboutsummaryrefslogtreecommitdiff
path: root/accel
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2022-07-11 15:00:28 -0700
committerLaurent Vivier <laurent@vivier.eu>2022-08-11 11:34:17 +0200
commitdbbf89751b14aa5d281bad3af273e9ffaae82262 (patch)
tree79285544e4a484e0631a97263a6d7bf5caa37790 /accel
parenta6b1c53e79d08a99a28cc3e67a3e1a7c34102d6b (diff)
downloadqemu-dbbf89751b14aa5d281bad3af273e9ffaae82262.zip
qemu-dbbf89751b14aa5d281bad3af273e9ffaae82262.tar.gz
qemu-dbbf89751b14aa5d281bad3af273e9ffaae82262.tar.bz2
linux-user/aarch64: Reset target data on MADV_DONTNEED
aarch64 stores MTE tags in target_date, and they should be reset by MADV_DONTNEED. Signed-off-by: Vitaly Buka <vitalybuka@google.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220711220028.2467290-1-vitalybuka@google.com> [lv: fix code style issues] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'accel')
-rw-r--r--accel/tcg/translate-all.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index ef62a19..b83161a 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -2314,6 +2314,32 @@ void page_set_flags(target_ulong start, target_ulong end, int flags)
}
}
+void page_reset_target_data(target_ulong start, target_ulong end)
+{
+ target_ulong addr, len;
+
+ /*
+ * This function should never be called with addresses outside the
+ * guest address space. If this assert fires, it probably indicates
+ * a missing call to h2g_valid.
+ */
+ assert(end - 1 <= GUEST_ADDR_MAX);
+ assert(start < end);
+ assert_memory_lock();
+
+ start = start & TARGET_PAGE_MASK;
+ end = TARGET_PAGE_ALIGN(end);
+
+ for (addr = start, len = end - start;
+ len != 0;
+ len -= TARGET_PAGE_SIZE, addr += TARGET_PAGE_SIZE) {
+ PageDesc *p = page_find_alloc(addr >> TARGET_PAGE_BITS, 1);
+
+ g_free(p->target_data);
+ p->target_data = NULL;
+ }
+}
+
void *page_get_target_data(target_ulong address)
{
PageDesc *p = page_find(address >> TARGET_PAGE_BITS);