From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCH v4 4/7] cpu: Introduce a wrapper for tlb_flush() that can be used in common code
Date: Mon, 26 Jun 2017 07:22:55 +0200 [thread overview]
Message-ID: <1498454578-18709-5-git-send-email-thuth@redhat.com> (raw)
In-Reply-To: <1498454578-18709-1-git-send-email-thuth@redhat.com>
Commit 1f5c00cfdb8114c ("qom/cpu: move tlb_flush to cpu_common_reset")
moved the call to tlb_flush() from the target-specific reset handlers
into the common code qom/cpu.c file, and protected the call with
"#ifdef CONFIG_SOFTMMU" to avoid that it is called for linux-user
only targets. But since qom/cpu.c is common code, CONFIG_SOFTMMU is
*never* defined here, so the tlb_flush() was simply never executed
anymore. Fix it by introducing a wrapper for tlb_flush() in a file
that is re-compiled for each target, i.e. in translate-all.c.
Fixes: 1f5c00cfdb8114c1e3a13426588ceb64f82c9ddb
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
accel/tcg/translate-all.c | 8 ++++++++
include/exec/cpu-common.h | 2 ++
qom/cpu.c | 5 ++---
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index f6ad46b..a3f374e 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -2225,3 +2225,11 @@ int page_unprotect(target_ulong address, uintptr_t pc)
return 0;
}
#endif /* CONFIG_USER_ONLY */
+
+/* This is a wrapper for common code that can not use CONFIG_SOFTMMU */
+void tcg_flush_softmmu_tlb(CPUState *cs)
+{
+#ifdef CONFIG_SOFTMMU
+ tlb_flush(cs);
+#endif
+}
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index 4d45a72..74341b1 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -28,6 +28,8 @@ void qemu_init_cpu_list(void);
void cpu_list_lock(void);
void cpu_list_unlock(void);
+void tcg_flush_softmmu_tlb(CPUState *cs);
+
#if !defined(CONFIG_USER_ONLY)
enum device_endian {
diff --git a/qom/cpu.c b/qom/cpu.c
index 5069876..303eb42 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -26,6 +26,7 @@
#include "qemu/notify.h"
#include "qemu/log.h"
#include "exec/log.h"
+#include "exec/cpu-common.h"
#include "qemu/error-report.h"
#include "sysemu/sysemu.h"
#include "hw/qdev-properties.h"
@@ -296,9 +297,7 @@ static void cpu_common_reset(CPUState *cpu)
atomic_set(&cpu->tb_jmp_cache[i], NULL);
}
-#ifdef CONFIG_SOFTMMU
- tlb_flush(cpu, 0);
-#endif
+ tcg_flush_softmmu_tlb(cpu);
}
}
--
1.8.3.1
next prev parent reply other threads:[~2017-06-26 5:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-26 5:22 [Qemu-devel] [PATCH v4 0/7] Poison some more target-specific defines Thomas Huth
2017-06-26 5:22 ` [Qemu-devel] [PATCH v4 1/7] include/exec/poison: Add some more missing TARGET and CONFIG defines Thomas Huth
2017-06-26 5:22 ` [Qemu-devel] [PATCH v4 2/7] Move CONFIG_KVM related definitions to kvm_i386.h Thomas Huth
2017-06-26 11:12 ` Philippe Mathieu-Daudé
2017-06-26 5:22 ` [Qemu-devel] [PATCH v4 3/7] include/exec/poison: Mark CONFIG_KVM as poisoned, too Thomas Huth
2017-06-26 5:22 ` Thomas Huth [this message]
2017-06-26 5:22 ` [Qemu-devel] [PATCH v4 5/7] include/exec/poison: Mark CONFIG_SOFTMMU as poisoned Thomas Huth
2017-06-26 5:22 ` [Qemu-devel] [PATCH v4 6/7] Makefile: Move bootdevice.o to common-obj-y Thomas Huth
2017-06-26 11:12 ` Philippe Mathieu-Daudé
2017-06-26 5:22 ` [Qemu-devel] [PATCH v4 7/7] hw/misc/edu: Compile the edu device as common object Thomas Huth
2017-06-26 11:13 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1498454578-18709-5-git-send-email-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).