提交 54810342 编写于 作者: D Dor Laor 提交者: Linus Torvalds

[PATCH] kvm: Two-way apic tpr synchronization

We report the value of cr8 to userspace on an exit.  Also let userspace change
cr8 when we re-enter the guest.  The lets 64-bit guest code maintain the tpr
correctly.

Thanks for Yaniv Kamay for the idea.
Signed-off-by: NDor Laor <dor.laor@qumranet.com>
Signed-off-by: NAvi Kivity <avi@qumranet.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 d92899a0
...@@ -1360,6 +1360,9 @@ static int kvm_dev_ioctl_run(struct kvm *kvm, struct kvm_run *kvm_run) ...@@ -1360,6 +1360,9 @@ static int kvm_dev_ioctl_run(struct kvm *kvm, struct kvm_run *kvm_run)
if (!vcpu) if (!vcpu)
return -ENOENT; return -ENOENT;
/* re-sync apic's tpr */
vcpu->cr8 = kvm_run->cr8;
if (kvm_run->emulated) { if (kvm_run->emulated) {
kvm_arch_ops->skip_emulated_instruction(vcpu); kvm_arch_ops->skip_emulated_instruction(vcpu);
kvm_run->emulated = 0; kvm_run->emulated = 0;
......
...@@ -65,6 +65,8 @@ struct kvm_run { ...@@ -65,6 +65,8 @@ struct kvm_run {
__u8 ready_for_interrupt_injection; __u8 ready_for_interrupt_injection;
__u8 if_flag; __u8 if_flag;
__u16 padding2; __u16 padding2;
/* in (pre_kvm_run), out (post_kvm_run) */
__u64 cr8; __u64 cr8;
__u64 apic_base; __u64 apic_base;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册