Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 373141
b: refs/heads/master
c: 03b28f8
h: refs/heads/master
i:
  373139: cc4c5de
v: v3
  • Loading branch information
Jan Kiszka authored and Marcelo Tosatti committed May 3, 2013
1 parent f67387d commit e8d9def
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 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: 5975a2e0950291a6bfe9fd5880e7952ff87764be
refs/heads/master: 03b28f8133165dbe4cd922054d599e26b8119508
2 changes: 1 addition & 1 deletion trunk/arch/x86/include/asm/kvm_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ struct kvm_x86_ops {
int (*nmi_allowed)(struct kvm_vcpu *vcpu);
bool (*get_nmi_mask)(struct kvm_vcpu *vcpu);
void (*set_nmi_mask)(struct kvm_vcpu *vcpu, bool masked);
void (*enable_nmi_window)(struct kvm_vcpu *vcpu);
int (*enable_nmi_window)(struct kvm_vcpu *vcpu);
int (*enable_irq_window)(struct kvm_vcpu *vcpu);
void (*update_cr8_intercept)(struct kvm_vcpu *vcpu, int tpr, int irr);
int (*vm_has_apicv)(struct kvm *kvm);
Expand Down
5 changes: 3 additions & 2 deletions trunk/arch/x86/kvm/svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3649,13 +3649,13 @@ static int enable_irq_window(struct kvm_vcpu *vcpu)
return 0;
}

static void enable_nmi_window(struct kvm_vcpu *vcpu)
static int enable_nmi_window(struct kvm_vcpu *vcpu)
{
struct vcpu_svm *svm = to_svm(vcpu);

if ((svm->vcpu.arch.hflags & (HF_NMI_MASK | HF_IRET_MASK))
== HF_NMI_MASK)
return; /* IRET will cause a vm exit */
return 0; /* IRET will cause a vm exit */

/*
* Something prevents NMI from been injected. Single step over possible
Expand All @@ -3664,6 +3664,7 @@ static void enable_nmi_window(struct kvm_vcpu *vcpu)
svm->nmi_singlestep = true;
svm->vmcb->save.rflags |= (X86_EFLAGS_TF | X86_EFLAGS_RF);
update_db_bp_intercept(vcpu);
return 0;
}

static int svm_set_tss_addr(struct kvm *kvm, unsigned int addr)
Expand Down
16 changes: 7 additions & 9 deletions trunk/arch/x86/kvm/vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -4417,22 +4417,20 @@ static int enable_irq_window(struct kvm_vcpu *vcpu)
return 0;
}

static void enable_nmi_window(struct kvm_vcpu *vcpu)
static int enable_nmi_window(struct kvm_vcpu *vcpu)
{
u32 cpu_based_vm_exec_control;

if (!cpu_has_virtual_nmis()) {
enable_irq_window(vcpu);
return;
}
if (!cpu_has_virtual_nmis())
return enable_irq_window(vcpu);

if (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & GUEST_INTR_STATE_STI)
return enable_irq_window(vcpu);

if (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & GUEST_INTR_STATE_STI) {
enable_irq_window(vcpu);
return;
}
cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
cpu_based_vm_exec_control |= CPU_BASED_VIRTUAL_NMI_PENDING;
vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control);
return 0;
}

static void vmx_inject_irq(struct kvm_vcpu *vcpu)
Expand Down
3 changes: 2 additions & 1 deletion trunk/arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -5756,7 +5756,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)

/* enable NMI/IRQ window open exits if needed */
if (vcpu->arch.nmi_pending)
kvm_x86_ops->enable_nmi_window(vcpu);
req_immediate_exit =
kvm_x86_ops->enable_nmi_window(vcpu) != 0;
else if (kvm_cpu_has_injectable_intr(vcpu) || req_int_win)
req_immediate_exit =
kvm_x86_ops->enable_irq_window(vcpu) != 0;
Expand Down

0 comments on commit e8d9def

Please sign in to comment.