public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
To: kvm-devel <kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: [RFC] QEMU KVM target
Date: Mon, 19 Feb 2007 19:08:38 -0600	[thread overview]
Message-ID: <45DA4A16.4050804@codemonkey.ws> (raw)

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

Howdy,

Here's a tiny patch that adds a i386-kvm target.  The main difference 
between the i386-kvm and i386-softmmu target is that the -kvm target 
does not have any of the dyngen infrastructure.  This means that it will 
build with gcc-4.  I know you can do --cc=gcc to use gcc-4 but quite a 
few versions of gcc-4 have trouble with compiling dyngen.

I also suspect this may prove useful down the road.  What do other 
people think?  I'm not terribly tied to the i386-kvm name for what it's 
worth.

Regards,

Anthony Liguori

[-- Attachment #2: kvm-no-gcc4.diff --]
[-- Type: text/x-patch, Size: 5894 bytes --]

diff -r 64fb395dc8f1 configure
--- a/configure	Thu Feb 15 14:36:40 2007 +0000
+++ b/configure	Mon Feb 19 18:22:08 2007 -0600
@@ -3,8 +3,6 @@ prefix=/usr/kvm
 prefix=/usr/kvm
 kerneldir=/lib/modules/$(uname -r)/build
 want_module=1
-qemu_cc=$(ls /usr/bin/gcc3* /usr/bin/gcc-3* 2>/dev/null | tail -n1)
-disable_gcc_check=
 
 usage() {
     cat <<-EOF
@@ -15,20 +13,11 @@ usage() {
 	    --prefix=PREFIX        where to install things ($prefix)
 	    --with-patched-kernel  don't use external module
 	    --kerneldir=DIR        kernel build directory ($kerneldir)
-	    --qemu-cc="$qemu_cc"   compiler for qemu (needs gcc3.x) ($qemu_cc)
-	    --disable-gcc-check    don't insist on gcc-3.x
                                    - this will break running without kvm
 EOF
     exit 1
 }
 
-
-# prefer gcc if its version is 3.* ( over a compat-gcc )
-# do it before parsing command line arguments to enable the user
-#    to specify a specific gcc he/she likes.
-if gcc -v 2>&1 | grep -q 'gcc *version *3\.[2-4]\.[0-9]'; then
-	qemu_cc=gcc
-fi
 
 while [[ "$1" = -* ]]; do
     opt="$1"; shift
@@ -47,12 +36,6 @@ while [[ "$1" = -* ]]; do
 	--with-patched-kernel)
 	    want_module=
 	    ;;
-	--qemu-cc)
-	    qemu_cc="$arg"
-	    ;;
-	--disable-gcc-check)
-	    disable_gcc_check=1
-	    ;;
 	--help)
 	    usage
 	    ;;
@@ -61,11 +44,6 @@ while [[ "$1" = -* ]]; do
 	    ;;
     esac
 done
-
-if [[ -z "$qemu_cc" ]]; then
-    echo "$0: cannot locate gcc 3.x. please install it or specify with --qemu-cc"
-    exit 1
-fi
 
 libkvm_kerneldir="$kerneldir"
 if (( want_module )); then
@@ -81,12 +59,12 @@ target_cpu() {
 }
 
 (cd user; ./configure --prefix="$prefix" --kerneldir="$libkvm_kerneldir")
-(cd qemu; ./configure --target-list=$(target_cpu)-softmmu --cc="$qemu_cc" \
+(cd qemu; ./configure --target-list=i386-kvm \
     --disable-kqemu --extra-cflags="-I $PWD/../user" \
     --extra-ldflags="-L $PWD/../user" \
     --enable-kvm --kernel-path="$libkvm_kerneldir" \
     --enable-alsa \
-    ${disable_gcc_check:+"--disable-gcc-check"} \
+    --disable-gcc-check \
     --prefix="$prefix"
 )
 
diff -r 64fb395dc8f1 qemu/Makefile.target
--- a/qemu/Makefile.target	Thu Feb 15 14:36:40 2007 +0000
+++ b/qemu/Makefile.target	Mon Feb 19 18:15:02 2007 -0600
@@ -52,7 +52,11 @@ QEMU_USER=qemu-$(TARGET_ARCH2)
 # system emulator name
 ifdef CONFIG_SOFTMMU
 ifeq ($(TARGET_ARCH), i386)
+ifdef CONFIG_KVM
+QEMU_SYSTEM=qemu-kvm$(EXESUF)
+else
 QEMU_SYSTEM=qemu$(EXESUF)
+endif
 else
 QEMU_SYSTEM=qemu-system-$(TARGET_ARCH2)$(EXESUF)
 endif
@@ -231,8 +235,10 @@ OBJS+= libqemu.a
 OBJS+= libqemu.a
 
 # cpu emulator library
-LIBOBJS=exec.o kqemu.o qemu-kvm.o translate-op.o translate-all.o cpu-exec.o\
-        translate.o op.o
+LIBOBJS=exec.o kqemu.o qemu-kvm.o cpu-exec.o
+ifndef CONFIG_KVM
+LIBOBJS+=translate.o op.o translate-op.o translate-all.o 
+endif
 ifdef CONFIG_SOFTFLOAT
 LIBOBJS+=fpu/softfloat.o
 else
diff -r 64fb395dc8f1 qemu/configure
--- a/qemu/configure	Thu Feb 15 14:36:40 2007 +0000
+++ b/qemu/configure	Mon Feb 19 18:14:17 2007 -0600
@@ -819,6 +819,11 @@ target_user_only="no"
 target_user_only="no"
 if expr $target : '.*-user' > /dev/null ; then
   target_user_only="yes"
+fi
+target_kvm="no"
+if expr $target : '.*-kvm' > /dev/null ; then
+  target_kvm="yes"
+  target_softmmu="yes"
 fi
 
 target_linux_user="no"
@@ -943,6 +948,10 @@ if test "$target_softmmu" = "yes" ; then
   echo "CONFIG_SOFTMMU=yes" >> $config_mak
   echo "#define CONFIG_SOFTMMU 1" >> $config_h
 fi
+if test "$target_kvm" = "yes" ; then
+  echo "CONFIG_KVM=yes" >> $config_mak
+  echo "#define CONFIG_KVM 1" >> $config_h
+fi
 if test "$target_user_only" = "yes" ; then
   echo "CONFIG_USER_ONLY=yes" >> $config_mak
   echo "#define CONFIG_USER_ONLY 1" >> $config_h
diff -r 64fb395dc8f1 qemu/qemu-kvm.c
--- a/qemu/qemu-kvm.c	Thu Feb 15 14:36:40 2007 +0000
+++ b/qemu/qemu-kvm.c	Mon Feb 19 18:21:03 2007 -0600
@@ -705,5 +705,40 @@ int kvm_update_debugger(CPUState *env)
     return kvm_guest_debug(kvm_context, 0, &dbg);
 }
 
