Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 172296
b: refs/heads/master
c: cd3ff65
h: refs/heads/master
v: v3
  • Loading branch information
Joerg Roedel authored and Avi Kivity committed Dec 3, 2009
1 parent 75852ba commit a312e15
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8d23c4662427507f432c96ac4fa3b76f0a8360cd
refs/heads/master: cd3ff653ae0b45bac7a19208e9c75034fcacc85f
26 changes: 25 additions & 1 deletion trunk/arch/x86/kvm/svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ struct nested_state {
/* gpa pointers to the real vectors */
u64 vmcb_msrpm;

/* A VMEXIT is required but not yet emulated */
bool exit_required;

/* cache for intercepts of the guest */
u16 intercept_cr_read;
u16 intercept_cr_write;
Expand Down Expand Up @@ -1379,7 +1382,14 @@ static inline int nested_svm_intr(struct vcpu_svm *svm)

svm->vmcb->control.exit_code = SVM_EXIT_INTR;

if (nested_svm_exit_handled(svm)) {
if (svm->nested.intercept & 1ULL) {
/*
* The #vmexit can't be emulated here directly because this
* code path runs with irqs and preemtion disabled. A
* #vmexit emulation might sleep. Only signal request for
* the #vmexit here.
*/
svm->nested.exit_required = true;
nsvm_printk("VMexit -> INTR\n");
return 1;
}
Expand Down Expand Up @@ -2340,6 +2350,13 @@ static int handle_exit(struct kvm_vcpu *vcpu)

trace_kvm_exit(exit_code, svm->vmcb->save.rip);

if (unlikely(svm->nested.exit_required)) {
nested_svm_vmexit(svm);
svm->nested.exit_required = false;

return 1;
}

if (is_nested(svm)) {
int vmexit;

Expand Down Expand Up @@ -2615,6 +2632,13 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
u16 gs_selector;
u16 ldt_selector;

/*
* A vmexit emulation is required before the vcpu can be executed
* again.
*/
if (unlikely(svm->nested.exit_required))
return;

svm->vmcb->save.rax = vcpu->arch.regs[VCPU_REGS_RAX];
svm->vmcb->save.rsp = vcpu->arch.regs[VCPU_REGS_RSP];
svm->vmcb->save.rip = vcpu->arch.regs[VCPU_REGS_RIP];
Expand Down

0 comments on commit a312e15

Please sign in to comment.