KVM: x86: implement intel processor trace virtualization callbacks
PATCH 5/9 KVM: x86: implement intel processor trace virtualization callbacks
From: Chao Peng <[email protected]>
Implement Intel processor trace virtualization callbacks to suppress host event in guest only mode.
Signed-off-by Chao Peng <[email protected]>
Signed-off-by Luwei Kang <[email protected]>
--- arch/x86/kvm/vmx.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
arch/x86/kvm/vmx.c +21 -0
@@ -2114,6 +2114,21 @@ static unsigned long segment_base(u16 selector) }#endif +static enum pt_mode pt_mode_get (void ) +{ +return pt_mode; +} + +static bool pt_pmi (void ) +{ +return true; +} + +static struct pt_virt_ops pt_virt_ops = { + .get_mode = pt_mode_get, + .pmi = pt_pmi, +}; +static void vmx_save_host_state (struct kvm_vcpu *vcpu) {struct vcpu_vmx *vmx =to_vmx (vcpu);
@@ -6945,6 +6960,9 @@ static __init int hardware_setup(void) !cpu_has_vmx_intel_pt() || !cpu_has_vmx_pt_use_gpa()) pt_mode =PT_MODE_SYSTEM ; +if (pt_mode ==PT_MODE_GUEST ) +pt_register_virt_ops (&pt_virt_ops); +return alloc_kvm_area (); out:
@@ -6961,6 +6979,9 @@ static __exit void hardware_unsetup(void)for (i =0 ; i <VMX_BITMAP_NR ; i++)free_page ((unsigned long )vmx_bitmap[i]); +if (pt_mode ==PT_MODE_GUEST ) +pt_unregister_virt_ops (); +free_kvm_area (); }
Signature · 1 line
1.8.3.1