[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 03/10] vl: implement tcg_enabled() and tcg_avail
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [RFC PATCH 03/10] vl: implement tcg_enabled() and tcg_available() as for other accelerators |
Date: |
Mon, 17 Sep 2012 18:00:42 +0200 |
From: Anthony Liguori <address@hidden>
This way, tcg_enabled() can be used to stub out entire sections of code
that are not used on TCG. This will limit the use of #ifdef and improves
code checking from the compiler.
Signed-off-by: Anthony Liguori <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
arch_init.c | 4 ++++
exec.c | 6 +-----
qemu-common.h | 8 +++++++-
vl.c | 2 +-
4 file modificati, 13 inserzioni(+), 7 rimozioni(-)
diff --git a/arch_init.c b/arch_init.c
index 5a1173e..fb41467 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -1061,7 +1061,11 @@ int audio_available(void)
int tcg_available(void)
{
+#if defined(CONFIG_TCG)
return 1;
+#else
+ return 0;
+#endif
}
int kvm_available(void)
diff --git a/exec.c b/exec.c
index 5834766..1270d78 100644
--- a/exec.c
+++ b/exec.c
@@ -615,6 +615,7 @@ static void code_gen_alloc(unsigned long tb_size)
size. */
void tcg_exec_init(unsigned long tb_size)
{
+ tcg_allowed = 1;
cpu_gen_init();
code_gen_alloc(tb_size);
code_gen_ptr = code_gen_buffer;
@@ -627,11 +628,6 @@ void tcg_exec_init(unsigned long tb_size)
#endif
}
-bool tcg_enabled(void)
-{
- return code_gen_buffer != NULL;
-}
-
void cpu_exec_init_all(void)
{
#if !defined(CONFIG_USER_ONLY)
diff --git a/qemu-common.h b/qemu-common.h
index e5c2bcd..6a3b075 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -301,8 +301,14 @@ typedef struct PCIHostDeviceAddress {
unsigned int function;
} PCIHostDeviceAddress;
+extern int 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);
diff --git a/vl.c b/vl.c
index 7c577fa..fa022d1 100644
--- a/vl.c
+++ b/vl.c
@@ -260,7 +260,7 @@ static NotifierList exit_notifiers =
static NotifierList machine_init_done_notifiers =
NOTIFIER_LIST_INITIALIZER(machine_init_done_notifiers);
-static int tcg_allowed = 1;
+int tcg_allowed = 0;
int kvm_allowed = 0;
int xen_allowed = 0;
uint32_t xen_domid;
--
1.7.12
- Re: [Qemu-devel] [RFC PATCH 01/10] configure: factor out list of supported Xen/KVM targets, (continued)
- [Qemu-devel] [RFC PATCH 08/10] configure: add --disable-tcg configure option, Paolo Bonzini, 2012/09/17
- [Qemu-devel] [RFC PATCH 05/10] exec: small adjustments for TCG separation, Paolo Bonzini, 2012/09/17
- [Qemu-devel] [RFC PATCH 06/10] monitor: disable info jit if !TCG, Paolo Bonzini, 2012/09/17
- [Qemu-devel] [RFC PATCH 09/10] i386: move TCG functions out of helper.o, non-TCG functions to cpu.o, Paolo Bonzini, 2012/09/17
- [Qemu-devel] [RFC PATCH 07/10] configure: emit summary at the very end, Paolo Bonzini, 2012/09/17
- [Qemu-devel] [RFC PATCH 03/10] vl: implement tcg_enabled() and tcg_available() as for other accelerators,
Paolo Bonzini <=
- [Qemu-devel] [RFC PATCH 10/10] build: do not build TCG files if TCG is disabled, Paolo Bonzini, 2012/09/17
- [Qemu-devel] [RFC PATCH 04/10] tcg: change cpu_restore_state to return void, Paolo Bonzini, 2012/09/17
Re: [Qemu-devel] [RFC PATCH 00/10] Add --disable-tcg, Blue Swirl, 2012/09/17