From patchwork Sat Oct 21 20:02:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luwei Kang X-Patchwork-Id: 10021645 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 C828160381 for ; Sun, 22 Oct 2017 09:49:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B14AA28700 for ; Sun, 22 Oct 2017 09:49:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A536A28776; Sun, 22 Oct 2017 09:49:06 +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 00C6928700 for ; Sun, 22 Oct 2017 09:49:05 +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 1e6CqJ-00044z-SV; Sun, 22 Oct 2017 09:46:51 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e6CqI-00044q-Ri for xen-devel@lists.xen.org; Sun, 22 Oct 2017 09:46:50 +0000 Received: from [85.158.143.35] by server-4.bemta-6.messagelabs.com id E4/85-31244-A096CE95; Sun, 22 Oct 2017 09:46:50 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkkeJIrShJLcpLzFFi42I5YG5SocuR+Sb SYHOTkcWSj4tZHBg9ju7+zRTAGMWamZeUX5HAmnGs6wZbwQvpihl37zE1MJ4W72Lk4hASmM4o sfPrfrYuRk4OCQFeiSPLZrBC2AESG2bdAIsLCZRKnH3Www5iswmoS2x9vxGsRkRAWuLa58uMI IOYBaYySTzadgIsISzgIrFg4W8WEJtFQFVi7aHXYIN4geKTVv5nglggJ3HzXCcziM0p4Cpx8d 4SVohlLhIHz3cwTmDkXcDIsIpRozi1qCy1SNfQXC+pKDM9oyQ3MTNH19DATC83tbg4MT01JzG pWC85P3cTIzAgGIBgB+PtjQGHGCU5mJREeSvevYoU4kvKT6nMSCzOiC8qzUktPsQow8GhJMH7 Nf1NpJBgUWp6akVaZg4wNGHSEhw8SiK8V0DSvMUFibnFmekQqVOMxhwHJlz5w8TRcfPuHyYhl rz8vFQpcd7fIKUCIKUZpXlwg2Axc4lRVkqYlxHoNCGegtSi3MwSVPlXjOIcjErCvAIZQFN4Mv NK4Pa9AjqFCegUWXuwU0oSEVJSDYx9jv1toQ+Wu2h9mSGcxxe+Qm/VzwrLM05ZweWGa+xdzI2 Wzd5/xMsyZ/aKM/19gkli4gyvgiM/+l0xWXFPzFj75LuXpy879J7Yu5FnV+p2MQut15p5vLNv 6Pq7Gyi+Yzglva7gwSsno30Xt+5547biUfy/41JOSf+uP2TiXXVms/HXWTW8rDJKLMUZiYZaz EXFiQC/j7I/lAIAAA== X-Env-Sender: luwei.kang@intel.com X-Msg-Ref: server-9.tower-21.messagelabs.com!1508665606!78184450!1 X-Originating-IP: [192.55.52.120] X-SpamReason: No, hits=1.0 required=7.0 tests=DATE_IN_PAST_12_24 X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 20313 invoked from network); 22 Oct 2017 09:46:48 -0000 Received: from mga04.intel.com (HELO mga04.intel.com) (192.55.52.120) by server-9.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 22 Oct 2017 09:46:48 -0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Oct 2017 02:46:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.43,416,1503385200"; d="scan'208"; a="1208603456" Received: from vmm.bj.intel.com ([10.238.135.172]) by fmsmga001.fm.intel.com with ESMTP; 22 Oct 2017 02:46:43 -0700 From: Luwei Kang To: xen-devel@lists.xen.org Date: Sun, 22 Oct 2017 04:02:22 +0800 Message-Id: <1508616147-17310-2-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 1/6] x86: add a flag to enable Intel processor trace 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 add a flag to enable Intel PT (Intel processor trace). Default value is 1 (enabled). Signed-off-by: Luwei Kang --- docs/misc/xen-command-line.markdown | 7 +++++++ xen/arch/x86/cpu/Makefile | 1 + xen/arch/x86/cpu/intel_pt.c | 27 +++++++++++++++++++++++++++ xen/include/asm-x86/intel_pt.h | 26 ++++++++++++++++++++++++++ 4 files changed, 61 insertions(+) create mode 100644 xen/arch/x86/cpu/intel_pt.c create mode 100644 xen/include/asm-x86/intel_pt.h diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown index eb4995e..a376932 100644 --- a/docs/misc/xen-command-line.markdown +++ b/docs/misc/xen-command-line.markdown @@ -1009,6 +1009,13 @@ debug hypervisor only). ### idle\_latency\_factor > `= ` +### intel\_pt +> `= ` + +> Default: `true` + +Flag to enable Intel Processor Trace. + ### ioapic\_ack > `= old | new` diff --git a/xen/arch/x86/cpu/Makefile b/xen/arch/x86/cpu/Makefile index 74f23ae..33d7a74 100644 --- a/xen/arch/x86/cpu/Makefile +++ b/xen/arch/x86/cpu/Makefile @@ -8,3 +8,4 @@ obj-y += intel.o obj-y += intel_cacheinfo.o obj-y += mwait-idle.o obj-y += vpmu.o vpmu_amd.o vpmu_intel.o +obj-y += intel_pt.o diff --git a/xen/arch/x86/cpu/intel_pt.c b/xen/arch/x86/cpu/intel_pt.c new file mode 100644 index 0000000..be06d55 --- /dev/null +++ b/xen/arch/x86/cpu/intel_pt.c @@ -0,0 +1,27 @@ +/* + * intel_pt.c: Support Intel Processor Trace Virtualization. + * + * Copyright (c) 2017, Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; If not, see . + * + * Author: Luwei Kang + */ + +#include +#include +#include + +/* intel_pt: Flag to enable Intel Processor Trace (default on). */ +bool_t __read_mostly opt_intel_pt = 1; +boolean_param("intel_pt", opt_intel_pt); diff --git a/xen/include/asm-x86/intel_pt.h b/xen/include/asm-x86/intel_pt.h new file mode 100644 index 0000000..3b3a047 --- /dev/null +++ b/xen/include/asm-x86/intel_pt.h @@ -0,0 +1,26 @@ +/* + * intel_pt.h: Intel Processor Trace virtualization for HVM domain. + * + * Copyright (c) 2017, Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; If not, see . + * + * Author: Luwei Kang + */ + +#ifndef __ASM_X86_HVM_INTEL_PT_H_ +#define __ASM_X86_HVM_INTEL_PT_H_ + +extern bool_t opt_intel_pt; + +#endif /* __ASM_X86_HVM_INTEL_PT_H_ */