aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakao Indoh <indou.takao@jp.fujitsu.com>2015-08-04 05:36:55 -0400
committerIngo Molnar <mingo@kernel.org>2015-08-12 05:43:22 -0400
commit709bc871923c12b284424f9d47b99dc975ba8b29 (patch)
tree85927f711a2f34381ba0fd9cfb7cf3ecb67dc411
parentc2ad6b51efc5f27d70ce952decd2a15679b83600 (diff)
perf/x86/intel/pt: Clean up files of Intel Processor Trace
This patch just cleans up some files of Intel Processor Trace, does not change its behavior. This patch removes unused definitions and replaces a constant value with a macro. Signed-off-by: Takao Indoh <indou.takao@jp.fujitsu.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Alexander Shishkin<alexander.shishkin@linux.intel.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: H.Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1438681015-5124-1-git-send-email-indou.takao@jp.fujitsu.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/kernel/cpu/intel_pt.h33
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_pt.c10
2 files changed, 11 insertions, 32 deletions
diff --git a/arch/x86/kernel/cpu/intel_pt.h b/arch/x86/kernel/cpu/intel_pt.h
index feb293e96531..336878a5d205 100644
--- a/arch/x86/kernel/cpu/intel_pt.h
+++ b/arch/x86/kernel/cpu/intel_pt.h
@@ -25,32 +25,11 @@
25 */ 25 */
26#define TOPA_PMI_MARGIN 512 26#define TOPA_PMI_MARGIN 512
27 27
28/* 28#define TOPA_SHIFT 12
29 * Table of Physical Addresses bits
30 */
31enum topa_sz {
32 TOPA_4K = 0,
33 TOPA_8K,
34 TOPA_16K,
35 TOPA_32K,
36 TOPA_64K,
37 TOPA_128K,
38 TOPA_256K,
39 TOPA_512K,
40 TOPA_1MB,
41 TOPA_2MB,
42 TOPA_4MB,
43 TOPA_8MB,
44 TOPA_16MB,
45 TOPA_32MB,
46 TOPA_64MB,
47 TOPA_128MB,
48 TOPA_SZ_END,
49};
50 29
51static inline unsigned int sizes(enum topa_sz tsz) 30static inline unsigned int sizes(unsigned int tsz)
52{ 31{
53 return 1 << (tsz + 12); 32 return 1 << (tsz + TOPA_SHIFT);
54}; 33};
55 34
56struct topa_entry { 35struct topa_entry {
@@ -66,8 +45,8 @@ struct topa_entry {
66 u64 rsvd4 : 16; 45 u64 rsvd4 : 16;
67}; 46};
68 47
69#define TOPA_SHIFT 12 48#define PT_CPUID_LEAVES 2
70#define PT_CPUID_LEAVES 2 49#define PT_CPUID_REGS_NUM 4 /* number of regsters (eax, ebx, ecx, edx) */
71 50
72enum pt_capabilities { 51enum pt_capabilities {
73 PT_CAP_max_subleaf = 0, 52 PT_CAP_max_subleaf = 0,
@@ -85,7 +64,7 @@ enum pt_capabilities {
85 64
86struct pt_pmu { 65struct pt_pmu {
87 struct pmu pmu; 66 struct pmu pmu;
88 u32 caps[4 * PT_CPUID_LEAVES]; 67 u32 caps[PT_CPUID_REGS_NUM * PT_CPUID_LEAVES];
89}; 68};
90 69
91/** 70/**
diff --git a/arch/x86/kernel/cpu/perf_event_intel_pt.c b/arch/x86/kernel/cpu/perf_event_intel_pt.c
index e20cfacb5a32..42169283448b 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_pt.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_pt.c
@@ -79,7 +79,7 @@ static struct pt_cap_desc {
79static u32 pt_cap_get(enum pt_capabilities cap) 79static u32 pt_cap_get(enum pt_capabilities cap)
80{ 80{
81 struct pt_cap_desc *cd = &pt_caps[cap]; 81 struct pt_cap_desc *cd = &pt_caps[cap];
82 u32 c = pt_pmu.caps[cd->leaf * 4 + cd->reg]; 82 u32 c = pt_pmu.caps[cd->leaf * PT_CPUID_REGS_NUM + cd->reg];
83 unsigned int shift = __ffs(cd->mask); 83 unsigned int shift = __ffs(cd->mask);
84 84
85 return (c & cd->mask) >> shift; 85 return (c & cd->mask) >> shift;
@@ -145,10 +145,10 @@ static int __init pt_pmu_hw_init(void)
145 145
146 for (i = 0; i < PT_CPUID_LEAVES; i++) { 146 for (i = 0; i < PT_CPUID_LEAVES; i++) {
147 cpuid_count(20, i, 147 cpuid_count(20, i,
148 &pt_pmu.caps[CR_EAX + i*4], 148 &pt_pmu.caps[CR_EAX + i*PT_CPUID_REGS_NUM],
149 &pt_pmu.caps[CR_EBX + i*4], 149 &pt_pmu.caps[CR_EBX + i*PT_CPUID_REGS_NUM],
150 &pt_pmu.caps[CR_ECX + i*4], 150 &pt_pmu.caps[CR_ECX + i*PT_CPUID_REGS_NUM],
151 &pt_pmu.caps[CR_EDX + i*4]); 151 &pt_pmu.caps[CR_EDX + i*PT_CPUID_REGS_NUM]);
152 } 152 }
153 153
154 ret = -ENOMEM; 154 ret = -ENOMEM;