tcg: make tcg_allowed global
authorYang Zhong <yang.zhong@intel.com>
Mon, 3 Jul 2017 10:12:12 +0000 (18:12 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 4 Jul 2017 14:01:16 +0000 (16:01 +0200)
Change the tcg_enabled() and make sure user build still enable tcg
even x86 softmmu disable tcg.

Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
accel/tcg/cpu-exec-common.c
accel/tcg/tcg-all.c
accel/tcg/translate-all.c
include/qemu-common.h

index e81da276bb0cd78ab2c655f60e7a6001ab8161fd..5b4ae54a4dfa918a34709fe4ab304d7cc7d24915 100644 (file)
@@ -23,6 +23,8 @@
 #include "exec/exec-all.h"
 #include "exec/memory-internal.h"
 
+bool tcg_allowed;
+
 /* exit the current TB, but without causing any exception to be raised */
 void cpu_loop_exit_noexc(CPUState *cpu)
 {
index c1ccad34f1c4f1a8e931fb72db0d12353463756d..56dbb56a1657018b950b221ec6f54ffec1d18ca2 100644 (file)
@@ -33,7 +33,6 @@
 #include "qemu/main-loop.h"
 
 unsigned long tcg_tb_size;
-static bool tcg_allowed = true;
 
 #ifndef CONFIG_USER_ONLY
 /* mask must never be zero, except for A20 change call */
index 4fda383924fd2fb5f98ed4904521c525688d6f4f..f768681188f7d33c98265dbac9b84d8ac8f8f511 100644 (file)
@@ -784,6 +784,7 @@ static void tb_htable_init(void)
    size. */
 void tcg_exec_init(unsigned long tb_size)
 {
+    tcg_allowed = true;
     cpu_gen_init();
     page_init();
     tb_htable_init();
@@ -795,11 +796,6 @@ void tcg_exec_init(unsigned long tb_size)
 #endif
 }
 
-bool tcg_enabled(void)
-{
-    return tcg_ctx.code_gen_buffer != NULL;
-}
-
 /*
  * Allocate a new translation block. Flush the translation buffer if
  * too many translation blocks or too much generated code.
index 387ef520bf33765bb54656f4b6aedd0152b7ef56..b5adbfa5e9dae3bc976cf69b418d65cd538706f0 100644 (file)
@@ -76,8 +76,13 @@ int qemu_openpty_raw(int *aslave, char *pty_name);
     sendto(sockfd, buf, len, flags, destaddr, addrlen)
 #endif
 
+extern bool tcg_allowed;
 void tcg_exec_init(unsigned long tb_size);
-bool tcg_enabled(void);
+#ifdef CONFIG_TCG
+#define tcg_enabled() (tcg_allowed)
+#else
+#define tcg_enabled() 0
+#endif
 
 void cpu_exec_init_all(void);
 void cpu_exec_step_atomic(CPUState *cpu);