This is not really going to work out if we want to merge with QEMU.  We can't
have magic in QEMU that relies on some external define being set.

Since the define is needed by linux/kvm.h the solution is to define it as
needed before including linux/kvm.h.  This probably depends on my previous
patch.

Signed-off-by: Anthony Liguori <[EMAIL PROTECTED]>

diff --git a/configure b/configure
index 6b20c2f..418dbea 100755
--- a/configure
+++ b/configure
@@ -94,7 +94,7 @@ fi
 #set parameters compiling
 if [ "$arch" = "i386" -o "$arch" = "x86_64" ]; then
     target_exec="x86_64-softmmu"
-    qemu_cflags="$qemu_cflags -DCONFIG_X86"
+    qemu_cflags="$qemu_cflags"
 fi
 
 if [ "$arch" = "ia64" ]; then
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
index 45f58d6..28df774 100644
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -18,14 +18,6 @@
 #define __user /* temporary, until installed via make headers_install */
 #endif
 
-#include <linux/kvm.h>
-
-#define EXPECTED_KVM_API_VERSION 12
-
-#if EXPECTED_KVM_API_VERSION != KVM_API_VERSION
-#error libkvm: userspace and kernel version mismatch
-#endif
-
 #include <unistd.h>
 #include <fcntl.h>
 #include <stdio.h>
@@ -36,6 +28,12 @@
 #include <sys/ioctl.h>
 #include "libkvm.h"
 
+#define EXPECTED_KVM_API_VERSION 12
+
+#if EXPECTED_KVM_API_VERSION != KVM_API_VERSION
+#error libkvm: userspace and kernel version mismatch
+#endif
+
 #if defined(__x86_64__) || defined(__i386__)
 #include "kvm-x86.h"
 #endif
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
index 34d188b..097f520 100644
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -11,6 +11,10 @@
 #define __user /* temporary, until installed via make headers_install */
 #endif
 
+#if defined(__i386__) || defined(__x86_64__)
+#define CONFIG_X86
+#endif
+
 #include <linux/kvm.h>
 
 #include <signal.h>
diff --git a/qemu/hw/cirrus_vga.c b/qemu/hw/cirrus_vga.c
index 1915c73..f559def 100644
--- a/qemu/hw/cirrus_vga.c
+++ b/qemu/hw/cirrus_vga.c
@@ -2634,7 +2634,8 @@ int unset_vram_mapping(unsigned long begin, unsigned long 
end)
 
     return 0;
 }
-#ifdef CONFIG_X86
+
+#if defined(TARGET_I386)
 static void kvm_update_vga_alias(CirrusVGAState *s, int ok, int bank,
                                  unsigned long phys_addr)
 {
@@ -2675,7 +2676,7 @@ static void kvm_update_vga_aliases(CirrusVGAState *s, int 
ok)
 static void cirrus_update_memory_access(CirrusVGAState *s)
 {
     unsigned mode;
-#ifdef CONFIG_X86
+#if defined(TARGET_I386)
     int want_vga_alias = 0;
 #endif
 
@@ -2708,7 +2709,7 @@ static void cirrus_update_memory_access(CirrusVGAState *s)
                 s->map_addr = s->cirrus_lfb_addr;
                 s->map_end = s->cirrus_lfb_end;
             }
-#ifdef CONFIG_X86
+#if defined(TARGET_I386)
            if (kvm_enabled()
                && !(s->cirrus_srcptr != s->cirrus_srcptr_end)
                && !((s->sr[0x07] & 0x01) == 0)
@@ -2740,7 +2741,7 @@ static void cirrus_update_memory_access(CirrusVGAState *s)
             s->cirrus_linear_write[2] = cirrus_linear_writel;
         }
     }
-#if defined(CONFIG_X86)
+#if defined(TARGET_I386)
     kvm_update_vga_aliases(s, want_vga_alias);
 #endif
 

-------------------------------------------------------------------------
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/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to