All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG
@ 2011-09-02 21:47 Anthony Liguori
  2011-09-02 21:47 ` [Qemu-devel] [PATCH 1/5] configure: add --disable-tcg configure option Anthony Liguori
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Anthony Liguori @ 2011-09-02 21:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Graf, Stefano Stabellini

Hi,

There have been a few attempts in the past to allow TCG to be disabled
at build time.  Recently, Alex made the suggestion that we could do it by using
the same trick that we used to introduce kvm support.  That involves introducing
a tcg_enabled() macro that will be (0) if TCG is disabled in the build.

GCC is smart enough to do dead code elimination if it sees an if (0) and the
result is that if you can do:

if (tcg_enabled()) {
  foo();
}

and it's more or less equivalent to:

#ifdef CONFIG_TCG
  foo();
#endif

Without the ugliness that comes from using the preprocessor.  I think this ended
up being pretty straight forward.  exec.c could use a fair bit of cleanup but
other than that, this pretty much eliminates all of the TCG code from the build.

This absolutely is going to break non-x86 KVM builds if they use the
--disable-tcg flag as I haven't tested those yet.  The normal TCG build
shouldn't be affected at all though.

In principle, the code assumes that you need KVM if you don't have TCG.  Of
course, some extra logic could be added to allow for Xen if TCG isn't present.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH 1/5] configure: add --disable-tcg configure option
  2011-09-02 21:47 [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG Anthony Liguori
@ 2011-09-02 21:47 ` Anthony Liguori
  2011-09-02 21:48 ` [Qemu-devel] [PATCH 2/5] vl: don't expose TCG as a supported accelerator if TCG is disabled Anthony Liguori
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Anthony Liguori @ 2011-09-02 21:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Alex Graf, Stefano Stabellini

This lets you build without TCG (KVM only).  When this flag is passed to
configure, it will automatically filter out the target list to only those that
support KVM.

I guess the same could be done for Xen but I'll let the Xen folks figure that
one out :-)

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 configure |   40 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 39 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index a8ea688..04f121c 100755
--- a/configure
+++ b/configure
@@ -130,6 +130,7 @@ xen_ctrl_version=""
 linux_aio=""
 attr=""
 xfs=""
+tcg="yes"
 
 vhost_net="no"
 kvm="no"
@@ -643,6 +644,10 @@ for opt do
   ;;
   --enable-kvm) kvm="yes"
   ;;
+  --disable-tcg) tcg="no"
+  ;;
+  --enable-tcg) tcg="yes"
+  ;;
   --disable-spice) spice="no"
   ;;
   --enable-spice) spice="yes"
@@ -2877,7 +2882,6 @@ qemu_version=`head $source_path/VERSION`
 echo "VERSION=$qemu_version" >>$config_host_mak
 echo "PKGVERSION=$pkgversion" >>$config_host_mak
 echo "SRC_PATH=$source_path" >> $config_host_mak
-echo "TARGET_DIRS=$target_list" >> $config_host_mak
 if [ "$docs" = "yes" ] ; then
   echo "BUILD_DOCS=yes" >> $config_host_mak
 fi
@@ -3135,6 +3139,23 @@ if test "$static" = "no" -a "$user_pie" = "yes" ; then
   echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
 fi
 
+kvm_incompatible() {
+    if test "$kvm" = "yes" -a \
+      \( "$1" = "$cpu" -o \
+      \( "$1" = "ppcemb" -a "$cpu" = "ppc" \) -o \
+      \( "$1" = "ppc64"  -a "$cpu" = "ppc" \) -o \
+      \( "$1" = "ppc"    -a "$cpu" = "ppc64" \) -o \
+      \( "$1" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
+      \( "$1" = "x86_64" -a "$cpu" = "i386"   \) -o \
+      \( "$1" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
+	return 1
+    else
+	return 0
+    fi
+}
+
+target_list2=
+
 for target in $target_list; do
 target_dir="$target"
 config_target_mak=$target_dir/config-target.mak
@@ -3185,6 +3206,17 @@ case "$target" in
     ;;
 esac
 
+if test "$tcg" = "no"; then
+    if test "$target_softmmu" = "no"; then
+	continue;
+    fi
+    if kvm_incompatible "$target_arch2"; then
+	continue;
+    fi
+fi
+
+target_list2="$target $target_list2"
+
 mkdir -p $target_dir
 mkdir -p $target_dir/fpu
 mkdir -p $target_dir/tcg
@@ -3213,6 +3245,10 @@ TARGET_ARCH="$target_arch2"
 TARGET_BASE_ARCH=""
 TARGET_ABI_DIR=""
 
+if test "$tcg" = "yes"; then
+  echo "CONFIG_TCG=1" >> $config_target_mak
+fi
+
 case "$target_arch2" in
   i386)
     target_phys_bits=64
@@ -3598,6 +3634,8 @@ echo "QEMU_INCLUDES+=$includes" >> $config_target_mak
 
 done # for target in $targets
 
+echo "TARGET_DIRS=$target_list2" >> $config_host_mak
+
 # build tree in object directory in case the source is not in the current directory
 DIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
 DIRS="$DIRS pc-bios/spapr-rtas"
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH 2/5] vl: don't expose TCG as a supported accelerator if TCG is disabled
  2011-09-02 21:47 [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG Anthony Liguori
  2011-09-02 21:47 ` [Qemu-devel] [PATCH 1/5] configure: add --disable-tcg configure option Anthony Liguori
@ 2011-09-02 21:48 ` Anthony Liguori
  2011-09-02 21:48 ` [Qemu-devel] [PATCH 3/5] tcg: add tcg_enabled() and stop compiling translate.o when " Anthony Liguori
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Anthony Liguori @ 2011-09-02 21:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Alex Graf, Stefano Stabellini

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 arch_init.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch_init.c b/arch_init.c
index 567ab32..5b37f8d 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -711,7 +711,11 @@ int audio_available(void)
 
 int tcg_available(void)
 {
+#if defined(CONFIG_TCG)
     return 1;
+#else
+    return 0;
+#endif
 }
 
 int kvm_available(void)
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH 3/5] tcg: add tcg_enabled() and stop compiling translate.o when TCG is disabled
  2011-09-02 21:47 [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG Anthony Liguori
  2011-09-02 21:47 ` [Qemu-devel] [PATCH 1/5] configure: add --disable-tcg configure option Anthony Liguori
  2011-09-02 21:48 ` [Qemu-devel] [PATCH 2/5] vl: don't expose TCG as a supported accelerator if TCG is disabled Anthony Liguori
@ 2011-09-02 21:48 ` Anthony Liguori
  2011-09-02 23:51   ` Peter Maydell
  2011-09-02 21:48 ` [Qemu-devel] [PATCH 4/5] tcg: don't build tcg/tcg.o, tcg/optimize.o, or translate-all.o when TCG disabled Anthony Liguori
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Anthony Liguori @ 2011-09-02 21:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Alex Graf, Stefano Stabellini

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 Makefile.target |    3 ++-
 cpu-all.h       |    6 ++++++
 exec.c          |    2 +-
 qemu-common.h   |    2 +-
 translate-all.c |   12 +++++++++---
 5 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/Makefile.target b/Makefile.target
index 0787758..70f52cc 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -67,10 +67,11 @@ all: $(PROGS) stap
 
 #########################################################
 # cpu emulator library
-libobj-y = exec.o translate-all.o cpu-exec.o translate.o
+libobj-y = exec.o translate-all.o cpu-exec.o
 libobj-y += tcg/tcg.o tcg/optimize.o
 libobj-y += fpu/softfloat.o
 libobj-y += op_helper.o helper.o
+libobj-$(CONFIG_TCG) += translate.o
 ifeq ($(TARGET_BASE_ARCH), i386)
 libobj-y += cpuid.o
 endif
diff --git a/cpu-all.h b/cpu-all.h
index f5c82cd..84a852c 100644
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -22,6 +22,12 @@
 #include "qemu-common.h"
 #include "cpu-common.h"
 
+#if defined(CONFIG_TCG)
+#define tcg_enabled() (tcg_in_use())
+#else
+#define tcg_enabled() (0)
+#endif
+
 /* some important defines:
  *
  * WORDS_ALIGNED : if defined, the host cpu can only make word aligned
diff --git a/exec.c b/exec.c
index c1e045d..578da0e 100644
--- a/exec.c
+++ b/exec.c
@@ -585,7 +585,7 @@ void tcg_exec_init(unsigned long tb_size)
 #endif
 }
 
-bool tcg_enabled(void)
+bool tcg_in_use(void)
 {
     return code_gen_buffer != NULL;
 }
diff --git a/qemu-common.h b/qemu-common.h
index 404c421..02a3071 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -268,7 +268,7 @@ typedef struct QEMUSGList QEMUSGList;
 typedef uint64_t pcibus_t;
 
 void tcg_exec_init(unsigned long tb_size);
-bool tcg_enabled(void);
+bool tcg_in_use(void);
 
 void cpu_exec_init_all(void);
 
diff --git a/translate-all.c b/translate-all.c
index 041c108..ecb035a 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -67,7 +67,9 @@ int cpu_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr)
 #endif
     tcg_func_start(s);
 
-    gen_intermediate_code(env, tb);
+    if (tcg_enabled()) {
+        gen_intermediate_code(env, tb);
+    }
 
     /* generate machine code */
     gen_code_buf = tb->tc_ptr;
@@ -123,7 +125,9 @@ int cpu_restore_state(TranslationBlock *tb,
 #endif
     tcg_func_start(s);
 
-    gen_intermediate_code_pc(env, tb);
+    if (tcg_enabled()) {
+        gen_intermediate_code_pc(env, tb);
+    }
 
     if (use_icount) {
         /* Reset the cycle counter to the start of the block.  */
@@ -153,7 +157,9 @@ int cpu_restore_state(TranslationBlock *tb,
         j--;
     env->icount_decr.u16.low -= gen_opc_icount[j];
 
-    restore_state_to_opc(env, tb, j);
+    if (tcg_enabled()) {
+        restore_state_to_opc(env, tb, j);
+    }
 
 #ifdef CONFIG_PROFILER
     s->restore_time += profile_getclock() - ti;
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH 4/5] tcg: don't build tcg/tcg.o, tcg/optimize.o, or translate-all.o when TCG disabled
  2011-09-02 21:47 [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG Anthony Liguori
                   ` (2 preceding siblings ...)
  2011-09-02 21:48 ` [Qemu-devel] [PATCH 3/5] tcg: add tcg_enabled() and stop compiling translate.o when " Anthony Liguori
@ 2011-09-02 21:48 ` Anthony Liguori
  2011-09-03 12:07   ` Blue Swirl
  2011-09-02 21:48 ` [Qemu-devel] [PATCH 5/5] tcg: don't build cpu-exec.o, op_helper.o, or fpu/softloat.o " Anthony Liguori
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Anthony Liguori @ 2011-09-02 21:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Alex Graf, Stefano Stabellini

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 Makefile.target         |    6 +++---
 exec.c                  |   44 +++++++++++++++++++++++++++++---------------
 target-i386/op_helper.c |    2 +-
 translate-all.c         |   12 +++---------
 4 files changed, 36 insertions(+), 28 deletions(-)

diff --git a/Makefile.target b/Makefile.target
index 70f52cc..0a786b4 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -67,11 +67,11 @@ all: $(PROGS) stap
 
 #########################################################
 # cpu emulator library
-libobj-y = exec.o translate-all.o cpu-exec.o
-libobj-y += tcg/tcg.o tcg/optimize.o
+libobj-y = exec.o cpu-exec.o
 libobj-y += fpu/softfloat.o
 libobj-y += op_helper.o helper.o
-libobj-$(CONFIG_TCG) += translate.o
+libobj-$(CONFIG_TCG) += translate.o translate-all.o
+libobj-$(CONFIG_TCG) += tcg/tcg.o tcg/optimize.o
 ifeq ($(TARGET_BASE_ARCH), i386)
 libobj-y += cpuid.o
 endif
diff --git a/exec.c b/exec.c
index 578da0e..c7decb9 100644
--- a/exec.c
+++ b/exec.c
@@ -574,15 +574,17 @@ static void code_gen_alloc(unsigned long tb_size)
    size. */
 void tcg_exec_init(unsigned long tb_size)
 {
-    cpu_gen_init();
-    code_gen_alloc(tb_size);
-    code_gen_ptr = code_gen_buffer;
-    page_init();
+    if (tcg_enabled()) {
+        cpu_gen_init();
+        code_gen_alloc(tb_size);
+        code_gen_ptr = code_gen_buffer;
+        page_init();
 #if !defined(CONFIG_USER_ONLY) || !defined(CONFIG_USE_GUEST_BASE)
     /* There's no guest base to take into account, so go ahead and
        initialize the prologue now.  */
-    tcg_prologue_init(&tcg_ctx);
+        tcg_prologue_init(&tcg_ctx);
 #endif
+    }
 }
 
 bool tcg_in_use(void)
@@ -992,7 +994,6 @@ TranslationBlock *tb_gen_code(CPUState *env,
     uint8_t *tc_ptr;
     tb_page_addr_t phys_pc, phys_page2;
     target_ulong virt_page2;
-    int code_gen_size;
 
     phys_pc = get_page_addr_code(env, pc);
     tb = tb_alloc(pc);
@@ -1009,8 +1010,11 @@ TranslationBlock *tb_gen_code(CPUState *env,
     tb->cs_base = cs_base;
     tb->flags = flags;
     tb->cflags = cflags;
-    cpu_gen_code(env, tb, &code_gen_size);
-    code_gen_ptr = (void *)(((unsigned long)code_gen_ptr + code_gen_size + CODE_GEN_ALIGN - 1) & ~(CODE_GEN_ALIGN - 1));
+    if (tcg_enabled()) {
+        int code_gen_size;
+        cpu_gen_code(env, tb, &code_gen_size);
+        code_gen_ptr = (void *)(((unsigned long)code_gen_ptr + code_gen_size + CODE_GEN_ALIGN - 1) & ~(CODE_GEN_ALIGN - 1));
+    }
 
     /* check next page if needed */
     virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK;
@@ -1090,7 +1094,9 @@ void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
                 restore the CPU state */
 
                 current_tb_modified = 1;
-                cpu_restore_state(current_tb, env, env->mem_io_pc);
+                if (tcg_enabled()) {
+                    cpu_restore_state(current_tb, env, env->mem_io_pc);
+                }
                 cpu_get_tb_cpu_state(env, &current_pc, &current_cs_base,
                                      &current_flags);
             }
@@ -1198,9 +1204,11 @@ static void tb_invalidate_phys_page(tb_page_addr_t addr,
                    restore the CPU state */
 
             current_tb_modified = 1;
-            cpu_restore_state(current_tb, env, pc);
-            cpu_get_tb_cpu_state(env, &current_pc, &current_cs_base,
-                                 &current_flags);
+            if (tcg_enabled()) {
+                cpu_restore_state(current_tb, env, pc);
+                cpu_get_tb_cpu_state(env, &current_pc, &current_cs_base,
+                                     &current_flags);
+            }
         }
 #endif /* TARGET_HAS_PRECISE_SMC */
         tb_phys_invalidate(tb, addr);
@@ -3427,7 +3435,9 @@ static void check_watchpoint(int offset, int len_mask, int flags)
                     cpu_abort(env, "check_watchpoint: could not find TB for "
                               "pc=%p", (void *)env->mem_io_pc);
                 }
-                cpu_restore_state(tb, env, env->mem_io_pc);
+                if (tcg_enabled()) {
+                    cpu_restore_state(tb, env, env->mem_io_pc);
+                }
                 tb_phys_invalidate(tb, -1);
                 if (wp->flags & BP_STOP_BEFORE_ACCESS) {
                     env->exception_index = EXCP_DEBUG;
@@ -4668,7 +4678,9 @@ void cpu_io_recompile(CPUState *env, void *retaddr)
                   retaddr);
     }
     n = env->icount_decr.u16.low + tb->icount;
-    cpu_restore_state(tb, env, (unsigned long)retaddr);
+    if (tcg_enabled()) {
+        cpu_restore_state(tb, env, (unsigned long)retaddr);
+    }
     /* Calculate how many instructions had been executed before the fault
        occurred.  */
     n = n - env->icount_decr.u16.low;
@@ -4763,7 +4775,9 @@ void dump_exec_info(FILE *f, fprintf_function cpu_fprintf)
     cpu_fprintf(f, "TB flush count      %d\n", tb_flush_count);
     cpu_fprintf(f, "TB invalidate count %d\n", tb_phys_invalidate_count);
     cpu_fprintf(f, "TLB flush count     %d\n", tlb_flush_count);
-    tcg_dump_info(f, cpu_fprintf);
+    if (tcg_enabled()) {
+        tcg_dump_info(f, cpu_fprintf);
+    }
 }
 
 #define MMUSUFFIX _cmmu
diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
index 1bbc3b5..7d90ea7 100644
--- a/target-i386/op_helper.c
+++ b/target-i386/op_helper.c
@@ -5015,7 +5015,7 @@ void tlb_fill(target_ulong addr, int is_write, int mmu_idx, void *retaddr)
             /* now we have a real cpu fault */
             pc = (unsigned long)retaddr;
             tb = tb_find_pc(pc);
