Skip to content

Commit

Permalink
[PATCH] kvm: Two-way apic tpr synchronization
Browse files Browse the repository at this point in the history
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: Dor Laor <dor.laor@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Dor Laor authored and Linus Torvalds committed Feb 12, 2007
1 parent d92899a commit 5481034
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1360,6 +1360,9 @@ static int kvm_dev_ioctl_run(struct kvm *kvm, struct kvm_run *kvm_run)
if (!vcpu)
return -ENOENT;

/* re-sync apic's tpr */
vcpu->cr8 = kvm_run->cr8;

if (kvm_run->emulated) {
kvm_arch_ops->skip_emulated_instruction(vcpu);
kvm_run->emulated = 0;
Expand Down
2 changes: 2 additions & 0 deletions include/linux/kvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ struct kvm_run {
__u8 ready_for_interrupt_injection;
__u8 if_flag;
__u16 padding2;

/* in (pre_kvm_run), out (post_kvm_run) */
__u64 cr8;
__u64 apic_base;

Expand Down

0 comments on commit 5481034

Please sign in to comment.