Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 197650
b: refs/heads/master
c: ce2ac08
h: refs/heads/master
v: v3
  • Loading branch information
Joerg Roedel authored and Avi Kivity committed May 17, 2010
1 parent 659ca5c commit 9fb92d4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0d6b35378e80c555e20ca3aa3d3cc609b403cbb6
refs/heads/master: ce2ac085ff1500aad157cabd8221b7c38eb751bd
25 changes: 25 additions & 0 deletions trunk/arch/x86/kvm/svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ struct nested_state {

/* gpa pointers to the real vectors */
u64 vmcb_msrpm;
u64 vmcb_iopm;

/* A VMEXIT is required but not yet emulated */
bool exit_required;
Expand Down Expand Up @@ -1658,6 +1659,26 @@ static void nested_svm_unmap(struct page *page)
kvm_release_page_dirty(page);
}

static int nested_svm_intercept_ioio(struct vcpu_svm *svm)
{
unsigned port;
u8 val, bit;
u64 gpa;

if (!(svm->nested.intercept & (1ULL << INTERCEPT_IOIO_PROT)))
return NESTED_EXIT_HOST;

port = svm->vmcb->control.exit_info_1 >> 16;
gpa = svm->nested.vmcb_iopm + (port / 8);
bit = port % 8;
val = 0;

if (kvm_read_guest(svm->vcpu.kvm, gpa, &val, 1))
val &= (1 << bit);

return val ? NESTED_EXIT_DONE : NESTED_EXIT_HOST;
}

static int nested_svm_exit_handled_msr(struct vcpu_svm *svm)
{
u32 offset, msr, value;
Expand Down Expand Up @@ -1723,6 +1744,9 @@ static int nested_svm_intercept(struct vcpu_svm *svm)
case SVM_EXIT_MSR:
vmexit = nested_svm_exit_handled_msr(svm);
break;
case SVM_EXIT_IOIO:
vmexit = nested_svm_intercept_ioio(svm);
break;
case SVM_EXIT_READ_CR0 ... SVM_EXIT_READ_CR8: {
u32 cr_bits = 1 << (exit_code - SVM_EXIT_READ_CR0);
if (svm->nested.intercept_cr_read & cr_bits)
Expand Down Expand Up @@ -2047,6 +2071,7 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm)
svm->vmcb->save.cpl = nested_vmcb->save.cpl;

svm->nested.vmcb_msrpm = nested_vmcb->control.msrpm_base_pa;
svm->nested.vmcb_iopm = nested_vmcb->control.iopm_base_pa & ~0x0fffULL;

/* cache intercepts */
svm->nested.intercept_cr_read = nested_vmcb->control.intercept_cr_read;
Expand Down

0 comments on commit 9fb92d4

Please sign in to comment.