From patchwork Sat Oct 21 20:02:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luwei Kang X-Patchwork-Id: 10021653 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0AF5860381 for ; Sun, 22 Oct 2017 09:49:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9F5E28700 for ; Sun, 22 Oct 2017 09:49:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DED5928775; Sun, 22 Oct 2017 09:49:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=2.0 tests=BAYES_00, DATE_IN_PAST_12_24, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 81C9028700 for ; Sun, 22 Oct 2017 09:49:13 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e6Cqq-0004GM-59; Sun, 22 Oct 2017 09:47:24 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e6Cqo-0004Fe-PE for xen-devel@lists.xen.org; Sun, 22 Oct 2017 09:47:22 +0000 Received: from [85.158.137.68] by server-17.bemta-3.messagelabs.com id CD/F4-06614-9296CE95; Sun, 22 Oct 2017 09:47:21 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFLMWRWlGSWpSXmKPExsXS1tYhoquZ+Sb SoLlJzGLJx8UsDoweR3f/ZgpgjGLNzEvKr0hgzdiwQ6DgFGfFhd0b2BsYuzi6GLk4hASmM0o0 9zYydzFyckgI8EocWTaDFcIOkNj6rYcNxBYSKJWY27WOEcRmE1CX2Pp+I1iNiIC0xLXPlxlBB jELTGWSeLTtBFhCWMBR4tyDM2A2i4CqxMoPfewgNq+Ai0TvqllQC+Qkbp7rBFvMKeAqcfHeEl aIZS4SB893ME5g5F3AyLCKUaM4tagstUjXyEwvqSgzPaMkNzEzR9fQwFgvN7W4ODE9NScxqVg vOT93EyMwHOoZGBh3MDbs9TvEKMnBpCTKW/HuVaQQX1J+SmVGYnFGfFFpTmrxIUYZDg4lCd6U jDeRQoJFqempFWmZOcDAhElLcPAoifBeSQdK8xYXJOYWZ6ZDpE4x6nJ03Lz7h0mIJS8/L1VKn DcbZIYASFFGaR7cCFiUXGKUlRLmZWRgYBDiKUgtys0sQZV/xSjOwagkzOsDMoUnM68EbtMroC OYgI6QtQc7oiQRISXVwLjixK3F9XdnTZnILp5wwkb69Lry1N3r9hZkfltfOun0t529r1sW3TO b96frJp/KNQ7Nh7MEjUQ7H5tuCdPVycrQcJZr4hHY9ah77ZHiF1aG10J55/yvXnDeQ+p3ud3R Z9siRVa2PGjf4eWWwlf9MPSWoZx3wwrtDXHvLAwMn9nXqlTOc/lru1mJpTgj0VCLuag4EQB21 Dr5jQIAAA== X-Env-Sender: luwei.kang@intel.com X-Msg-Ref: server-8.tower-31.messagelabs.com!1508665639!111442603!1 X-Originating-IP: [134.134.136.20] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTM0LjEzNC4xMzYuMjAgPT4gMzU1MzU4\n X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 19430 invoked from network); 22 Oct 2017 09:47:20 -0000 Received: from mga02.intel.com (HELO mga02.intel.com) (134.134.136.20) by server-8.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 22 Oct 2017 09:47:20 -0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Oct 2017 02:47:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.43,416,1503385200"; d="scan'208"; a="1208603554" Received: from vmm.bj.intel.com ([10.238.135.172]) by fmsmga001.fm.intel.com with ESMTP; 22 Oct 2017 02:47:13 -0700 From: Luwei Kang To: xen-devel@lists.xen.org Date: Sun, 22 Oct 2017 04:02:27 +0800 Message-Id: <1508616147-17310-7-git-send-email-luwei.kang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508616147-17310-1-git-send-email-luwei.kang@intel.com> References: <1508616147-17310-1-git-send-email-luwei.kang@intel.com> Cc: kevin.tian@intel.com, sstabellini@kernel.org, wei.liu2@citrix.com, jun.nakajima@intel.com, konrad.wilk@oracle.com, George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, tim@xen.org, jbeulich@suse.com, Luwei Kang Subject: [Xen-devel] [PATCH 6/6] x86: Pass through intel processor trace MSRs X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch pass through Intel processor trace MSRs to guest. Signed-off-by: Luwei Kang --- xen/arch/x86/cpu/intel_pt.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xen/arch/x86/cpu/intel_pt.c b/xen/arch/x86/cpu/intel_pt.c index 411b922..8e83b87 100644 --- a/xen/arch/x86/cpu/intel_pt.c +++ b/xen/arch/x86/cpu/intel_pt.c @@ -82,6 +82,7 @@ void pt_vcpu_init(struct vcpu *v) { struct pt_desc *pt = &v->arch.hvm_vmx.pt_desc; unsigned int eax, ebx, ecx, edx; + int i; memset(pt, 0, sizeof(struct pt_desc)); pt->intel_pt_enabled = false; @@ -102,5 +103,12 @@ void pt_vcpu_init(struct vcpu *v) vmx_vmcs_enter(v); __vmwrite(GUEST_IA32_RTIT_CTL, 0); + vmx_clear_msr_intercept(v, MSR_IA32_RTIT_CTL, VMX_MSR_RW); + vmx_clear_msr_intercept(v, MSR_IA32_RTIT_STATUS, VMX_MSR_RW); + vmx_clear_msr_intercept(v, MSR_IA32_RTIT_OUTPUT_BASE, VMX_MSR_RW); + vmx_clear_msr_intercept(v, MSR_IA32_RTIT_OUTPUT_MASK_PTRS, VMX_MSR_RW); + vmx_clear_msr_intercept(v, MSR_IA32_RTIT_CR3_MATCH, VMX_MSR_RW); + for ( i = 0; i < pt->addr_num; i++ ) + vmx_clear_msr_intercept(v, MSR_IA32_RTIT_ADDR0_A + i, VMX_MSR_RW); vmx_vmcs_exit(v); }