diff mbox

[RFC,v3,10/13] Simple TLB flush wrap to use as exit callback

Message ID 1436516626-8322-11-git-send-email-a.rigo@virtualopensystems.com
State New
Headers show

Commit Message

Alvise Rigo July 10, 2015, 8:23 a.m. UTC
Add a new way to query a TLB flush request for a given vCPU using the
new callback support.

Suggested-by: Jani Kokkonen <jani.kokkonen@huawei.com>
Suggested-by: Claudio Fontana <claudio.fontana@huawei.com>
Signed-off-by: Alvise Rigo <a.rigo@virtualopensystems.com>
---
 cputlb.c          | 6 ++++++
 include/qom/cpu.h | 1 +
 2 files changed, 7 insertions(+)
diff mbox

Patch

diff --git a/cputlb.c b/cputlb.c
index fa38714..9794e6b 100644
--- a/cputlb.c
+++ b/cputlb.c
@@ -85,6 +85,12 @@  static void tlb_flush_async_work(void *opaque)
     g_free(params);
 }
 
+static void cpu_exit_tlb_flush_all_cb(CPUState *cpu, void *opaque)
+{
+    tlb_flush(cpu, 1);
+    cpu->pending_tlb_flush = 0;
+}
+
 void tlb_flush_all(int flush_global)
 {
     CPUState *cpu;
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 0ec020b..c5b93c9 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -326,6 +326,7 @@  struct CPUState {
     /* One-shot callbacks for stopping requests. */
     struct CPUExitCBs exit_cbs;
     volatile int pending_rdv;
+    volatile int pending_tlb_flush;
 
     /* In order to avoid passing too many arguments to the MMIO helpers,
      * we store some rarely used information in the CPU context.