Introduce two new variables to synchronize the vCPUs during atomic
operations.

- exit_flush_request allows one vCPU to make an exclusive flush request for all
  the running vCPUs
- tcg_excl_access_lock is a mutex that protects all the sensible
  operations concerning atomic instruction emulation. Most of all, the
  mutex is used to protect the env->exclusive_protected_hwaddr (one
  mutex for all vCPUs).

Suggested-by: Jani Kokkonen <jani.kokko...@huawei.com>
Suggested-by: Claudio Fontana <claudio.font...@huawei.com>
Signed-off-by: Alvise Rigo <a.r...@virtualopensystems.com>
---
 cputlb.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cputlb.c b/cputlb.c
index 9794e6b..66df41a 100644
--- a/cputlb.c
+++ b/cputlb.c
@@ -39,6 +39,10 @@ void qemu_mutex_unlock_iothread(void);
 /* statistics */
 int tlb_flush_count;
 
+/* For atomic instruction handling. */
+volatile int exit_flush_request = 0;
+QemuMutex tcg_excl_access_lock;
+
 /* NOTE:
  * If flush_global is true (the usual case), flush all tlb entries.
  * If flush_global is false, flush (at least) all tlb entries not
-- 
2.4.5


Reply via email to