From: Greg Kroah-Hartman Date: Tue, 30 Jun 2009 23:43:51 +0000 (-0700) Subject: 2 more kvm patches for .30 X-Git-Tag: v2.6.27.26~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9c41914f956ed66427045e9bf0fbad525e3aec75;p=thirdparty%2Fkernel%2Fstable-queue.git 2 more kvm patches for .30 --- diff --git a/queue-2.6.30/kvm-add-vt-x-machine-check-support.patch b/queue-2.6.30/kvm-add-vt-x-machine-check-support.patch index 366d5f0ac64..efa1c300c61 100644 --- a/queue-2.6.30/kvm-add-vt-x-machine-check-support.patch +++ b/queue-2.6.30/kvm-add-vt-x-machine-check-support.patch @@ -151,9 +151,9 @@ Signed-off-by: Greg Kroah-Hartman u32 vectoring_info = vmx->idt_vectoring_info; KVMTRACE_3D(VMEXIT, vcpu, exit_reason, (u32)kvm_rip_read(vcpu), -@@ -3512,6 +3550,14 @@ static void vmx_vcpu_run(struct kvm_vcpu +@@ -3257,6 +3295,14 @@ static void vmx_complete_interrupts(stru - intr_info = vmcs_read32(VM_EXIT_INTR_INFO); + exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO); + vmx->exit_reason = vmcs_read32(VM_EXIT_REASON); + @@ -164,5 +164,5 @@ Signed-off-by: Greg Kroah-Hartman + kvm_machine_check(); + /* We need to handle NMIs before interrupts are enabled */ - if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR && - (intr_info & INTR_INFO_VALID_MASK)) { + if ((exit_intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR && + (exit_intr_info & INTR_INFO_VALID_MASK)) { diff --git a/queue-2.6.30/kvm-move-exit-due-to-nmi-handling-into-vmx_complete_interrupts.patch b/queue-2.6.30/kvm-move-exit-due-to-nmi-handling-into-vmx_complete_interrupts.patch new file mode 100644 index 00000000000..e44c10a3f9f --- /dev/null +++ b/queue-2.6.30/kvm-move-exit-due-to-nmi-handling-into-vmx_complete_interrupts.patch @@ -0,0 +1,64 @@ +From 20f65983e30f222e5383f77206e3f571d1d64610 Mon Sep 17 00:00:00 2001 +From: Gleb Natapov +Date: Mon, 11 May 2009 13:35:55 +0300 +Subject: KVM: Move "exit due to NMI" handling into vmx_complete_interrupts() + +From: Gleb Natapov + +commit 20f65983e30f222e5383f77206e3f571d1d64610 upstream. + +To save us one reading of VM_EXIT_INTR_INFO. + +Signed-off-by: Gleb Natapov +Signed-off-by: Avi Kivity +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/kvm/vmx.c | 21 ++++++++++----------- + 1 file changed, 10 insertions(+), 11 deletions(-) + +--- a/arch/x86/kvm/vmx.c ++++ b/arch/x86/kvm/vmx.c +@@ -3255,8 +3255,17 @@ static void vmx_complete_interrupts(stru + bool idtv_info_valid; + u32 error; + +- idtv_info_valid = idt_vectoring_info & VECTORING_INFO_VALID_MASK; + exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO); ++ ++ /* We need to handle NMIs before interrupts are enabled */ ++ if ((exit_intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR && ++ (exit_intr_info & INTR_INFO_VALID_MASK)) { ++ KVMTRACE_0D(NMI, &vmx->vcpu, handler); ++ asm("int $2"); ++ } ++ ++ idtv_info_valid = idt_vectoring_info & VECTORING_INFO_VALID_MASK; ++ + if (cpu_has_virtual_nmis()) { + unblock_nmi = (exit_intr_info & INTR_INFO_UNBLOCK_NMI) != 0; + vector = exit_intr_info & INTR_INFO_VECTOR_MASK; +@@ -3386,7 +3395,6 @@ static void fixup_rmode_irq(struct vcpu_ + static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) + { + struct vcpu_vmx *vmx = to_vmx(vcpu); +- u32 intr_info; + + /* Record the guest's net vcpu time for enforced NMI injections. */ + if (unlikely(!cpu_has_virtual_nmis() && vmx->soft_vnmi_blocked)) +@@ -3515,15 +3523,6 @@ static void vmx_vcpu_run(struct kvm_vcpu + asm("mov %0, %%ds; mov %0, %%es" : : "r"(__USER_DS)); + vmx->launched = 1; + +- intr_info = vmcs_read32(VM_EXIT_INTR_INFO); +- +- /* We need to handle NMIs before interrupts are enabled */ +- if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR && +- (intr_info & INTR_INFO_VALID_MASK)) { +- KVMTRACE_0D(NMI, vcpu, handler); +- asm("int $2"); +- } +- + vmx_complete_interrupts(vmx); + } + diff --git a/queue-2.6.30/kvm-vmx-fix-handling-of-a-fault-during-nmi-unblocked-due-to-iret.patch b/queue-2.6.30/kvm-vmx-fix-handling-of-a-fault-during-nmi-unblocked-due-to-iret.patch new file mode 100644 index 00000000000..48a66d18b6b --- /dev/null +++ b/queue-2.6.30/kvm-vmx-fix-handling-of-a-fault-during-nmi-unblocked-due-to-iret.patch @@ -0,0 +1,71 @@ +From 7b4a25cb296e2a73d2e87a4af65361d45d450a27 Mon Sep 17 00:00:00 2001 +From: Gleb Natapov +Date: Mon, 30 Mar 2009 16:03:08 +0300 +Subject: KVM: VMX: Fix handling of a fault during NMI unblocked due to IRET + +From: Gleb Natapov + +commit 7b4a25cb296e2a73d2e87a4af65361d45d450a27 upstream. + +Bit 12 is undefined in any of the following cases: + If the VM exit sets the valid bit in the IDT-vectoring information field. + If the VM exit is due to a double fault. + +Signed-off-by: Gleb Natapov +Signed-off-by: Avi Kivity +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/kvm/vmx.c | 17 +++++++++++------ + 1 file changed, 11 insertions(+), 6 deletions(-) + +--- a/arch/x86/kvm/vmx.c ++++ b/arch/x86/kvm/vmx.c +@@ -3248,36 +3248,41 @@ static void update_tpr_threshold(struct + static void vmx_complete_interrupts(struct vcpu_vmx *vmx) + { + u32 exit_intr_info; +- u32 idt_vectoring_info; ++ u32 idt_vectoring_info = vmx->idt_vectoring_info; + bool unblock_nmi; + u8 vector; + int type; + bool idtv_info_valid; + u32 error; + ++ idtv_info_valid = idt_vectoring_info & VECTORING_INFO_VALID_MASK; + exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO); + if (cpu_has_virtual_nmis()) { + unblock_nmi = (exit_intr_info & INTR_INFO_UNBLOCK_NMI) != 0; + vector = exit_intr_info & INTR_INFO_VECTOR_MASK; + /* +- * SDM 3: 25.7.1.2 ++ * SDM 3: 27.7.1.2 (September 2008) + * Re-set bit "block by NMI" before VM entry if vmexit caused by + * a guest IRET fault. ++ * SDM 3: 23.2.2 (September 2008) ++ * Bit 12 is undefined in any of the following cases: ++ * If the VM exit sets the valid bit in the IDT-vectoring ++ * information field. ++ * If the VM exit is due to a double fault. + */ +- if (unblock_nmi && vector != DF_VECTOR) ++ if ((exit_intr_info & INTR_INFO_VALID_MASK) && unblock_nmi && ++ vector != DF_VECTOR && !idtv_info_valid) + vmcs_set_bits(GUEST_INTERRUPTIBILITY_INFO, + GUEST_INTR_STATE_NMI); + } else if (unlikely(vmx->soft_vnmi_blocked)) + vmx->vnmi_blocked_time += + ktime_to_ns(ktime_sub(ktime_get(), vmx->entry_time)); + +- idt_vectoring_info = vmx->idt_vectoring_info; +- idtv_info_valid = idt_vectoring_info & VECTORING_INFO_VALID_MASK; + vector = idt_vectoring_info & VECTORING_INFO_VECTOR_MASK; + type = idt_vectoring_info & VECTORING_INFO_TYPE_MASK; + if (vmx->vcpu.arch.nmi_injected) { + /* +- * SDM 3: 25.7.1.2 ++ * SDM 3: 27.7.1.2 (September 2008) + * Clear bit "block by NMI" before VM entry if a NMI delivery + * faulted. + */ diff --git a/queue-2.6.30/series b/queue-2.6.30/series index 4e706752b4a..c720c4830bd 100644 --- a/queue-2.6.30/series +++ b/queue-2.6.30/series @@ -1,6 +1,8 @@ firmware_map-fix-hang-with-x86-32bit.patch fs-remove-incorrect-i_new-warnings.patch pci-disable-aspm-on-via-root-port-under-bridge-configurations.patch +kvm-vmx-fix-handling-of-a-fault-during-nmi-unblocked-due-to-iret.patch +kvm-move-exit-due-to-nmi-handling-into-vmx_complete_interrupts.patch kvm-add-vt-x-machine-check-support.patch kvm-disable-large-pages-on-misaligned-memory-slots.patch kvm-prevent-overflow-in-largepages-calculation.patch