-            if (tb) {
+            if (tb && tcg_enabled()) {
                 /* the PC is inside the translated code. It means that we have
                    a virtual CPU fault */
                 cpu_restore_state(tb, env, pc);
diff --git a/translate-all.c b/translate-all.c
index ecb035a..041c108 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -67,9 +67,7 @@ int cpu_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr)
 #endif
     tcg_func_start(s);
 
-    if (tcg_enabled()) {
-        gen_intermediate_code(env, tb);
-    }
+    gen_intermediate_code(env, tb);
 
     /* generate machine code */
     gen_code_buf = tb->tc_ptr;
@@ -125,9 +123,7 @@ int cpu_restore_state(TranslationBlock *tb,
 #endif
     tcg_func_start(s);
 
-    if (tcg_enabled()) {
-        gen_intermediate_code_pc(env, tb);
-    }
+    gen_intermediate_code_pc(env, tb);
 
     if (use_icount) {
         /* Reset the cycle counter to the start of the block.  */
@@ -157,9 +153,7 @@ int cpu_restore_state(TranslationBlock *tb,
         j--;
     env->icount_decr.u16.low -= gen_opc_icount[j];
 
-    if (tcg_enabled()) {
-        restore_state_to_opc(env, tb, j);
-    }
+    restore_state_to_opc(env, tb, j);
 
 #ifdef CONFIG_PROFILER
     s->restore_time += profile_getclock() - ti;
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH 5/5] tcg: don't build cpu-exec.o, op_helper.o, or fpu/softloat.o when TCG disabled
  2011-09-02 21:47 [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG Anthony Liguori
                   ` (3 preceding siblings ...)
  2011-09-02 21:48 ` [Qemu-devel] [PATCH 4/5] tcg: don't build tcg/tcg.o, tcg/optimize.o, or translate-all.o when TCG disabled Anthony Liguori
@ 2011-09-02 21:48 ` Anthony Liguori
  2011-09-02 23:26   ` Peter Maydell
  2011-09-03 12:02   ` Blue Swirl
  2011-09-03 11:58 ` [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG Blue Swirl
  2011-09-05 14:53 ` Stefano Stabellini
  6 siblings, 2 replies; 13+ messages in thread
From: Anthony Liguori @ 2011-09-02 21:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, Alex Graf, Stefano Stabellini

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 Makefile.target         |    8 +++++---
 cpu-exec.c              |   19 ++++++++-----------
 cpus.c                  |   11 ++++++++++-
 exec.c                  |   29 ++++++++++++++++++++++-------
 softmmu_template.h      |   14 ++++++++++----
 target-i386/helper.c    |   18 ++++++++++++++++++
 target-i386/op_helper.c |   18 ------------------
 7 files changed, 73 insertions(+), 44 deletions(-)

diff --git a/Makefile.target b/Makefile.target
index 0a786b4..00d3039 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -67,9 +67,11 @@ all: $(PROGS) stap
 
 #########################################################
 # cpu emulator library
-libobj-y = exec.o cpu-exec.o
-libobj-y += fpu/softfloat.o
-libobj-y += op_helper.o helper.o
+libobj-y = exec.o
+libobj-y += helper.o
+libobj-$(CONFIG_TCG) += cpu-exec.o
+libobj-$(CONFIG_TCG) += op_helper.o
+libobj-$(CONFIG_TCG) += fpu/softfloat.o
 libobj-$(CONFIG_TCG) += translate.o translate-all.o
 libobj-$(CONFIG_TCG) += tcg/tcg.o tcg/optimize.o
 ifeq ($(TARGET_BASE_ARCH), i386)
diff --git a/cpu-exec.c b/cpu-exec.c
index de0d716..c5e4e62 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -26,11 +26,6 @@ int tb_invalidated_flag;
 
 //#define CONFIG_DEBUG_EXEC
 
-bool qemu_cpu_has_work(CPUState *env)
-{
-    return cpu_has_work(env);
-}
-
 void cpu_loop_exit(CPUState *env)
 {
     env->current_tb = NULL;
@@ -178,8 +173,6 @@ static void cpu_handle_debug_exception(CPUState *env)
 
 /* main execution loop */
 
-volatile sig_atomic_t exit_request;
-
 int cpu_exec(CPUState *env)
 {
     int ret, interrupt_request;
@@ -506,8 +499,10 @@ int cpu_exec(CPUState *env)
                 if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) {
                     /* restore flags in standard format */
 #if defined(TARGET_I386)
-                    env->eflags = env->eflags | cpu_cc_compute_all(env, CC_OP)
-                        | (DF & DF_MASK);
+                    env->eflags = env->eflags | (DF & DF_MASK);
+                    if (tcg_enabled()) {
+                        env->eflags |= cpu_cc_compute_all(env, CC_OP);
+                    }
                     log_cpu_state(env, X86_DUMP_CCOP);
                     env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
 #elif defined(TARGET_M68K)
@@ -597,8 +592,10 @@ int cpu_exec(CPUState *env)
 
 #if defined(TARGET_I386)
     /* restore flags in standard format */
-    env->eflags = env->eflags | cpu_cc_compute_all(env, CC_OP)
-        | (DF & DF_MASK);
+    env->eflags = env->eflags | (DF & DF_MASK);
+    if (tcg_enabled()) {
+        env->eflags |= cpu_cc_compute_all(env, CC_OP);
+    }
 #elif defined(TARGET_ARM)
     /* XXX: Save/restore host fpu exception state?.  */
 #elif defined(TARGET_UNICORE32)
diff --git a/cpus.c b/cpus.c
index 54c188c..0d7a8ee 100644
--- a/cpus.c
+++ b/cpus.c
@@ -892,6 +892,7 @@ void vm_stop(int reason)
     do_vm_stop(reason);
 }
 
+#ifdef CONFIG_TCG
 static int tcg_cpu_exec(CPUState *env)
 {
     int ret;
@@ -929,6 +930,12 @@ static int tcg_cpu_exec(CPUState *env)
     }
     return ret;
 }
+#else
+static int tcg_cpu_exec(CPUState *env)
+{
+    return 0;
+}
+#endif
 
 bool cpu_exec_all(void)
 {
@@ -950,8 +957,10 @@ bool cpu_exec_all(void)
             if (kvm_enabled()) {
                 r = kvm_cpu_exec(env);
                 qemu_kvm_eat_signals(env);
-            } else {
+            } else if (tcg_enabled()) {
                 r = tcg_cpu_exec(env);
+            } else {
+                r = 0;
             }
             if (r == EXCP_DEBUG) {
                 cpu_handle_guest_debug(env);
diff --git a/exec.c b/exec.c
index c7decb9..731b7dc 100644
--- a/exec.c
+++ b/exec.c
@@ -230,6 +230,13 @@ static int tlb_flush_count;
 static int tb_flush_count;
 static int tb_phys_invalidate_count;
 
+volatile sig_atomic_t exit_request;
+
+bool qemu_cpu_has_work(CPUState *env)
+{
+    return cpu_has_work(env);
+}
+
 #ifdef _WIN32
 static void map_exec(void *addr, long size)
 {
@@ -901,7 +908,9 @@ void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr)
         invalidate_page_bitmap(p);
     }
 
-    tb_invalidated_flag = 1;
+    if (tcg_enabled()) {
+        tb_invalidated_flag = 1;
+    }
 
     /* remove the TB from the hash list */
     h = tb_jmp_cache_hash_func(tb->pc);
@@ -1002,8 +1011,10 @@ TranslationBlock *tb_gen_code(CPUState *env,
         tb_flush(env);
         /* cannot fail at this point */
         tb = tb_alloc(pc);
-        /* Don't forget to invalidate previous TB info.  */
-        tb_invalidated_flag = 1;
+        if (tcg_enabled()) {
+            /* Don't forget to invalidate previous TB info.  */
+            tb_invalidated_flag = 1;
+        }
     }
     tc_ptr = code_gen_ptr;
     tb->tc_ptr = tc_ptr;
@@ -1127,7 +1138,7 @@ void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
     }
 #endif
 #ifdef TARGET_HAS_PRECISE_SMC
-    if (current_tb_modified) {
+    if (current_tb_modified && tcg_enabled()) {
         /* we generate a block containing just the instruction
            modifying the memory. It will ensure that it cannot modify
            itself */
@@ -1216,7 +1227,7 @@ static void tb_invalidate_phys_page(tb_page_addr_t addr,
     }
     p->first_tb = NULL;
 #ifdef TARGET_HAS_PRECISE_SMC
-    if (current_tb_modified) {
+    if (current_tb_modified && tcg_enabled()) {
         /* we generate a block containing just the instruction
            modifying the memory. It will ensure that it cannot modify
            itself */
@@ -3445,7 +3456,9 @@ static void check_watchpoint(int offset, int len_mask, int flags)
                     cpu_get_tb_cpu_state(env, &pc, &cs_base, &cpu_flags);
                     tb_gen_code(env, pc, cs_base, cpu_flags, 1);
                 }
-                cpu_resume_from_signal(env, NULL);
+                if (tcg_enabled()) {
+                    cpu_resume_from_signal(env, NULL);
+                }
             }
         } else {
             wp->flags &= ~BP_WATCHPOINT_HIT;
@@ -4721,7 +4734,9 @@ void cpu_io_recompile(CPUState *env, void *retaddr)
        repeating the fault, which is horribly inefficient.
        Better would be to execute just this insn uncached, or generate a
        second new TB.  */
-    cpu_resume_from_signal(env, NULL);
+    if (tcg_enabled()) {
+        cpu_resume_from_signal(env, NULL);
+    }
 }
 
 #if !defined(CONFIG_USER_ONLY)
diff --git a/softmmu_template.h b/softmmu_template.h
index c2df9ec..c4065be 100644
--- a/softmmu_template.h
+++ b/softmmu_template.h
@@ -131,7 +131,9 @@ DATA_TYPE REGPARM glue(glue(__ld, SUFFIX), MMUSUFFIX)(target_ulong addr,
         if ((addr & (DATA_SIZE - 1)) != 0)
             do_unaligned_access(addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
 #endif
-        tlb_fill(addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
+        if (tcg_enabled()) {
+            tlb_fill(addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
+        }
         goto redo;
     }
     return res;
@@ -179,10 +181,12 @@ static DATA_TYPE glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(target_ulong addr,
             addend = env->tlb_table[mmu_idx][index].addend;
             res = glue(glue(ld, USUFFIX), _raw)((uint8_t *)(long)(addr+addend));
         }
-    } else {
+    } else if (tcg_enabled()) {
         /* the page is not in the TLB : fill it */
         tlb_fill(addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
         goto redo;
+    } else {
+        return 0;
     }
     return res;
 }
@@ -269,7 +273,9 @@ void REGPARM glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr,
         if ((addr & (DATA_SIZE - 1)) != 0)
             do_unaligned_access(addr, 1, mmu_idx, retaddr);
 #endif
-        tlb_fill(addr, 1, mmu_idx, retaddr);
+        if (tcg_enabled()) {
+            tlb_fill(addr, 1, mmu_idx, retaddr);
+        }
         goto redo;
     }
 }
@@ -314,7 +320,7 @@ static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(target_ulong addr,
             addend = env->tlb_table[mmu_idx][index].addend;
             glue(glue(st, SUFFIX), _raw)((uint8_t *)(long)(addr+addend), val);
         }
-    } else {
+    } else if (tcg_enabled()) {
         /* the page is not in the TLB : fill it */
         tlb_fill(addr, 1, mmu_idx, retaddr);
         goto redo;
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 5df40d4..793e467 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -32,6 +32,24 @@
 
 //#define DEBUG_MMU
 
+void cpu_get_fp80(uint64_t *pmant, uint16_t *pexp, floatx80 f)
+{
+    CPU_LDoubleU temp;
+
+    temp.d = f;
+    *pmant = temp.l.lower;
+    *pexp = temp.l.upper;
+}
+
+floatx80 cpu_set_fp80(uint64_t mant, uint16_t upper)
+{
+    CPU_LDoubleU temp;
+
+    temp.l.upper = upper;
+    temp.l.lower = mant;
+    return temp.d;
+}
+
 /* NOTE: must be called outside the CPU execute loop */
 void cpu_reset(CPUX86State *env)
 {
diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
index 7d90ea7..59ddf44 100644
--- a/target-i386/op_helper.c
+++ b/target-i386/op_helper.c
@@ -4694,24 +4694,6 @@ void helper_fxrstor(target_ulong ptr, int data64)
     }
 }
 
-void cpu_get_fp80(uint64_t *pmant, uint16_t *pexp, floatx80 f)
-{
-    CPU_LDoubleU temp;
-
-    temp.d = f;
-    *pmant = temp.l.lower;
-    *pexp = temp.l.upper;
-}
-
-floatx80 cpu_set_fp80(uint64_t mant, uint16_t upper)
-{
-    CPU_LDoubleU temp;
-
-    temp.l.upper = upper;
-    temp.l.lower = mant;
-    return temp.d;
-}
-
 #ifdef TARGET_X86_64
 
 //#define DEBUG_MULDIV
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 5/5] tcg: don't build cpu-exec.o, op_helper.o, or fpu/softloat.o when TCG disabled
  2011-09-02 21:48 ` [Qemu-devel] [PATCH 5/5] tcg: don't build cpu-exec.o, op_helper.o, or fpu/softloat.o " Anthony Liguori
@ 2011-09-02 23:26   ` Peter Maydell
  2011-09-03 12:02   ` Blue Swirl
  1 sibling, 0 replies; 13+ messages in thread
From: Peter Maydell @ 2011-09-02 23:26 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Stefano Stabellini, qemu-devel, Alex Graf

On 2 September 2011 22:48, Anthony Liguori <aliguori@us.ibm.com> wrote:

> diff --git a/target-i386/helper.c b/target-i386/helper.c
> index 5df40d4..793e467 100644
> --- a/target-i386/helper.c
> +++ b/target-i386/helper.c
> @@ -32,6 +32,24 @@
>
>  //#define DEBUG_MMU
>
> +void cpu_get_fp80(uint64_t *pmant, uint16_t *pexp, floatx80 f)
> +{
> +    CPU_LDoubleU temp;
> +
> +    temp.d = f;
> +    *pmant = temp.l.lower;
> +    *pexp = temp.l.upper;
> +}
> +
> +floatx80 cpu_set_fp80(uint64_t mant, uint16_t upper)
> +{
> +    CPU_LDoubleU temp;
> +
> +    temp.l.upper = upper;
> +    temp.l.lower = mant;
> +    return temp.d;
> +}
> +
>  /* NOTE: must be called outside the CPU execute loop */
>  void cpu_reset(CPUX86State *env)
>  {
> diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
> index 7d90ea7..59ddf44 100644
> --- a/target-i386/op_helper.c
> +++ b/target-i386/op_helper.c
> @@ -4694,24 +4694,6 @@ void helper_fxrstor(target_ulong ptr, int data64)
>     }
>  }
>
> -void cpu_get_fp80(uint64_t *pmant, uint16_t *pexp, floatx80 f)
> -{
> -    CPU_LDoubleU temp;
> -
> -    temp.d = f;
> -    *pmant = temp.l.lower;
> -    *pexp = temp.l.upper;
> -}
> -
> -floatx80 cpu_set_fp80(uint64_t mant, uint16_t upper)
> -{
> -    CPU_LDoubleU temp;
> -
> -    temp.l.upper = upper;
> -    temp.l.lower = mant;
> -    return temp.d;
> -}
> -
>  #ifdef TARGET_X86_64
>
>  //#define DEBUG_MULDIV

If we're moving these two functions we should just move them into
target-i386/machine.c and mark them static. They're both only
called once each from that file, so there's no need for them to
be global functions. Or we could just roll them into get_fpreg()
and put_fpreg().

(I suspect their current placement is historical from when
target-i386 still supported two different flavours of double,
one for softfloat and one for softfloat-native.)

[Tangent, but spotted this in target-i386/machine.c:
union x86_longdouble {
    uint64_t mant;
    uint16_t exp;
};

...looks very suspicious that this is a union and not a struct...]

-- PMM

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 3/5] tcg: add tcg_enabled() and stop compiling translate.o when TCG is disabled
  2011-09-02 21:48 ` [Qemu-devel] [PATCH 3/5] tcg: add tcg_enabled() and stop compiling translate.o when " Anthony Liguori
@ 2011-09-02 23:51   ` Peter Maydell
  0 siblings, 0 replies; 13+ messages in thread
From: Peter Maydell @ 2011-09-02 23:51 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Stefano Stabellini, qemu-devel, Alex Graf

On 2 September 2011 22:48, Anthony Liguori <aliguori@us.ibm.com> wrote:
> diff --git a/translate-all.c b/translate-all.c
> index 041c108..ecb035a 100644
> --- a/translate-all.c
> +++ b/translate-all.c
> @@ -67,7 +67,9 @@ int cpu_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr)
>  #endif
>     tcg_func_start(s);
>
> -    gen_intermediate_code(env, tb);
> +    if (tcg_enabled()) {
> +        gen_intermediate_code(env, tb);
> +    }
>
>     /* generate machine code */
>     gen_code_buf = tb->tc_ptr;
> @@ -123,7 +125,9 @@ int cpu_restore_state(TranslationBlock *tb,
>  #endif
>     tcg_func_start(s);
>
> -    gen_intermediate_code_pc(env, tb);
> +    if (tcg_enabled()) {
> +        gen_intermediate_code_pc(env, tb);
> +    }
>
>     if (use_icount) {
>         /* Reset the cycle counter to the start of the block.  */
> @@ -153,7 +157,9 @@ int cpu_restore_state(TranslationBlock *tb,
>         j--;
>     env->icount_decr.u16.low -= gen_opc_icount[j];
>
> -    restore_state_to_opc(env, tb, j);
> +    if (tcg_enabled()) {
> +        restore_state_to_opc(env, tb, j);
> +    }
>
>  #ifdef CONFIG_PROFILER
>     s->restore_time += profile_getclock() - ti;

These changes make no sense (this whole function is completely
tcg specific so we should either be disabling all of it or none
of it) and anyway seem to be reverted in patch 4 ??

-- PMM

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG
  2011-09-02 21:47 [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG Anthony Liguori
                   ` (4 preceding siblings ...)
  2011-09-02 21:48 ` [Qemu-devel] [PATCH 5/5] tcg: don't build cpu-exec.o, op_helper.o, or fpu/softloat.o " Anthony Liguori
@ 2011-09-03 11:58 ` Blue Swirl
  2011-09-03 12:50   ` Alexander Graf
  2011-09-05 14:53 ` Stefano Stabellini
  6 siblings, 1 reply; 13+ messages in thread
From: Blue Swirl @ 2011-09-03 11:58 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Stefano Stabellini, qemu-devel, Alex Graf

On Fri, Sep 2, 2011 at 9:47 PM, Anthony Liguori <aliguori@us.ibm.com> wrote:
> Hi,
>
> There have been a few attempts in the past to allow TCG to be disabled
> at build time.  Recently, Alex made the suggestion that we could do it by using
> the same trick that we used to introduce kvm support.  That involves introducing
> a tcg_enabled() macro that will be (0) if TCG is disabled in the build.
>
> GCC is smart enough to do dead code elimination if it sees an if (0) and the
> result is that if you can do:

Is this also true for gcc optimization -O0? Didn't we have breakages
because of similar issues recently?

>
> if (tcg_enabled()) {
>  foo();
> }
>
> and it's more or less equivalent to:
>
> #ifdef CONFIG_TCG
>  foo();
> #endif
>
> Without the ugliness that comes from using the preprocessor.  I think this ended
> up being pretty straight forward.  exec.c could use a fair bit of cleanup but
> other than that, this pretty much eliminates all of the TCG code from the build.
>
> This absolutely is going to break non-x86 KVM builds if they use the
> --disable-tcg flag as I haven't tested those yet.  The normal TCG build
> shouldn't be affected at all though.
>
> In principle, the code assumes that you need KVM if you don't have TCG.  Of
> course, some extra logic could be added to allow for Xen if TCG isn't present.
>
>
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 5/5] tcg: don't build cpu-exec.o, op_helper.o, or fpu/softloat.o when TCG disabled
  2011-09-02 21:48 ` [Qemu-devel] [PATCH 5/5] tcg: don't build cpu-exec.o, op_helper.o, or fpu/softloat.o " Anthony Liguori
  2011-09-02 23:26   ` Peter Maydell
@ 2011-09-03 12:02   ` Blue Swirl
  1 sibling, 0 replies; 13+ messages in thread
From: Blue Swirl @ 2011-09-03 12:02 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Stefano Stabellini, qemu-devel, Alex Graf

On Fri, Sep 2, 2011 at 9:48 PM, Anthony Liguori <aliguori@us.ibm.com> wrote:
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> ---
>  Makefile.target         |    8 +++++---
>  cpu-exec.c              |   19 ++++++++-----------
>  cpus.c                  |   11 ++++++++++-
>  exec.c                  |   29 ++++++++++++++++++++++-------
>  softmmu_template.h      |   14 ++++++++++----
>  target-i386/helper.c    |   18 ++++++++++++++++++
>  target-i386/op_helper.c |   18 ------------------
>  7 files changed, 73 insertions(+), 44 deletions(-)
>
> diff --git a/Makefile.target b/Makefile.target
> index 0a786b4..00d3039 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -67,9 +67,11 @@ all: $(PROGS) stap
>
>  #########################################################
>  # cpu emulator library
> -libobj-y = exec.o cpu-exec.o
> -libobj-y += fpu/softfloat.o
> -libobj-y += op_helper.o helper.o
> +libobj-y = exec.o
> +libobj-y += helper.o
> +libobj-$(CONFIG_TCG) += cpu-exec.o
> +libobj-$(CONFIG_TCG) += op_helper.o
> +libobj-$(CONFIG_TCG) += fpu/softfloat.o
>  libobj-$(CONFIG_TCG) += translate.o translate-all.o
>  libobj-$(CONFIG_TCG) += tcg/tcg.o tcg/optimize.o
>  ifeq ($(TARGET_BASE_ARCH), i386)
> diff --git a/cpu-exec.c b/cpu-exec.c
> index de0d716..c5e4e62 100644
> --- a/cpu-exec.c
> +++ b/cpu-exec.c
> @@ -26,11 +26,6 @@ int tb_invalidated_flag;
>
>  //#define CONFIG_DEBUG_EXEC
>
> -bool qemu_cpu_has_work(CPUState *env)
> -{
> -    return cpu_has_work(env);
> -}
> -
>  void cpu_loop_exit(CPUState *env)
>  {
>     env->current_tb = NULL;
> @@ -178,8 +173,6 @@ static void cpu_handle_debug_exception(CPUState *env)
>
>  /* main execution loop */
>
> -volatile sig_atomic_t exit_request;
> -
>  int cpu_exec(CPUState *env)
>  {
>     int ret, interrupt_request;
> @@ -506,8 +499,10 @@ int cpu_exec(CPUState *env)
>                 if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) {
>                     /* restore flags in standard format */
>  #if defined(TARGET_I386)
> -                    env->eflags = env->eflags | cpu_cc_compute_all(env, CC_OP)
> -                        | (DF & DF_MASK);
> +                    env->eflags = env->eflags | (DF & DF_MASK);
> +                    if (tcg_enabled()) {

This and the next change are probably not needed if cpu-exec.c is only
compiled with CONFIG_TCG?

> +                        env->eflags |= cpu_cc_compute_all(env, CC_OP);
> +                    }
>                     log_cpu_state(env, X86_DUMP_CCOP);
>                     env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
>  #elif defined(TARGET_M68K)
> @@ -597,8 +592,10 @@ int cpu_exec(CPUState *env)
>
>  #if defined(TARGET_I386)
>     /* restore flags in standard format */
> -    env->eflags = env->eflags | cpu_cc_compute_all(env, CC_OP)
> -        | (DF & DF_MASK);
> +    env->eflags = env->eflags | (DF & DF_MASK);
> +    if (tcg_enabled()) {
> +        env->eflags |= cpu_cc_compute_all(env, CC_OP);
> +    }
>  #elif defined(TARGET_ARM)
>     /* XXX: Save/restore host fpu exception state?.  */
>  #elif defined(TARGET_UNICORE32)
> diff --git a/cpus.c b/cpus.c
> index 54c188c..0d7a8ee 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -892,6 +892,7 @@ void vm_stop(int reason)
>     do_vm_stop(reason);
>  }
>
> +#ifdef CONFIG_TCG
>  static int tcg_cpu_exec(CPUState *env)
>  {
>     int ret;
> @@ -929,6 +930,12 @@ static int tcg_cpu_exec(CPUState *env)
>     }
>     return ret;
>  }
> +#else
> +static int tcg_cpu_exec(CPUState *env)
> +{
> +    return 0;
> +}
> +#endif
>
>  bool cpu_exec_all(void)
>  {
> @@ -950,8 +957,10 @@ bool cpu_exec_all(void)
>             if (kvm_enabled()) {
>                 r = kvm_cpu_exec(env);
>                 qemu_kvm_eat_signals(env);
> -            } else {
> +            } else if (tcg_enabled()) {
>                 r = tcg_cpu_exec(env);
> +            } else {
> +                r = 0;
>             }
>             if (r == EXCP_DEBUG) {
>                 cpu_handle_guest_debug(env);
> diff --git a/exec.c b/exec.c
> index c7decb9..731b7dc 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -230,6 +230,13 @@ static int tlb_flush_count;
>  static int tb_flush_count;
>  static int tb_phys_invalidate_count;
>
> +volatile sig_atomic_t exit_request;
> +
> +bool qemu_cpu_has_work(CPUState *env)
> +{
> +    return cpu_has_work(env);
> +}
> +
>  #ifdef _WIN32
>  static void map_exec(void *addr, long size)
>  {
> @@ -901,7 +908,9 @@ void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr)
>         invalidate_page_bitmap(p);
>     }
>
> -    tb_invalidated_flag = 1;
> +    if (tcg_enabled()) {
> +        tb_invalidated_flag = 1;
> +    }
>
>     /* remove the TB from the hash list */
>     h = tb_jmp_cache_hash_func(tb->pc);
> @@ -1002,8 +1011,10 @@ TranslationBlock *tb_gen_code(CPUState *env,
>         tb_flush(env);
>         /* cannot fail at this point */
>         tb = tb_alloc(pc);
> -        /* Don't forget to invalidate previous TB info.  */
> -        tb_invalidated_flag = 1;
> +        if (tcg_enabled()) {
> +            /* Don't forget to invalidate previous TB info.  */
> +            tb_invalidated_flag = 1;
> +        }
>     }
>     tc_ptr = code_gen_ptr;
>     tb->tc_ptr = tc_ptr;
> @@ -1127,7 +1138,7 @@ void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
>     }
>  #endif
>  #ifdef TARGET_HAS_PRECISE_SMC
> -    if (current_tb_modified) {
> +    if (current_tb_modified && tcg_enabled()) {
>         /* we generate a block containing just the instruction
>            modifying the memory. It will ensure that it cannot modify
>            itself */
> @@ -1216,7 +1227,7 @@ static void tb_invalidate_phys_page(tb_page_addr_t addr,
>     }
>     p->first_tb = NULL;
>  #ifdef TARGET_HAS_PRECISE_SMC
> -    if (current_tb_modified) {
> +    if (current_tb_modified && tcg_enabled()) {
>         /* we generate a block containing just the instruction
>            modifying the memory. It will ensure that it cannot modify
>            itself */
> @@ -3445,7 +3456,9 @@ static void check_watchpoint(int offset, int len_mask, int flags)
>                     cpu_get_tb_cpu_state(env, &pc, &cs_base, &cpu_flags);
>                     tb_gen_code(env, pc, cs_base, cpu_flags, 1);
>                 }
> -                cpu_resume_from_signal(env, NULL);
> +                if (tcg_enabled()) {
> +                    cpu_resume_from_signal(env, NULL);
> +                }
>             }
>         } else {
>             wp->flags &= ~BP_WATCHPOINT_HIT;
> @@ -4721,7 +4734,9 @@ void cpu_io_recompile(CPUState *env, void *retaddr)
>        repeating the fault, which is horribly inefficient.
>        Better would be to execute just this insn uncached, or generate a
>        second new TB.  */
> -    cpu_resume_from_signal(env, NULL);
> +    if (tcg_enabled()) {
> +        cpu_resume_from_signal(env, NULL);
> +    }
>  }
>
>  #if !defined(CONFIG_USER_ONLY)
> diff --git a/softmmu_template.h b/softmmu_template.h
> index c2df9ec..c4065be 100644
> --- a/softmmu_template.h
> +++ b/softmmu_template.h
> @@ -131,7 +131,9 @@ DATA_TYPE REGPARM glue(glue(__ld, SUFFIX), MMUSUFFIX)(target_ulong addr,
>         if ((addr & (DATA_SIZE - 1)) != 0)
>             do_unaligned_access(addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
>  #endif
> -        tlb_fill(addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
> +        if (tcg_enabled()) {
> +            tlb_fill(addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
> +        }
>         goto redo;
>     }
>     return res;
> @@ -179,10 +181,12 @@ static DATA_TYPE glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(target_ulong addr,
>             addend = env->tlb_table[mmu_idx][index].addend;
>             res = glue(glue(ld, USUFFIX), _raw)((uint8_t *)(long)(addr+addend));
>         }
> -    } else {
> +    } else if (tcg_enabled()) {
>         /* the page is not in the TLB : fill it */
>         tlb_fill(addr, READ_ACCESS_TYPE, mmu_idx, retaddr);
>         goto redo;
> +    } else {
> +        return 0;
>     }
>     return res;
>  }
> @@ -269,7 +273,9 @@ void REGPARM glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr,
>         if ((addr & (DATA_SIZE - 1)) != 0)
>             do_unaligned_access(addr, 1, mmu_idx, retaddr);
>  #endif
> -        tlb_fill(addr, 1, mmu_idx, retaddr);
> +        if (tcg_enabled()) {
> +            tlb_fill(addr, 1, mmu_idx, retaddr);
> +        }
>         goto redo;
>     }
>  }
> @@ -314,7 +320,7 @@ static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(target_ulong addr,
>             addend = env->tlb_table[mmu_idx][index].addend;
>             glue(glue(st, SUFFIX), _raw)((uint8_t *)(long)(addr+addend), val);
>         }
> -    } else {
> +    } else if (tcg_enabled()) {
>         /* the page is not in the TLB : fill it */
>         tlb_fill(addr, 1, mmu_idx, retaddr);
>         goto redo;
> diff --git a/target-i386/helper.c b/target-i386/helper.c
> index 5df40d4..793e467 100644
> --- a/target-i386/helper.c
> +++ b/target-i386/helper.c
> @@ -32,6 +32,24 @@
>
>  //#define DEBUG_MMU
>
> +void cpu_get_fp80(uint64_t *pmant, uint16_t *pexp, floatx80 f)
> +{
> +    CPU_LDoubleU temp;
> +
> +    temp.d = f;
> +    *pmant = temp.l.lower;
> +    *pexp = temp.l.upper;
> +}
> +
> +floatx80 cpu_set_fp80(uint64_t mant, uint16_t upper)
> +{
> +    CPU_LDoubleU temp;
> +
> +    temp.l.upper = upper;
> +    temp.l.lower = mant;
> +    return temp.d;
> +}
> +
>  /* NOTE: must be called outside the CPU execute loop */
>  void cpu_reset(CPUX86State *env)
>  {
> diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
> index 7d90ea7..59ddf44 100644
> --- a/target-i386/op_helper.c
> +++ b/target-i386/op_helper.c
> @@ -4694,24 +4694,6 @@ void helper_fxrstor(target_ulong ptr, int data64)
>     }
>  }
>
> -void cpu_get_fp80(uint64_t *pmant, uint16_t *pexp, floatx80 f)
> -{
> -    CPU_LDoubleU temp;
> -
> -    temp.d = f;
> -    *pmant = temp.l.lower;
> -    *pexp = temp.l.upper;
> -}
> -
> -floatx80 cpu_set_fp80(uint64_t mant, uint16_t upper)
> -{
> -    CPU_LDoubleU temp;
> -
> -    temp.l.upper = upper;
> -    temp.l.lower = mant;
> -    return temp.d;
> -}
> -
>  #ifdef TARGET_X86_64
>
>  //#define DEBUG_MULDIV
> --
> 1.7.4.1
>
>
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 4/5] tcg: don't build tcg/tcg.o, tcg/optimize.o, or translate-all.o when TCG disabled
  2011-09-02 21:48 ` [Qemu-devel] [PATCH 4/5] tcg: don't build tcg/tcg.o, tcg/optimize.o, or translate-all.o when TCG disabled Anthony Liguori
@ 2011-09-03 12:07   ` Blue Swirl
  0 siblings, 0 replies; 13+ messages in thread
From: Blue Swirl @ 2011-09-03 12:07 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Stefano Stabellini, qemu-devel, Alex Graf

On Fri, Sep 2, 2011 at 9:48 PM, Anthony Liguori <aliguori@us.ibm.com> wrote:
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> ---
>  Makefile.target         |    6 +++---
>  exec.c                  |   44 +++++++++++++++++++++++++++++---------------
>  target-i386/op_helper.c |    2 +-
>  translate-all.c         |   12 +++---------
>  4 files changed, 36 insertions(+), 28 deletions(-)
>
> diff --git a/Makefile.target b/Makefile.target
> index 70f52cc..0a786b4 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -67,11 +67,11 @@ all: $(PROGS) stap
>
>  #########################################################
>  # cpu emulator library
> -libobj-y = exec.o translate-all.o cpu-exec.o
> -libobj-y += tcg/tcg.o tcg/optimize.o
> +libobj-y = exec.o cpu-exec.o
>  libobj-y += fpu/softfloat.o
>  libobj-y += op_helper.o helper.o
> -libobj-$(CONFIG_TCG) += translate.o
> +libobj-$(CONFIG_TCG) += translate.o translate-all.o
> +libobj-$(CONFIG_TCG) += tcg/tcg.o tcg/optimize.o
>  ifeq ($(TARGET_BASE_ARCH), i386)
>  libobj-y += cpuid.o
>  endif
> diff --git a/exec.c b/exec.c
> index 578da0e..c7decb9 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -574,15 +574,17 @@ static void code_gen_alloc(unsigned long tb_size)
>    size. */
>  void tcg_exec_init(unsigned long tb_size)
>  {
> -    cpu_gen_init();
> -    code_gen_alloc(tb_size);
> -    code_gen_ptr = code_gen_buffer;
> -    page_init();
> +    if (tcg_enabled()) {
> +        cpu_gen_init();
> +        code_gen_alloc(tb_size);
> +        code_gen_ptr = code_gen_buffer;
> +        page_init();
>  #if !defined(CONFIG_USER_ONLY) || !defined(CONFIG_USE_GUEST_BASE)
>     /* There's no guest base to take into account, so go ahead and
>        initialize the prologue now.  */
> -    tcg_prologue_init(&tcg_ctx);
> +        tcg_prologue_init(&tcg_ctx);
>  #endif
> +    }
>  }
>
>  bool tcg_in_use(void)
> @@ -992,7 +994,6 @@ TranslationBlock *tb_gen_code(CPUState *env,
>     uint8_t *tc_ptr;
>     tb_page_addr_t phys_pc, phys_page2;
>     target_ulong virt_page2;
> -    int code_gen_size;
>
>     phys_pc = get_page_addr_code(env, pc);
>     tb = tb_alloc(pc);
> @@ -1009,8 +1010,11 @@ TranslationBlock *tb_gen_code(CPUState *env,
>     tb->cs_base = cs_base;
>     tb->flags = flags;
>     tb->cflags = cflags;
> -    cpu_gen_code(env, tb, &code_gen_size);
> -    code_gen_ptr = (void *)(((unsigned long)code_gen_ptr + code_gen_size + CODE_GEN_ALIGN - 1) & ~(CODE_GEN_ALIGN - 1));
> +    if (tcg_enabled()) {
> +        int code_gen_size;
> +        cpu_gen_code(env, tb, &code_gen_size);
> +        code_gen_ptr = (void *)(((unsigned long)code_gen_ptr + code_gen_size + CODE_GEN_ALIGN - 1) & ~(CODE_GEN_ALIGN - 1));

This line is (in original already) longer than 80 chars, please break it.

> +    }
>
>     /* check next page if needed */
>     virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK;
> @@ -1090,7 +1094,9 @@ void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
>                 restore the CPU state */
>
>                 current_tb_modified = 1;
> -                cpu_restore_state(current_tb, env, env->mem_io_pc);
> +                if (tcg_enabled()) {
> +                    cpu_restore_state(current_tb, env, env->mem_io_pc);
> +                }
>                 cpu_get_tb_cpu_state(env, &current_pc, &current_cs_base,
>                                      &current_flags);
>             }
> @@ -1198,9 +1204,11 @@ static void tb_invalidate_phys_page(tb_page_addr_t addr,
>                    restore the CPU state */
>
>             current_tb_modified = 1;
> -            cpu_restore_state(current_tb, env, pc);
> -            cpu_get_tb_cpu_state(env, &current_pc, &current_cs_base,
> -                                 &current_flags);
> +            if (tcg_enabled()) {
> +                cpu_restore_state(current_tb, env, pc);
> +                cpu_get_tb_cpu_state(env, &current_pc, &current_cs_base,
> +                                     &current_flags);
> +            }
>         }
>  #endif /* TARGET_HAS_PRECISE_SMC */
>         tb_phys_invalidate(tb, addr);
> @@ -3427,7 +3435,9 @@ static void check_watchpoint(int offset, int len_mask, int flags)
>                     cpu_abort(env, "check_watchpoint: could not find TB for "
>                               "pc=%p", (void *)env->mem_io_pc);
>                 }
> -                cpu_restore_state(tb, env, env->mem_io_pc);
> +                if (tcg_enabled()) {
> +                    cpu_restore_state(tb, env, env->mem_io_pc);
> +                }
>                 tb_phys_invalidate(tb, -1);
>                 if (wp->flags & BP_STOP_BEFORE_ACCESS) {
>                     env->exception_index = EXCP_DEBUG;
> @@ -4668,7 +4678,9 @@ void cpu_io_recompile(CPUState *env, void *retaddr)
>                   retaddr);
>     }
>     n = env->icount_decr.u16.low + tb->icount;
> -    cpu_restore_state(tb, env, (unsigned long)retaddr);
> +    if (tcg_enabled()) {
> +        cpu_restore_state(tb, env, (unsigned long)retaddr);
> +    }
>     /* Calculate how many instructions had been executed before the fault
>        occurred.  */
>     n = n - env->icount_decr.u16.low;
> @@ -4763,7 +4775,9 @@ void dump_exec_info(FILE *f, fprintf_function cpu_fprintf)
>     cpu_fprintf(f, "TB flush count      %d\n", tb_flush_count);
>     cpu_fprintf(f, "TB invalidate count %d\n", tb_phys_invalidate_count);
>     cpu_fprintf(f, "TLB flush count     %d\n", tlb_flush_count);
> -    tcg_dump_info(f, cpu_fprintf);
> +    if (tcg_enabled()) {
> +        tcg_dump_info(f, cpu_fprintf);
> +    }
>  }
>
>  #define MMUSUFFIX _cmmu
> diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
> index 1bbc3b5..7d90ea7 100644
> --- a/target-i386/op_helper.c
> +++ b/target-i386/op_helper.c
> @@ -5015,7 +5015,7 @@ void tlb_fill(target_ulong addr, int is_write, int mmu_idx, void *retaddr)
>             /* now we have a real cpu fault */
>             pc = (unsigned long)retaddr;
>             tb = tb_find_pc(pc);
> -            if (tb) {
> +            if (tb && tcg_enabled()) {
>                 /* the PC is inside the translated code. It means that we have
>                    a virtual CPU fault */
>                 cpu_restore_state(tb, env, pc);
> diff --git a/translate-all.c b/translate-all.c
> index ecb035a..041c108 100644
> --- a/translate-all.c
> +++ b/translate-all.c
> @@ -67,9 +67,7 @@ int cpu_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr)
>  #endif
>     tcg_func_start(s);
>
> -    if (tcg_enabled()) {
> -        gen_intermediate_code(env, tb);
> -    }
> +    gen_intermediate_code(env, tb);
>
>     /* generate machine code */
>     gen_code_buf = tb->tc_ptr;
> @@ -125,9 +123,7 @@ int cpu_restore_state(TranslationBlock *tb,
>  #endif
>     tcg_func_start(s);
>
> -    if (tcg_enabled()) {
> -        gen_intermediate_code_pc(env, tb);
> -    }
> +    gen_intermediate_code_pc(env, tb);
>
>     if (use_icount) {
>         /* Reset the cycle counter to the start of the block.  */
> @@ -157,9 +153,7 @@ int cpu_restore_state(TranslationBlock *tb,
>         j--;
>     env->icount_decr.u16.low -= gen_opc_icount[j];
>
> -    if (tcg_enabled()) {
> -        restore_state_to_opc(env, tb, j);
> -    }
> +    restore_state_to_opc(env, tb, j);
>
>  #ifdef CONFIG_PROFILER
>     s->restore_time += profile_getclock() - ti;
> --
> 1.7.4.1
>
>
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG
  2011-09-03 11:58 ` [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG Blue Swirl
@ 2011-09-03 12:50   ` Alexander Graf
  0 siblings, 0 replies; 13+ messages in thread
From: Alexander Graf @ 2011-09-03 12:50 UTC (permalink / raw)
  To: Blue Swirl
  Cc: Stefan Hajnoczi, Anthony Liguori, QEMU Developers, Stefano Stabellini


On 03.09.2011, at 13:58, Blue Swirl wrote:

> On Fri, Sep 2, 2011 at 9:47 PM, Anthony Liguori <aliguori@us.ibm.com> wrote:
>> Hi,
>> 
>> There have been a few attempts in the past to allow TCG to be disabled
>> at build time.  Recently, Alex made the suggestion that we could do it by using
>> the same trick that we used to introduce kvm support.  That involves introducing
>> a tcg_enabled() macro that will be (0) if TCG is disabled in the build.
>> 
>> GCC is smart enough to do dead code elimination if it sees an if (0) and the
>> result is that if you can do:
> 
> Is this also true for gcc optimization -O0? Didn't we have breakages
> because of similar issues recently?

We obviously need to provide stubs for code that doesn't get compiled with --disable-tcg, but we do the same for KVM and Xen today. I agree though that we should have a buildbot running a build with -O0 (--enable-debug) to make sure nothing slips through.


Alex

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG
  2011-09-02 21:47 [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG Anthony Liguori
                   ` (5 preceding siblings ...)
  2011-09-03 11:58 ` [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG Blue Swirl
@ 2011-09-05 14:53 ` Stefano Stabellini
  6 siblings, 0 replies; 13+ messages in thread
From: Stefano Stabellini @ 2011-09-05 14:53 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Stefano Stabellini, qemu-devel, Alex Graf

[-- Attachment #1: Type: text/plain, Size: 2690 bytes --]

On Fri, 2 Sep 2011, Anthony Liguori wrote:
> Hi,
> 
> There have been a few attempts in the past to allow TCG to be disabled
> at build time.  Recently, Alex made the suggestion that we could do it by using
> the same trick that we used to introduce kvm support.  That involves introducing
> a tcg_enabled() macro that will be (0) if TCG is disabled in the build.
> 
> GCC is smart enough to do dead code elimination if it sees an if (0) and the
> result is that if you can do:
> 
> if (tcg_enabled()) {
>   foo();
> }
> 
> and it's more or less equivalent to:
> 
> #ifdef CONFIG_TCG
>   foo();
> #endif
> 
> Without the ugliness that comes from using the preprocessor.  I think this ended
> up being pretty straight forward.  exec.c could use a fair bit of cleanup but
> other than that, this pretty much eliminates all of the TCG code from the build.
> 
> This absolutely is going to break non-x86 KVM builds if they use the
> --disable-tcg flag as I haven't tested those yet.  The normal TCG build
> shouldn't be affected at all though.
> 
> In principle, the code assumes that you need KVM if you don't have TCG.  Of
> course, some extra logic could be added to allow for Xen if TCG isn't present.

I like the goal if the series very much and compilation with
--disable-tcg --enable-xen works out of the box!


However there are two problems:

- compilation with --disable-kvm --disable-xen (--enable-tcg) breaks on
my box, log attached;

- the automatic filtering on the target list introduced by the first
patch effectively prevents users from enabling xen with --disable-tcg,
unless they also enable kvm. See appended patch.



diff --git a/configure b/configure
index 3f2cf6a..64f85b6 100755
--- a/configure
+++ b/configure
@@ -3148,7 +3148,7 @@ if test "$static" = "no" -a "$user_pie" = "yes" ; then
   echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
 fi
 
-kvm_incompatible() {
+virt_incompatible() {
     if test "$kvm" = "yes" -a \
       \( "$1" = "$cpu" -o \
       \( "$1" = "ppcemb" -a "$cpu" = "ppc" \) -o \
@@ -3158,9 +3158,14 @@ kvm_incompatible() {
       \( "$1" = "x86_64" -a "$cpu" = "i386"   \) -o \
       \( "$1" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
 	return 1
-    else
-	return 0
     fi
+    if test "$xen" = "yes" -a \ 
+      \( "$1" = "$cpu" -o \
+      \( "$1" = "x86_64" -a "$cpu" = "i386"   \) -o \
+      \( "$1" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
+	return 1
+    fi
+    return 0
 }
 
 target_list2=
@@ -3219,7 +3224,7 @@ if test "$tcg" = "no"; then
     if test "$target_softmmu" = "no"; then
 	continue;
     fi
-    if kvm_incompatible "$target_arch2"; then
+    if virt_incompatible "$target_arch2"; then
 	continue;
     fi
 fi

[-- Attachment #2: Type: text/plain, Size: 14275 bytes --]

sstabellini@dt02:/local/scratch/sstabellini/qemu$ ./configure --disable-kvm --disable-xen --target-list=i386-softmmu
Install prefix    /usr/local
BIOS directory    /usr/local/share/qemu
binary directory  /usr/local/bin
library directory /usr/local/lib
include directory /usr/local/include
config directory  /usr/local/etc
Manual directory  /usr/local/share/man
ELF interp prefix /usr/gnemul/qemu-%M
Source path       /local/scratch/sstabellini/qemu
C compiler        gcc
Host C compiler   gcc
CFLAGS            -O2 -g 
QEMU_CFLAGS       -Werror -m64 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing  -fstack-protector-all -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -I/usr/include/libpng12   -I/usr/local/include/spice-server -I/usr/local/include/pixman-1 -I/usr/local/include -I/usr/local/include/spice-1  
LDFLAGS           -Wl,--warn-common -m64 -g 
make              make
install           install
python            python
smbd              /usr/sbin/smbd
host CPU          x86_64
host big endian   no
target list       i386-softmmu
tcg debug enabled no
Mon debug enabled no
gprof enabled     no
sparse enabled    no
strip binaries    yes
profiler          no
static build      no
-Werror enabled   yes
SDL support       yes
curses support    yes
curl support      no
check support     no
mingw32 support   no
Audio drivers     oss
Extra audio cards ac97 es1370 sb16 hda
Block whitelist   
Mixer emulation   no
VNC support       yes
VNC TLS support   no
VNC SASL support  no
VNC JPEG support  yes
VNC PNG support   yes
VNC thread        no
xen support       no
brlapi support    no
bluez  support    no
Documentation     yes
NPTL support      yes
GUEST_BASE        yes
PIE user targets  no
vde support       no
Linux AIO support yes
ATTR/XATTR support no
Install blobs     yes
KVM support       no
fdt support       no
preadv support    yes
fdatasync         yes
madvise           yes
posix_madvise     yes
uuid support      yes
vhost-net support yes
Trace backend     nop
Trace output file trace-<pid>
spice support     yes
rbd support       no
xfsctl support    no
nss used          no
usb net redir     no
OpenGL support    yes
build guest agent yes
sstabellini@dt02:/local/scratch/sstabellini/qemu$ make -j12
  GEN   config-host.h
  GEN   trace.h
  GEN   qemu-options.def
  GEN   qapi-generated/qga-qapi-visit.h
  GEN   trace.c
  CC    trace/control.o
  CC    trace/default.o
  GEN   qemu-img-cmds.h
  GEN   qapi-generated/qga-qapi-types.h
  GEN   qapi-generated/qga-qmp-marshal.c
  CC    qemu-ga.o
  CC    qga/guest-agent-commands.o
  CC    qga/guest-agent-command-state.o
  CC    qemu-tool.o
  CC    qemu-error.o
  CC    trace/default.o
  CC    trace/control.o
  CC    qint.o
  CC    qstring.o
  CC    qdict.o
  CC    qlist.o
  CC    qfloat.o
  CC    qjson.o
  CC    qbool.o
  CC    json-lexer.o
  CC    json-streamer.o
  CC    json-parser.o
  CC    qerror.o
  CC    error.o
  CC    qemu-nbd.o
  CC    qemu-thread-posix.o
  CC    cache-utils.o
  CC    async.o
  CC    nbd.o
  CC    block.o
  CC    aio.o
  CC    aes.o
  CC    qemu-config.o
  CC    qemu-progress.o
  CC    qemu-coroutine.o
  CC    qemu-coroutine-lock.o
  CC    coroutine-ucontext.o
  CC    posix-aio-compat.o
  CC    linux-aio.o
  CC    block/raw.o
  CC    block/cow.o
  CC    block/qcow.o
  CC    block/vdi.o
  CC    block/vmdk.o
  CC    block/cloop.o
  CC    block/dmg.o
  CC    block/bochs.o
  CC    block/vpc.o
  CC    block/vvfat.o
  CC    block/qcow2.o
  CC    block/qcow2-refcount.o
  CC    block/qcow2-cluster.o
  CC    block/qcow2-snapshot.o
  CC    block/qcow2-cache.o
  CC    block/qed.o
  CC    block/qed-gencb.o
  CC    block/qed-l2-cache.o
  CC    block/qed-table.o
  CC    block/qed-cluster.o
  CC    block/qed-check.o
  CC    block/parallels.o
  CC    block/nbd.o
  CC    block/blkdebug.o
  CC    block/sheepdog.o
  CC    block/blkverify.o
  CC    block/raw-posix.o
  CC    qemu-timer-common.o
  CC    qemu-img.o
  CC    qemu-io.o
  CC    cmd.o
  CC    libhw64/vl.o
  CC    blockdev.o
  CC    libhw64/loader.o
  CC    libhw64/virtio-console.o
  CC    libhw64/usb-libhw.o
  CC    net.o
  CC    net/queue.o
  CC    net/checksum.o
  CC    libhw64/virtio-pci.o
  CC    libhw64/fw_cfg.o
  CC    net/util.o
  CC    net/socket.o
  CC    net/dump.o
  CC    net/tap.o
  CC    net/tap-linux.o
  CC    net/slirp.o
  CC    readline.o
  CC    console.o
  CC    cursor.o
  CC    libhw64/pci.o
  CC    os-posix.o
  CC    tcg-runtime.o
  CC    host-utils.o
  CC    irq.o
  CC    ioport.o
  CC    libhw64/pci_bridge.o
  CC    input.o
  CC    libhw64/msix.o
  CC    i2c.o
  CC    smbus.o
  CC    smbus_eeprom.o
  CC    eeprom93xx.o
  CC    scsi-disk.o
  CC    cdrom.o
  CC    scsi-generic.o
  CC    libhw64/msi.o
  CC    scsi-bus.o
  CC    hid.o
  CC    usb.o
  CC    usb-hub.o
  CC    usb-linux.o
  CC    libhw64/pci_host.o
  CC    libhw64/pcie_host.o
  CC    usb-hid.o
  CC    usb-msd.o
  CC    libhw64/ioh3420.o
  CC    usb-wacom.o
  CC    usb-serial.o
  CC    libhw64/xio3130_upstream.o
  CC    libhw64/xio3130_downstream.o
  CC    usb-net.o
  CC    libhw64/watchdog.o
  CC    usb-bus.o
  CC    libhw64/serial.o
  CC    usb-desc.o
  CC    bt.o
  CC    bt-host.o
  CC    libhw64/parallel.o
  CC    bt-vhci.o
  CC    libhw64/i8254.o
  CC    bt-l2cap.o
  CC    libhw64/pcspk.o
  CC    bt-sdp.o
  CC    bt-hci.o
  CC    bt-hid.o
  CC    usb-bt.o
  CC    bt-hci-csr.o
  CC    buffered_file.o
  CC    libhw64/pckbd.o
  CC    libhw64/usb-uhci.o
  CC    libhw64/usb-ohci.o
  CC    migration.o
  CC    libhw64/usb-ehci.o
  CC    migration-tcp.o
  CC    qemu-char.o
  CC    savevm.o
  CC    msmouse.o
  CC    ps2.o
  CC    qdev.o
  CC    libhw64/fdc.o
  CC    qdev-properties.o
  CC    block-migration.o
  CC    iohandler.o
  CC    libhw64/acpi.o
  CC    pflib.o
  CC    bitmap.o
  CC    bitops.o
  CC    libhw64/acpi_piix4.o
  CC    migration-exec.o
  CC    migration-unix.o
  CC    migration-fd.o
  CC    libhw64/pm_smbus.o
  CC    libhw64/apm.o
  CC    ui/spice-core.o
  CC    ui/spice-input.o
  CC    ui/spice-display.o
  CC    spice-qemu-char.o
  CC    libhw64/dma.o
  CC    audio/audio.o
  CC    audio/noaudio.o
  CC    audio/wavaudio.o
  CC    libhw64/hpet.o
  CC    libhw64/applesmc.o
  CC    libhw64/usb-ccid.o
  CC    audio/mixeng.o
  CC    audio/sdlaudio.o
  CC    audio/ossaudio.o
  CC    audio/spiceaudio.o
  CC    libhw64/ccid-card-passthru.o
  CC    audio/wavcapture.o
  CC    libhw64/wdt_i6300esb.o
  CC    ui/keymaps.o
  CC    libhw64/pcie.o
  CC    libhw64/pcie_aer.o
  CC    ui/sdl.o
  CC    ui/sdl_zoom.o
  CC    ui/x_keymap.o
  CC    libhw64/pcie_port.o
  CC    libhw64/ne2000.o
  CC    ui/curses.o
  CC    libhw64/eepro100.o
  CC    ui/vnc.o
  CC    ui/d3des.o
  CC    ui/vnc-enc-zlib.o
  CC    libhw64/pcnet-pci.o
  CC    ui/vnc-enc-hextile.o
  CC    libhw64/pcnet.o
  CC    ui/vnc-enc-tight.o
  CC    ui/vnc-palette.o
  CC    libhw64/e1000.o
  CC    ui/vnc-enc-zrle.o
  CC    libhw64/rtl8139.o
  CC    libhw64/ne2000-isa.o
  CC    ui/vnc-jobs-sync.o
  CC    libhw64/ide/core.o
  CC    iov.o
  CC    libhw64/ide/atapi.o
  CC    acl.o
  CC    libhw64/ide/qdev.o
  CC    compatfd.o
  CC    notify.o
  CC    libhw64/ide/pci.o
  CC    event_notifier.o
  CC    libhw64/ide/isa.o
  CC    qemu-timer.o
  CC    slirp/cksum.o
  CC    libhw64/ide/piix.o
  CC    slirp/if.o
  CC    libhw64/ide/ahci.o
  CC    libhw64/ide/ich.o
  CC    libhw64/lsi53c895a.o
  CC    libhw64/dma-helpers.o
  CC    slirp/ip_icmp.o
  CC    slirp/ip_input.o
  CC    slirp/ip_output.o
  CC    libhw64/sysbus.o
  CC    slirp/slirp.o
  CC    libhw64/isa-bus.o
  CC    libhw64/qdev-addr.o
  CC    libhw64/vga-pci.o
  CC    slirp/mbuf.o
  CC    slirp/misc.o
  CC    slirp/sbuf.o
  CC    slirp/socket.o
  CC    libhw64/vga-isa.o
  CC    libhw64/vmware_vga.o
  CC    libhw64/vmmouse.o
  CC    libhw64/sb16.o
  CC    slirp/tcp_input.o
  CC    libhw64/es1370.o
  CC    slirp/tcp_output.o
  CC    slirp/tcp_subr.o
  CC    libhw64/ac97.o
  CC    slirp/tcp_timer.o
  CC    libhw64/intel-hda.o
  CC    slirp/udp.o
  CC    slirp/bootp.o
  CC    slirp/tftp.o
  CC    libhw64/hda-audio.o
  CC    slirp/arp_table.o
  AS    optionrom/multiboot.o
  AS    optionrom/linuxboot.o
  CC    libdis/i386-dis.o
  Building optionrom/multiboot.img
  Building optionrom/multiboot.raw
  Building optionrom/linuxboot.img
  CC    qemu-error.o
  Signing optionrom/multiboot.bin
  CC    qemu-sockets.o
  Building optionrom/linuxboot.raw
  Signing optionrom/linuxboot.bin
  CC    module.o
  CC    qemu-option.o
  CC    cutils.o
  CC    osdep.o
  CC    oslib-posix.o
  CC    qapi/qapi-visit-core.o
  CC    qapi/qmp-input-visitor.o
  CC    qapi/qmp-output-visitor.o
  CC    qapi/qapi-dealloc-visitor.o
  CC    qapi/qmp-registry.o
  CC    qapi/qmp-dispatch.o
  CC    trace.o
  CC    qapi-generated/qga-qapi-visit.o
  CC    qapi-generated/qga-qapi-types.o
  CC    qapi-generated/qga-qmp-marshal.o
  LINK  qemu-nbd
  LINK  qemu-io
  LINK  qemu-img
  LINK  qemu-ga
  GEN   config-target.h
  GEN   i386-softmmu/hmp-commands.h
  GEN   i386-softmmu/qmp-commands.h
  CC    i386-softmmu/arch_init.o
  CC    i386-softmmu/cpus.o
  CC    i386-softmmu/machine.o
  CC    i386-softmmu/gdbstub.o
  CC    i386-softmmu/balloon.o
  CC    i386-softmmu/virtio.o
  CC    i386-softmmu/virtio-blk.o
  CC    i386-softmmu/virtio-balloon.o
  CC    i386-softmmu/virtio-net.o
  CC    i386-softmmu/virtio-serial-bus.o
  CC    i386-softmmu/vhost_net.o
  CC    i386-softmmu/rwhandler.o
  CC    i386-softmmu/kvm-stub.o
  CC    i386-softmmu/memory.o
  CC    i386-softmmu/xen-stub.o
  CC    i386-softmmu/exec.o
  CC    i386-softmmu/helper.o
  CC    i386-softmmu/cpuid.o
  CC    i386-softmmu/disas.o
  CC    i386-softmmu/vga.o
  CC    i386-softmmu/mc146818rtc.o
  CC    i386-softmmu/i8259.o
  CC    i386-softmmu/pc.o
  CC    i386-softmmu/cirrus_vga.o
  CC    i386-softmmu/sga.o
  CC    i386-softmmu/apic.o
  CC    i386-softmmu/ioapic.o
  CC    i386-softmmu/piix_pci.o
  CC    i386-softmmu/vmport.o
rm multiboot.o linuxboot.raw linuxboot.img multiboot.raw multiboot.img linuxboot.o
  CC    i386-softmmu/device-hotplug.o
  CC    i386-softmmu/pci-hotplug.o
  CC    i386-softmmu/smbios.o
  CC    i386-softmmu/wdt_ib700.o
  CC    i386-softmmu/debugcon.o
  CC    i386-softmmu/multiboot.o
  CC    i386-softmmu/pc_piix.o
  CC    i386-softmmu/qxl.o
  CC    i386-softmmu/qxl-logger.o
  CC    i386-softmmu/qxl-render.o
  CC    i386-softmmu/monitor.o
  LINK  i386-softmmu/qemu-system-i386
cpus.o: In function `tcg_cpu_exec':
/local/scratch/sstabellini/qemu/cpus.c:919: undefined reference to `cpu_x86_exec'
exec.o: In function `tb_phys_invalidate':
/local/scratch/sstabellini/qemu/exec.c:912: undefined reference to `tb_invalidated_flag'
/local/scratch/sstabellini/qemu/exec.c:912: undefined reference to `tb_invalidated_flag'
exec.o: In function `tcg_exec_init':
/local/scratch/sstabellini/qemu/exec.c:585: undefined reference to `cpu_gen_init'
/local/scratch/sstabellini/qemu/exec.c:592: undefined reference to `tcg_ctx'
exec.o: In function `tb_gen_code':
/local/scratch/sstabellini/qemu/exec.c:1016: undefined reference to `tb_invalidated_flag'
/local/scratch/sstabellini/qemu/exec.c:1026: undefined reference to `cpu_x86_gen_code'
exec.o: In function `cpu_io_recompile':
/local/scratch/sstabellini/qemu/exec.c:4695: undefined reference to `cpu_restore_state'
exec.o: In function `slow_ldq_cmmu':
/local/scratch/sstabellini/qemu/softmmu_template.h:186: undefined reference to `tlb_fill'
exec.o: In function `__ldq_cmmu':
/local/scratch/sstabellini/qemu/softmmu_template.h:135: undefined reference to `tlb_fill'
exec.o: In function `slow_ldb_cmmu':
/local/scratch/sstabellini/qemu/softmmu_template.h:186: undefined reference to `tlb_fill'
exec.o: In function `__ldb_cmmu':
/local/scratch/sstabellini/qemu/softmmu_template.h:135: undefined reference to `tlb_fill'
exec.o: In function `slow_ldw_cmmu':
/local/scratch/sstabellini/qemu/softmmu_template.h:186: undefined reference to `tlb_fill'
exec.o:/local/scratch/sstabellini/qemu/softmmu_template.h:135: more undefined references to `tlb_fill' follow
exec.o: In function `tb_invalidate_phys_page_range':
/local/scratch/sstabellini/qemu/exec.c:1109: undefined reference to `cpu_restore_state'
exec.o: In function `check_watchpoint':
/local/scratch/sstabellini/qemu/exec.c:3450: undefined reference to `cpu_restore_state'
/local/scratch/sstabellini/qemu/exec.c:3460: undefined reference to `cpu_resume_from_signal'
exec.o: In function `dump_exec_info':
/local/scratch/sstabellini/qemu/exec.c:4794: undefined reference to `tcg_dump_info'
exec.o: In function `tcg_exec_init':
/local/scratch/sstabellini/qemu/exec.c:592: undefined reference to `tcg_prologue_init'
exec.o: In function `cpu_io_recompile':
/local/scratch/sstabellini/qemu/exec.c:4738: undefined reference to `cpu_resume_from_signal'
exec.o: In function `tb_invalidate_phys_page_range':
/local/scratch/sstabellini/qemu/exec.c:1147: undefined reference to `cpu_resume_from_signal'
helper.o: In function `breakpoint_handler':
/local/scratch/sstabellini/qemu/target-i386/helper.c:1058: undefined reference to `cpu_resume_from_signal'
/local/scratch/sstabellini/qemu/target-i386/helper.c:1065: undefined reference to `raise_exception_env'
helper.o: In function `cpu_x86_init':
/local/scratch/sstabellini/qemu/target-i386/helper.c:1267: undefined reference to `optimize_flags_init'
/local/scratch/sstabellini/qemu/target-i386/helper.c:1270: undefined reference to `cpu_set_debug_excp_handler'
collect2: ld returned 1 exit status
make[1]: *** [qemu-system-i386] Error 1
make: *** [subdir-i386-softmmu] Error 2
sstabellini@dt02:/local/scratch/sstabellini/qemu$ 


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-09-05 14:45 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-02 21:47 [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG Anthony Liguori
2011-09-02 21:47 ` [Qemu-devel] [PATCH 1/5] configure: add --disable-tcg configure option Anthony Liguori
2011-09-02 21:48 ` [Qemu-devel] [PATCH 2/5] vl: don't expose TCG as a supported accelerator if TCG is disabled Anthony Liguori
2011-09-02 21:48 ` [Qemu-devel] [PATCH 3/5] tcg: add tcg_enabled() and stop compiling translate.o when " Anthony Liguori
2011-09-02 23:51   ` Peter Maydell
2011-09-02 21:48 ` [Qemu-devel] [PATCH 4/5] tcg: don't build tcg/tcg.o, tcg/optimize.o, or translate-all.o when TCG disabled Anthony Liguori
2011-09-03 12:07   ` Blue Swirl
2011-09-02 21:48 ` [Qemu-devel] [PATCH 5/5] tcg: don't build cpu-exec.o, op_helper.o, or fpu/softloat.o " Anthony Liguori
2011-09-02 23:26   ` Peter Maydell
2011-09-03 12:02   ` Blue Swirl
2011-09-03 11:58 ` [Qemu-devel] [RFC PATCH 0/5] Add configure flag to disable TCG Blue Swirl
2011-09-03 12:50   ` Alexander Graf
2011-09-05 14:53 ` Stefano Stabellini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.