From: Anthony Liguori <anthony@codemonkey.ws>
To: jyoung5@us.ibm.com
Cc: kvm-devel <kvm-devel@lists.sourceforge.net>,
hollisb <hollisb@linux.vnet.ibm.com>,
Avi Kivity <avi@qumranet.com>
Subject: Re: [PATCH] Qemu powerpc work around
Date: Wed, 13 Feb 2008 14:20:16 -0600 [thread overview]
Message-ID: <47B35100.2060502@codemonkey.ws> (raw)
In-Reply-To: <1202930842.9966.2.camel@thinkpad.austin.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 688 bytes --]
Hi Jerone,
Jerone Young wrote:
> Ok taking everybodys suggestions. This patch adds a
> --disable-cpu-emulation option to qemu. This way powerpc has the
> ability to compile, and also gives other archs the ability to easily add
> the ability to compile without the tcg code.
>
> Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
>
Can you try out this version of the patch on PPC? This version also
supports --disable-cpu-emulation on x86. It also eliminates -no-kvm
when using --disable-cpu-emulation and exit's if KVM can not be initialized.
This should be useful on x86 where people cannot easily get their hands
on gcc-3 and only wish to run KVM.
Regards,
Anthony Liguori
[-- Attachment #2: qemu_no_emulation.patch --]
[-- Type: text/x-patch, Size: 6603 bytes --]
diff --git a/qemu/Makefile.target b/qemu/Makefile.target
index 49b81df..8b0436b 100644
--- a/qemu/Makefile.target
+++ b/qemu/Makefile.target
@@ -179,11 +179,17 @@ all: $(PROGS)
#########################################################
# cpu emulator library
-LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\
- translate.o op.o host-utils.o
+LIBOBJS=exec.o kqemu.o cpu-exec.o host-utils.o
+
+ifeq ($(NO_CPU_EMULATION), 1)
+LIBOBJS+=fake-exec.o
+else
+LIBOBJS+= translate-all.o translate.o op.o
# TCG code generator
LIBOBJS+= tcg/tcg.o tcg/tcg-dyngen.o tcg/tcg-runtime.o
CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
+endif
+
ifeq ($(USE_KVM), 1)
LIBOBJS+=qemu-kvm.o
endif
diff --git a/qemu/configure b/qemu/configure
index 92299b9..bc42665 100755
--- a/qemu/configure
+++ b/qemu/configure
@@ -110,6 +110,7 @@ linux_user="no"
darwin_user="no"
build_docs="no"
uname_release=""
+cpu_emulation="yes"
# OS specific
targetos=`uname -s`
@@ -339,6 +340,8 @@ for opt do
;;
--disable-werror) werror="no"
;;
+ --disable-cpu-emulation) cpu_emulation="no"
+ ;;
*) echo "ERROR: unknown option $opt"; exit 1
;;
esac
@@ -770,6 +773,7 @@ if test -n "$sparc_cpu"; then
fi
echo "kqemu support $kqemu"
echo "kvm support $kvm"
+echo "CPU emulation $cpu_emulation"
echo "Documentation $build_docs"
[ ! -z "$uname_release" ] && \
echo "uname -r $uname_release"
@@ -1094,12 +1098,20 @@ elfload32="no"
interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
+disable_cpu_emulation() {
+ if test $cpu_emulation = "no"; then
+ echo "#define NO_CPU_EMULATION 1" >> $config_h
+ echo "NO_CPU_EMULATION=1" >> $config_mak
+ fi
+}
+
configure_kvm() {
if test $kvm = "yes" -a "$target_softmmu" = "yes" -a \
\( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \); then
echo "#define USE_KVM 1" >> $config_h
echo "USE_KVM=1" >> $config_mak
echo "CONFIG_KVM_KERNEL_INC=$kernel_path/include" >> $config_mak
+ disable_cpu_emulation
fi
}
diff --git a/qemu/exec.c b/qemu/exec.c
index 050b150..960adcd 100644
--- a/qemu/exec.c
+++ b/qemu/exec.c
@@ -35,7 +35,11 @@
#include "cpu.h"
#include "exec-all.h"
+
+#if !defined(NO_CPU_EMULATION)
#include "tcg-target.h"
+#endif
+
#include "qemu-kvm.h"
#if defined(CONFIG_USER_ONLY)
#include <qemu.h>
diff --git a/qemu/target-i386/fake-exec.c b/qemu/target-i386/fake-exec.c
new file mode 100644
index 0000000..737286d
--- /dev/null
+++ b/qemu/target-i386/fake-exec.c
@@ -0,0 +1,54 @@
+/*
+ * fake-exec.c
+ *
+ * This is a file for stub functions so that compilation is possible
+ * when TCG CPU emulation is disabled during compilation.
+ *
+ * Copyright 2007 IBM Corporation.
+ * Added by & Authors:
+ * Jerone Young <jyoung5@us.ibm.com>
+ * This work is licensed under the GNU GPL licence version 2 or later.
+ *
+ */
+#include "exec.h"
+#include "cpu.h"
+
+int code_copy_enabled = 0;
+
+CCTable cc_table[CC_OP_NB];
+
+void cpu_dump_statistics (CPUState *env, FILE*f,
+ int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
+ int flags)
+{
+}
+
+unsigned long code_gen_max_block_size(void)
+{
+ return 32;
+}
+
+void cpu_gen_init(void)
+{
+}
+
+int cpu_restore_state(TranslationBlock *tb,
+ CPUState *env, unsigned long searched_pc,
+ void *puc)
+
+{
+ return 0;
+}
+
+int cpu_x86_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr)
+{
+ return 0;
+}
+
+void flush_icache_range(unsigned long start, unsigned long stop)
+{
+}
+
+void optimize_flags_init(void)
+{
+}
diff --git a/qemu/target-ppc/fake-exec.c b/qemu/target-ppc/fake-exec.c
new file mode 100644
index 0000000..b042f58
--- /dev/null
+++ b/qemu/target-ppc/fake-exec.c
@@ -0,0 +1,75 @@
+/*
+ * fake-exec.c
+ *
+ * This is a file for stub functions so that compilation is possible
+ * when TCG CPU emulation is disabled during compilation.
+ *
+ * Copyright 2007 IBM Corporation.
+ * Added by & Authors:
+ * Jerone Young <jyoung5@us.ibm.com>
+ * This work is licensed under the GNU GPL licence version 2 or later.
+ *
+ */
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <inttypes.h>
+
+#include "cpu.h"
+#include "exec-all.h"
+
+int code_copy_enabled = 0;
+
+void cpu_dump_state (CPUState *env, FILE *f,
+ int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
+ int flags)
+{
+}
+
+void ppc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
+{
+}
+
+void cpu_dump_statistics (CPUState *env, FILE*f,
+ int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
+ int flags)
+{
+}
+
+unsigned long code_gen_max_block_size(void)
+{
+ return 32;
+}
+
+void cpu_gen_init(void)
+{
+}
+
+int cpu_restore_state(TranslationBlock *tb,
+ CPUState *env, unsigned long searched_pc,
+ void *puc)
+
+{
+ return 0;
+}
+
+int cpu_ppc_gen_code(CPUState *env, TranslationBlock *tb, int *gen_code_size_ptr)
+{
+ return 0;
+}
+
+const ppc_def_t *cpu_ppc_find_by_name (const unsigned char *name)
+{
+ return NULL;
+}
+
+int cpu_ppc_register_internal (CPUPPCState *env, const ppc_def_t *def)
+{
+ return 0;
+}
+
+void flush_icache_range(unsigned long start, unsigned long stop)
+{
+}
diff --git a/qemu/vl.c b/qemu/vl.c
index 5e14c1a..3528bbf 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -8050,7 +8050,9 @@ static void help(int exitcode)
"-no-kqemu disable KQEMU kernel module usage\n"
#endif
#ifdef USE_KVM
+#ifndef NO_CPU_EMULATION
"-no-kvm disable KVM hardware virtualization\n"
+#endif
"-no-kvm-irqchip disable KVM kernel mode PIC/IOAPIC/LAPIC\n"
#endif
#ifdef TARGET_I386
@@ -8250,7 +8252,9 @@ const QEMUOption qemu_options[] = {
{ "kernel-kqemu", 0, QEMU_OPTION_kernel_kqemu },
#endif
#ifdef USE_KVM
+#ifndef NO_CPU_EMULATION
{ "no-kvm", 0, QEMU_OPTION_no_kvm },
+#endif
{ "no-kvm-irqchip", 0, QEMU_OPTION_no_kvm_irqchip },
#endif
#if defined(TARGET_PPC) || defined(TARGET_SPARC)
@@ -9266,6 +9270,10 @@ int main(int argc, char **argv)
if (kvm_qemu_init() < 0) {
extern int kvm_allowed;
fprintf(stderr, "Could not initialize KVM, will disable KVM support\n");
+#ifdef NO_CPU_EMULATION
+ fprintf(stderr, "Compiled with --disable-cpu-emulation, exiting.\n");
+ exit(1);
+#endif
kvm_allowed = 0;
}
}
[-- Attachment #3: Type: text/plain, Size: 228 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
[-- Attachment #4: Type: text/plain, Size: 158 bytes --]
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel
next prev parent reply other threads:[~2008-02-13 20:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-12 21:37 [RFC] Qemu powerpc work around Jerone Young
2008-02-12 21:44 ` Anthony Liguori
2008-02-12 21:53 ` Jerone Young
2008-02-12 22:03 ` Anthony Liguori
2008-02-12 22:50 ` Jerone Young
2008-02-13 0:47 ` Anthony Liguori
2008-02-13 7:29 ` Avi Kivity
2008-02-13 17:39 ` Jerone Young
2008-02-13 18:55 ` Anthony Liguori
2008-02-13 19:27 ` [PATCH] " Jerone Young
2008-02-13 20:20 ` Anthony Liguori [this message]
2008-02-13 20:29 ` [RFC] " Jerone Young
2008-02-14 9:33 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47B35100.2060502@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=avi@qumranet.com \
--cc=hollisb@linux.vnet.ibm.com \
--cc=jyoung5@us.ibm.com \
--cc=kvm-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox