aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kvm/svm.c95
1 files changed, 95 insertions, 0 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index ce438e0fdd26..685cffff01f3 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -2726,6 +2726,99 @@ static int (*svm_exit_handlers[])(struct vcpu_svm *svm) = {
2726 [SVM_EXIT_NPF] = pf_interception, 2726 [SVM_EXIT_NPF] = pf_interception,
2727}; 2727};
2728 2728
2729void dump_vmcb(struct kvm_vcpu *vcpu)
2730{
2731 struct vcpu_svm *svm = to_svm(vcpu);
2732 struct vmcb_control_area *control = &svm->vmcb->control;
2733 struct vmcb_save_area *save = &svm->vmcb->save;
2734
2735 pr_err("VMCB Control Area:\n");
2736 pr_err("cr_read: %04x\n", control->intercept_cr_read);
2737 pr_err("cr_write: %04x\n", control->intercept_cr_write);
2738 pr_err("dr_read: %04x\n", control->intercept_dr_read);
2739 pr_err("dr_write: %04x\n", control->intercept_dr_write);
2740 pr_err("exceptions: %08x\n", control->intercept_exceptions);
2741 pr_err("intercepts: %016llx\n", control->intercept);
2742 pr_err("pause filter count: %d\n", control->pause_filter_count);
2743 pr_err("iopm_base_pa: %016llx\n", control->iopm_base_pa);
2744 pr_err("msrpm_base_pa: %016llx\n", control->msrpm_base_pa);
2745 pr_err("tsc_offset: %016llx\n", control->tsc_offset);
2746 pr_err("asid: %d\n", control->asid);
2747 pr_err("tlb_ctl: %d\n", control->tlb_ctl);
2748 pr_err("int_ctl: %08x\n", control->int_ctl);
2749 pr_err("int_vector: %08x\n", control->int_vector);
2750 pr_err("int_state: %08x\n", control->int_state);
2751 pr_err("exit_code: %08x\n", control->exit_code);
2752 pr_err("exit_info1: %016llx\n", control->exit_info_1);
2753 pr_err("exit_info2: %016llx\n", control->exit_info_2);
2754 pr_err("exit_int_info: %08x\n", control->exit_int_info);
2755 pr_err("exit_int_info_err: %08x\n", control->exit_int_info_err);
2756 pr_err("nested_ctl: %lld\n", control->nested_ctl);
2757 pr_err("nested_cr3: %016llx\n", control->nested_cr3);
2758 pr_err("event_inj: %08x\n", control->event_inj);
2759 pr_err("event_inj_err: %08x\n", control->event_inj_err);
2760 pr_err("lbr_ctl: %lld\n", control->lbr_ctl);
2761 pr_err("next_rip: %016llx\n", control->next_rip);
2762 pr_err("VMCB State Save Area:\n");
2763 pr_err("es: s: %04x a: %04x l: %08x b: %016llx\n",
2764 save->es.selector, save->es.attrib,
2765 save->es.limit, save->es.base);
2766 pr_err("cs: s: %04x a: %04x l: %08x b: %016llx\n",
2767 save->cs.selector, save->cs.attrib,
2768 save->cs.limit, save->cs.base);
2769 pr_err("ss: s: %04x a: %04x l: %08x b: %016llx\n",
2770 save->ss.selector, save->ss.attrib,
2771 save->ss.limit, save->ss.base);
2772 pr_err("ds: s: %04x a: %04x l: %08x b: %016llx\n",
2773 save->ds.selector, save->ds.attrib,
2774 save->ds.limit, save->ds.base);
2775 pr_err("fs: s: %04x a: %04x l: %08x b: %016llx\n",
2776 save->fs.selector, save->fs.attrib,
2777 save->fs.limit, save->fs.base);
2778 pr_err("gs: s: %04x a: %04x l: %08x b: %016llx\n",
2779 save->gs.selector, save->gs.attrib,
2780 save->gs.limit, save->gs.base);
2781 pr_err("gdtr: s: %04x a: %04x l: %08x b: %016llx\n",
2782 save->gdtr.selector, save->gdtr.attrib,
2783 save->gdtr.limit, save->gdtr.base);
2784 pr_err("ldtr: s: %04x a: %04x l: %08x b: %016llx\n",
2785 save->ldtr.selector, save->ldtr.attrib,
2786 save->ldtr.limit, save->ldtr.base);
2787 pr_err("idtr: s: %04x a: %04x l: %08x b: %016llx\n",
2788 save->idtr.selector, save->idtr.attrib,
2789 save->idtr.limit, save->idtr.base);
2790 pr_err("tr: s: %04x a: %04x l: %08x b: %016llx\n",
2791 save->tr.selector, save->tr.attrib,
2792 save->tr.limit, save->tr.base);
2793 pr_err("cpl: %d efer: %016llx\n",
2794 save->cpl, save->efer);
2795 pr_err("cr0: %016llx cr2: %016llx\n",
2796 save->cr0, save->cr2);
2797 pr_err("cr3: %016llx cr4: %016llx\n",
2798 save->cr3, save->cr4);
2799 pr_err("dr6: %016llx dr7: %016llx\n",
2800 save->dr6, save->dr7);
2801 pr_err("rip: %016llx rflags: %016llx\n",
2802 save->rip, save->rflags);
2803 pr_err("rsp: %016llx rax: %016llx\n",
2804 save->rsp, save->rax);
2805 pr_err("star: %016llx lstar: %016llx\n",
2806 save->star, save->lstar);
2807 pr_err("cstar: %016llx sfmask: %016llx\n",
2808 save->cstar, save->sfmask);
2809 pr_err("kernel_gs_base: %016llx sysenter_cs: %016llx\n",
2810 save->kernel_gs_base, save->sysenter_cs);
2811 pr_err("sysenter_esp: %016llx sysenter_eip: %016llx\n",
2812 save->sysenter_esp, save->sysenter_eip);
2813 pr_err("gpat: %016llx dbgctl: %016llx\n",
2814 save->g_pat, save->dbgctl);
2815 pr_err("br_from: %016llx br_to: %016llx\n",
2816 save->br_from, save->br_to);
2817 pr_err("excp_from: %016llx excp_to: %016llx\n",
2818 save->last_excp_from, save->last_excp_to);
2819
2820}
2821
2729static int handle_exit(struct kvm_vcpu *vcpu) 2822static int handle_exit(struct kvm_vcpu *vcpu)
2730{ 2823{
2731 struct vcpu_svm *svm = to_svm(vcpu); 2824 struct vcpu_svm *svm = to_svm(vcpu);
@@ -2770,6 +2863,8 @@ static int handle_exit(struct kvm_vcpu *vcpu)
2770 kvm_run->exit_reason = KVM_EXIT_FAIL_ENTRY; 2863 kvm_run->exit_reason = KVM_EXIT_FAIL_ENTRY;
2771 kvm_run->fail_entry.hardware_entry_failure_reason 2864 kvm_run->fail_entry.hardware_entry_failure_reason
2772 = svm->vmcb->control.exit_code; 2865 = svm->vmcb->control.exit_code;
2866 pr_err("KVM: FAILED VMRUN WITH VMCB:\n");
2867 dump_vmcb(vcpu);
2773 return 0; 2868 return 0;
2774 } 2869 }
2775 2870