-
-#endif
+#ifdef CONFIG_KVM
+
+CCTable cc_table[CC_OP_NB];
+
+int code_copy_enabled;
+
+static int nop_flags(void)
+{
+    return 0;
+}
+
+int cpu_gen_code(CPUState *env, TranslationBlock *tb,
+		 int max_code_size, int *gen_code_size_ptr)
+{
+    return -1;
+}
+
+int cpu_restore_state(TranslationBlock *tb,
+		      CPUState *env, unsigned long searched_pc,
+		      void *puc)
+{
+    return -1;
+}
+
+void optimize_flags_init(void)
+{
+    int i;
+
+    for (i = 0; i < CC_OP_NB; i++) {
+	cc_table[i].compute_c = nop_flags;
+	cc_table[i].compute_all = nop_flags;
+    }
+}
+
+#endif
+
+#endif
diff -r 64fb395dc8f1 qemu/target-i386/helper.c
--- a/qemu/target-i386/helper.c	Thu Feb 15 14:36:40 2007 +0000
+++ b/qemu/target-i386/helper.c	Mon Feb 19 18:27:35 2007 -0600
@@ -1594,6 +1594,9 @@ void helper_idivl_EAX_T0(void)
     EDX = (uint32_t)r;
 }
 
+/* GCC 4 has a hard time with this helper */
+
+#ifndef CONFIG_KVM
 void helper_cmpxchg8b(void)
 {
     uint64_t d;
@@ -1611,6 +1614,7 @@ void helper_cmpxchg8b(void)
     }
     CC_SRC = eflags;
 }
+#endif
 
 void helper_cpuid(void)
 {
@@ -2968,6 +2972,9 @@ void helper_verw(void)
     CC_SRC = eflags | CC_Z;
 }
 
+/* GCC 4 has a hard time with the FPU helpers */
+#ifndef CONFIG_KVM
+
 /* FPU helpers */
 
 void helper_fldt_ST0_A0(void)
@@ -3485,6 +3492,7 @@ void helper_fxrstor(target_ulong ptr, in
         }
     }
 }
+#endif
 
 #ifndef USE_X86LDOUBLE
 
diff -r 64fb395dc8f1 qemu/vl.c
--- a/qemu/vl.c	Thu Feb 15 14:36:40 2007 +0000
+++ b/qemu/vl.c	Mon Feb 19 19:03:34 2007 -0600
@@ -7341,8 +7341,13 @@ int main(int argc, char **argv)
 #if USE_KVM
     if (kvm_allowed) {
 	if (kvm_qemu_init() < 0) {
+#ifdef CONFIG_KVM
+	    fprintf(stderr, "Could not initialize KVM\n");
+	    exit(1);
+#else
 	    fprintf(stderr, "Could not initialize KVM, will disable KVM support\n");
 	    kvm_allowed = 0;
+#endif
 	}
     }
 #endif

[-- Attachment #3: Type: text/plain, Size: 345 bytes --]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

[-- Attachment #4: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

             reply	other threads:[~2007-02-20  1:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-20  1:08 Anthony Liguori [this message]
     [not found] ` <45DA4A16.4050804-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-02-20  2:55   ` [RFC] QEMU KVM target Jun Koi
     [not found]     ` <fdaac4d50702191855gc2fc393ga83787bbf2d967da-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-02-20  3:51       ` Anthony Liguori
2007-02-20 23:34       ` Rusty Russell
     [not found]         ` <1172014483.24118.13.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-02-21  0:17           ` Anthony Liguori
2007-02-20  7:19   ` Avi Kivity
     [not found]     ` <45DAA108.8000501-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-02-20  9:48       ` Avi Kivity
     [not found]         ` <45DAC3FF.1090208-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-02-20 15:19           ` Anthony Liguori
     [not found]             ` <45DB119A.8000809-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-02-20 15:21               ` Avi Kivity
     [not found]                 ` <45DB11FD.1050900-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-02-20 15:26                   ` Anthony Liguori
     [not found]                     ` <45DB1326.3060705-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-02-20 15:29                       ` Avi Kivity
2007-02-20 15:13       ` Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2007-02-20  9:44 Dylan Taft

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=45DA4A16.4050804@codemonkey.ws \
    --to=anthony-rdkfgonbjusknkdkm+me6a@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /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