From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932230AbdJQB4m (ORCPT ); Mon, 16 Oct 2017 21:56:42 -0400 Received: from mga04.intel.com ([192.55.52.120]:34523 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758696AbdJQB4k (ORCPT ); Mon, 16 Oct 2017 21:56:40 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,389,1503385200"; d="scan'208";a="1231549924" From: Luwei Kang To: kvm@vger.kernel.org Cc: pbonzini@redhat.com, rkrcmar@redhat.com, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org, Chao Peng , Luwei Kang Subject: [PATCH 5/9] KVM: x86: implement intel processor trace virtualization callbacks Date: Mon, 16 Oct 2017 20:13:20 +0800 Message-Id: <1508156000-4844-1-git-send-email-luwei.kang@intel.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chao Peng Implement Intel processor trace virtualization callbacks to suppress host event in guest only mode. Signed-off-by: Chao Peng Signed-off-by: Luwei Kang --- arch/x86/kvm/vmx.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index f0cae7c..28d255d 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -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(); } -- 1.8.3.1