Signed-off-by: Sheng Yang <[EMAIL PROTECTED]>
---
 qemu/qemu-kvm.c |    3 ++-
 user/kvmctl.c   |    7 +++++++
 user/kvmctl.h   |   11 +++++++++++
 3 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index e23f477..59cba64 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -497,7 +497,8 @@ static void post_kvm_run(void *opaque, int vcpu)
        ? env->eflags | IF_MASK : env->eflags & ~IF_MASK;
     env->ready_for_interrupt_injection
        = kvm_is_ready_for_interrupt_injection(kvm_context, vcpu);
-    //cpu_set_apic_tpr(env, kvm_run->cr8);
+
+    cpu_set_apic_tpr(env, kvm_get_cr8(kvm_context, vcpu));
     cpu_set_apic_base(env, kvm_get_apic_base(kvm_context, vcpu));
 }
 
diff --git a/user/kvmctl.c b/user/kvmctl.c
index 43b374d..e211626 100644
--- a/user/kvmctl.c
+++ b/user/kvmctl.c
@@ -868,6 +868,11 @@ void kvm_set_cr8(kvm_context_t kvm, int vcpu,
uint64_t cr8)
        run->cr8 = cr8;
 }
 
+__u64 kvm_get_cr8(kvm_context_t kvm, int vcpu)
+{
+       return kvm->run[vcpu]->cr8;
+}
+
 static int kvm_run_abi10(kvm_context_t kvm, int vcpu)
 {
        int r;
@@ -1007,6 +1012,8 @@ again:
                case KVM_EXIT_SHUTDOWN:
                        r = handle_shutdown(kvm, vcpu);
                        break;
+               case KVM_EXIT_SET_TPR:
+                       break;
                default:
                        fprintf(stderr, "unhandled vm exit: 0x%x\n",
run->exit_reason);
                        kvm_show_regs(kvm, vcpu);
diff --git a/user/kvmctl.h b/user/kvmctl.h
index f3f807e..b7af128 100644
--- a/user/kvmctl.h
+++ b/user/kvmctl.h
@@ -191,6 +191,17 @@ int
kvm_is_ready_for_interrupt_injection(kvm_context_t kvm, int vcpu);
 void kvm_set_cr8(kvm_context_t kvm, int vcpu, uint64_t cr8);
 
 /*!
+ * \brief Get cr8 for sync tpr in qemu apic emulation
+ *
+ * This is a getter for cr8, which used to sync with the tpr in qemu
+ * apic emualtion.
+ *
+ * \param kvm Pointer to the current kvm_context
+ * \param vcpu Which virtual CPU should get dumped
+ */
+__u64 kvm_get_cr8(kvm_context_t kvm, int vcpu);
+
+/*!
  * \brief Read VCPU registers
  *
  * This gets the GP registers from the VCPU and outputs them
-- 
1.5.2

Attachment: Fix-CR8-support-in-kvm-userspace.patch
Description: Fix-CR8-support-in-kvm-userspace.patch

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to