From: Zhang Xiantao <[EMAIL PROTECTED]>
Date: Sat, 5 Jan 2008 20:20:14 +0800
Subject: [PATCH] kvm: qemu: Moving tpr-patch routine to qemu-kvm-x86.c

Since tpr patching routine only needed in x86 side, moving it
qemu-kvm-arch.
Signed-off-by: Zhang Xiantao <[EMAIL PROTECTED]>
---
 qemu/Makefile.target |    4 ++--
 qemu/qemu-kvm-x86.c  |    8 ++++++++
 qemu/qemu-kvm.c      |   11 ++++-------
 qemu/qemu-kvm.h      |    2 ++
 4 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/qemu/Makefile.target b/qemu/Makefile.target
index 289cd18..88213eb 100644
--- a/qemu/Makefile.target
+++ b/qemu/Makefile.target
@@ -299,7 +299,7 @@ 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 host-utils.o qemu-kvm-helper.o kvm-tpr-opt.o
+        translate.o op.o host-utils.o qemu-kvm-helper.o
 ifdef CONFIG_SOFTFLOAT
 LIBOBJS+=fpu/softfloat.o
 else
@@ -309,7 +309,7 @@ CPPFLAGS+=-I$(SRC_PATH)/fpu
 
 ifeq ($(TARGET_ARCH), i386)
 LIBOBJS+=helper.o helper2.o
-LIBOBJS+=qemu-kvm-x86.o
+LIBOBJS+=qemu-kvm-x86.o kvm-tpr-opt.o
 endif
 
 ifeq ($(TARGET_ARCH), x86_64)
diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
index d86fec3..c79ca36 100644
--- a/qemu/qemu-kvm-x86.c
+++ b/qemu/qemu-kvm-x86.c
@@ -625,4 +625,12 @@ void kvm_arch_update_regs_for_sipi(CPUState *env)
     env->eip = 0;
     kvm_arch_load_regs(env);
 }
+
+int handle_tpr_access(void *opaque, int vcpu,
+                            uint64_t rip, int is_write)
+{
+    kvm_tpr_access_report(cpu_single_env, rip, is_write);
+    return 0;
+}
+
 #endif
diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index 9aee903..8e1ba7a 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -327,7 +327,9 @@ static int kvm_main_loop_cpu(CPUState *env)
     env->ready_for_interrupt_injection = 1;
 
     cpu_single_env = env;
+#ifdef TARGET_I386
     kvm_tpr_opt_setup(env);
+#endif
     while (1) {
        while (!has_work(env))
            kvm_main_loop_wait(env, 10);
@@ -512,13 +514,6 @@ static int kvm_shutdown(void *opaque, int vcpu)
     return 1;
 }
  
-static int handle_tpr_access(void *opaque, int vcpu,
-                            uint64_t rip, int is_write)
-{
-    kvm_tpr_access_report(cpu_single_env, rip, is_write);
-    return 0;
-}
-
 static struct kvm_callbacks qemu_kvm_ops = {
     .debug = kvm_debug,
     .inb   = kvm_inb,
@@ -535,7 +530,9 @@ static struct kvm_callbacks qemu_kvm_ops = {
     .try_push_interrupts = try_push_interrupts,
     .post_kvm_run = post_kvm_run,
     .pre_kvm_run = pre_kvm_run,
+#ifdef TARGET_I386
     .tpr_access = handle_tpr_access,
+#endif
 };
 
 int kvm_qemu_init()
diff --git a/qemu/qemu-kvm.h b/qemu/qemu-kvm.h
index ca3132a..e4aeb3a 100644
--- a/qemu/qemu-kvm.h
+++ b/qemu/qemu-kvm.h
@@ -45,6 +45,8 @@ extern int kvm_irqchip;
 
 void kvm_tpr_opt_setup(CPUState *env);
 void kvm_tpr_access_report(CPUState *env, uint64_t rip, int is_write);
+int handle_tpr_access(void *opaque, int vcpu,
+                            uint64_t rip, int is_write);
 
 #define ALIGN(x, y)  (((x)+(y)-1) & ~((y)-1))
 #define BITMAP_SIZE(m) (ALIGN(((m)>>TARGET_PAGE_BITS), HOST_LONG_BITS)
/ 8)
-- 
1.5.2

Attachment: 0001-kvm-qemu-Moving-tpr-patch-routine-to-qemu-kvm-x86.patch
Description: 0001-kvm-qemu-Moving-tpr-patch-routine-to-qemu-kvm-x86.patch

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
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