kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luwei Kang <luwei.kang@intel.com>
To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
	hpa@zytor.com, x86@kernel.org, songliubraving@fb.com,
	pbonzini@redhat.com, rkrcmar@redhat.com, peterz@infradead.org,
	zsm@chromium.org, alexander.shishkin@linux.intel.com,
	konrad.wilk@oracle.com, ak@linux.intel.com,
	Luwei Kang <luwei.kang@intel.com>
Subject: [PATCH 1/3] perf/x86/intel/pt: Move pt structure to global header
Date: Sat, 19 Jan 2019 15:04:42 -0500	[thread overview]
Message-ID: <1547928284-2915-2-git-send-email-luwei.kang@intel.com> (raw)
In-Reply-To: <1547928284-2915-1-git-send-email-luwei.kang@intel.com>

Intel PT structure (struct pt) is in a private header.
Move it (and sub structure) to a global header so that
it can be accessible from KVM code.

The definition of perf_output_handle structure included
in "linux/perf_event.h".

Signed-off-by: Luwei Kang <luwei.kang@intel.com>
---
 arch/x86/events/intel/pt.h      | 38 --------------------------------------
 arch/x86/include/asm/intel_pt.h | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 38 deletions(-)

diff --git a/arch/x86/events/intel/pt.h b/arch/x86/events/intel/pt.h
index 269e15a..964948f 100644
--- a/arch/x86/events/intel/pt.h
+++ b/arch/x86/events/intel/pt.h
@@ -93,42 +93,4 @@ struct pt_buffer {
 	struct topa_entry	*topa_index[0];
 };
 
-#define PT_FILTERS_NUM	4
-
-/**
- * struct pt_filter - IP range filter configuration
- * @msr_a:	range start, goes to RTIT_ADDRn_A
- * @msr_b:	range end, goes to RTIT_ADDRn_B
- * @config:	4-bit field in RTIT_CTL
- */
-struct pt_filter {
-	unsigned long	msr_a;
-	unsigned long	msr_b;
-	unsigned long	config;
-};
-
-/**
- * struct pt_filters - IP range filtering context
- * @filter:	filters defined for this context
- * @nr_filters:	number of defined filters in the @filter array
- */
-struct pt_filters {
-	struct pt_filter	filter[PT_FILTERS_NUM];
-	unsigned int		nr_filters;
-};
-
-/**
- * struct pt - per-cpu pt context
- * @handle:	perf output handle
- * @filters:		last configured filters
- * @handle_nmi:	do handle PT PMI on this cpu, there's an active event
- * @vmx_on:	1 if VMX is ON on this cpu
- */
-struct pt {
-	struct perf_output_handle handle;
-	struct pt_filters	filters;
-	int			handle_nmi;
-	int			vmx_on;
-};
-
 #endif /* __INTEL_PT_H__ */
diff --git a/arch/x86/include/asm/intel_pt.h b/arch/x86/include/asm/intel_pt.h
index 634f99b..ee960fb 100644
--- a/arch/x86/include/asm/intel_pt.h
+++ b/arch/x86/include/asm/intel_pt.h
@@ -2,6 +2,8 @@
 #ifndef _ASM_X86_INTEL_PT_H
 #define _ASM_X86_INTEL_PT_H
 
+#include <linux/perf_event.h>
+
 #define PT_CPUID_LEAVES		2
 #define PT_CPUID_REGS_NUM	4 /* number of regsters (eax, ebx, ecx, edx) */
 
@@ -24,6 +26,44 @@ enum pt_capabilities {
 	PT_CAP_psb_periods,
 };
 
+#define PT_FILTERS_NUM 4
+
+/**
+ * struct pt_filter - IP range filter configuration
+ * @msr_a:     range start, goes to RTIT_ADDRn_A
+ * @msr_b:     range end, goes to RTIT_ADDRn_B
+ * @config:    4-bit field in RTIT_CTL
+ */
+struct pt_filter {
+	unsigned long   msr_a;
+	unsigned long   msr_b;
+	unsigned long   config;
+};
+
+/**
+ * struct pt_filters - IP range filtering context
+ * @filter:    filters defined for this context
+ * @nr_filters:        number of defined filters in the @filter array
+ */
+struct pt_filters {
+	struct pt_filter        filter[PT_FILTERS_NUM];
+	unsigned int            nr_filters;
+};
+
+/**
+ * struct pt - per-cpu pt context
+ * @handle:    perf output handle
+ * @filters:           last configured filters
+ * @handle_nmi:        do handle PT PMI on this cpu, there's an active event
+ * @vmx_on:    1 if VMX is ON on this cpu
+ */
+struct pt {
+	struct perf_output_handle handle;
+	struct pt_filters       filters;
+	int                     handle_nmi;
+	int                     vmx_on;
+};
+
 #if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL)
 void cpu_emergency_stop_pt(void);
 extern u32 intel_pt_validate_hw_cap(enum pt_capabilities cap);
-- 
1.8.3.1

  reply	other threads:[~2019-01-19 20:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-19 20:04 [PATCH 0/3] Inject a PMI for KVM Guest when ToPA buffer is filled Luwei Kang
2019-01-19 20:04 ` Luwei Kang [this message]
2019-01-19 20:04 ` [PATCH 2/3] perf/x86/intel/pt: Inject PMI for KVM guest Luwei Kang
2019-01-30 17:02   ` Paolo Bonzini
2019-02-06 16:34     ` Peter Zijlstra
2019-02-07  8:42       ` Paolo Bonzini
2019-01-19 20:04 ` [PATCH 3/3] KVM: x86: Add support of clear Trace_ToPA_PMI status Luwei Kang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1547928284-2915-2-git-send-email-luwei.kang@intel.com \
    --to=luwei.kang@intel.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=konrad.wilk@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rkrcmar@redhat.com \
    --cc=songliubraving@fb.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=zsm@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).