Received: by 10.223.164.221 with SMTP id h29csp3778224wrb; Tue, 31 Oct 2017 04:50:47 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SR1EEzoyamXo1kXcJd6zu21G29xsHmtp6xWX2OkjgJvGDmKn7t9nE29KbsFeL/MAm0FyiI X-Received: by 10.98.95.197 with SMTP id t188mr1760719pfb.230.1509450647649; Tue, 31 Oct 2017 04:50:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509450647; cv=none; d=google.com; s=arc-20160816; b=xd9+ylLf9hxPwGmrYc0lBXqqYZHiNFjIkHfKrwink132za0n86sAJuL+Tt/gl8cuCe LXf0WYYKhIQl2VFxd7I22OHVwCR+8R/168/ZkjlRrjoKNAS8oVFx9MZIau2N/qaX07sr JEqUCcCrreY6ypm91g+kgw/F7HjHJ99WzKUbs6Mjlb1E8vo9uExt1Jozh3ddy2Vd2e5A lBdUhrEhhbPeqYDB2kCCtzzh67+AICuZibvGLf6/aKq7cXFR1mMGVvhpJc14bPoiV0G4 1ilPBNt5XQ8lFpNPMj4+U9vtsFfFyLQqBMHApPvzbcUxp7139LPH+ddeFYhheVChFXZf aOpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=bobzd4d1ArQYOoNDR8tVXqmuouf9raNPIsdWZzzREaE=; b=uObQ3buCJunJmkt+zxYuHkS+Wc0kW9Uc5kc3MlILSwzvtHzNZIWh6O1GpImsb3Cu62 G/kDEL8Kq7aUKcmMAAFI8gvw/B6cXymMI/vyICfFwDb0VGnexsD3Qs0g3YVy5n9ax93D Y5KfwZqmFSjl8It0lJKIYpaoMd/sPq6qtq2iVyt/b5ybsD5vHY4kHkaSBZA/4H1ugGKK boBOu3OhSnVmy5DgtjHQN1dRTtC6hGOWRbo5JpPHJRdbbJx7n9JJbOOuYSUJ2EMFYa/0 u+AuTR2VbHL0kVmC6+pf7HAeTWolLWbkoUiraSIDuhV64Mbw5mw5pQDYezaNa+pTI7Hs V0Yw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q3si1351283pgf.680.2017.10.31.04.50.34; Tue, 31 Oct 2017 04:50:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932513AbdJaLtf (ORCPT + 99 others); Tue, 31 Oct 2017 07:49:35 -0400 Received: from mga02.intel.com ([134.134.136.20]:23209 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932213AbdJaLt3 (ORCPT ); Tue, 31 Oct 2017 07:49:29 -0400 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Oct 2017 04:49:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,323,1505804400"; d="scan'208";a="915804366" Received: from vmm.bj.intel.com ([10.238.135.172]) by FMSMGA003.fm.intel.com with ESMTP; 31 Oct 2017 04:49:18 -0700 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 v2 7/8] KVM: x86: add Intel PT msr RTIT_CTL read/write Date: Tue, 31 Oct 2017 06:05:16 +0800 Message-Id: <1509401117-15521-8-git-send-email-luwei.kang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509401117-15521-1-git-send-email-luwei.kang@intel.com> References: <1509401117-15521-1-git-send-email-luwei.kang@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chao Peng L1 hypervisor can't get the capability of "TraceEn can be set in VMX operation"(IA32_VMX_MISC[14]=0) and any attempt to set IA32_RTIT_CTL.TraceEn in VMX operation using WRMSR will cause a general-protection exception if IA32_VMX_MISC[14] is 0. So we need to leave out write this msr in L1 VMX operation. Signed-off-by: Chao Peng Signed-off-by: Luwei Kang --- arch/x86/kvm/vmx.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 091120e..8f61a8d 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -936,6 +936,7 @@ static void vmx_get_segment(struct kvm_vcpu *vcpu, static void vmx_set_nmi_mask(struct kvm_vcpu *vcpu, bool masked); static bool nested_vmx_is_page_fault_vmexit(struct vmcs12 *vmcs12, u16 error_code); +static bool vmx_pt_supported(void); static DEFINE_PER_CPU(struct vmcs *, vmxarea); static DEFINE_PER_CPU(struct vmcs *, current_vmcs); @@ -3384,6 +3385,11 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) return 1; msr_info->data = vcpu->arch.ia32_xss; break; + case MSR_IA32_RTIT_CTL: + if (!vmx_pt_supported()) + return 1; + msr_info->data = vmcs_read64(GUEST_IA32_RTIT_CTL); + break; case MSR_TSC_AUX: if (!msr_info->host_initiated && !guest_cpuid_has(vcpu, X86_FEATURE_RDTSCP)) @@ -3508,6 +3514,11 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) else clear_atomic_switch_msr(vmx, MSR_IA32_XSS); break; + case MSR_IA32_RTIT_CTL: + if (!vmx_pt_supported() || to_vmx(vcpu)->nested.vmxon) + return 1; + vmcs_write64(GUEST_IA32_RTIT_CTL, data); + break; case MSR_TSC_AUX: if (!msr_info->host_initiated && !guest_cpuid_has(vcpu, X86_FEATURE_RDTSCP)) -- 1.8.3.1 From 1584004962576938241@xxx Tue Nov 14 02:00:49 +0000 2017 X-GM-THRID: 1579660058124590762 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread