aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/events/amd/core.c111
1 files changed, 108 insertions, 3 deletions
diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c
index d45f3fbd232e..f15441b07dad 100644
--- a/arch/x86/events/amd/core.c
+++ b/arch/x86/events/amd/core.c
@@ -116,6 +116,110 @@ static __initconst const u64 amd_hw_cache_event_ids
116 }, 116 },
117}; 117};
118 118
119static __initconst const u64 amd_hw_cache_event_ids_f17h
120 [PERF_COUNT_HW_CACHE_MAX]
121 [PERF_COUNT_HW_CACHE_OP_MAX]
122 [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
123[C(L1D)] = {
124 [C(OP_READ)] = {
125 [C(RESULT_ACCESS)] = 0x0040, /* Data Cache Accesses */
126 [C(RESULT_MISS)] = 0xc860, /* L2$ access from DC Miss */
127 },
128 [C(OP_WRITE)] = {
129 [C(RESULT_ACCESS)] = 0,
130 [C(RESULT_MISS)] = 0,
131 },
132 [C(OP_PREFETCH)] = {
133 [C(RESULT_ACCESS)] = 0xff5a, /* h/w prefetch DC Fills */
134 [C(RESULT_MISS)] = 0,
135 },
136},
137[C(L1I)] = {
138 [C(OP_READ)] = {
139 [C(RESULT_ACCESS)] = 0x0080, /* Instruction cache fetches */
140 [C(RESULT_MISS)] = 0x0081, /* Instruction cache misses */
141 },
142 [C(OP_WRITE)] = {
143 [C(RESULT_ACCESS)] = -1,
144 [C(RESULT_MISS)] = -1,
145 },
146 [C(OP_PREFETCH)] = {
147 [C(RESULT_ACCESS)] = 0,
148 [C(RESULT_MISS)] = 0,
149 },
150},
151[C(LL)] = {
152 [C(OP_READ)] = {
153 [C(RESULT_ACCESS)] = 0,
154 [C(RESULT_MISS)] = 0,
155 },
156 [C(OP_WRITE)] = {
157 [C(RESULT_ACCESS)] = 0,
158 [C(RESULT_MISS)] = 0,
159 },
160 [C(OP_PREFETCH)] = {
161 [C(RESULT_ACCESS)] = 0,
162 [C(RESULT_MISS)] = 0,
163 },
164},
165[C(DTLB)] = {
166 [C(OP_READ)] = {
167 [C(RESULT_ACCESS)] = 0xff45, /* All L2 DTLB accesses */
168 [C(RESULT_MISS)] = 0xf045, /* L2 DTLB misses (PT walks) */
169 },
170 [C(OP_WRITE)] = {
171 [C(RESULT_ACCESS)] = 0,
172 [C(RESULT_MISS)] = 0,
173 },
174 [C(OP_PREFETCH)] = {
175 [C(RESULT_ACCESS)] = 0,
176 [C(RESULT_MISS)] = 0,
177 },
178},
179[C(ITLB)] = {
180 [C(OP_READ)] = {
181 [C(RESULT_ACCESS)] = 0x0084, /* L1 ITLB misses, L2 ITLB hits */
182 [C(RESULT_MISS)] = 0xff85, /* L1 ITLB misses, L2 misses */
183 },
184 [C(OP_WRITE)] = {
185 [C(RESULT_ACCESS)] = -1,
186 [C(RESULT_MISS)] = -1,
187 },
188 [C(OP_PREFETCH)] = {
189 [C(RESULT_ACCESS)] = -1,
190 [C(RESULT_MISS)] = -1,
191 },
192},
193[C(BPU)] = {
194 [C(OP_READ)] = {
195 [C(RESULT_ACCESS)] = 0x00c2, /* Retired Branch Instr. */
196 [C(RESULT_MISS)] = 0x00c3, /* Retired Mispredicted BI */
197 },
198 [C(OP_WRITE)] = {
199 [C(RESULT_ACCESS)] = -1,
200 [C(RESULT_MISS)] = -1,
201 },
202 [C(OP_PREFETCH)] = {
203 [C(RESULT_ACCESS)] = -1,
204 [C(RESULT_MISS)] = -1,
205 },
206},
207[C(NODE)] = {
208 [C(OP_READ)] = {
209 [C(RESULT_ACCESS)] = 0,
210 [C(RESULT_MISS)] = 0,
211 },
212 [C(OP_WRITE)] = {
213 [C(RESULT_ACCESS)] = -1,
214 [C(RESULT_MISS)] = -1,
215 },
216 [C(OP_PREFETCH)] = {
217 [C(RESULT_ACCESS)] = -1,
218 [C(RESULT_MISS)] = -1,
219 },
220},
221};
222
119/* 223/*
120 * AMD Performance Monitor K7 and later, up to and including Family 16h: 224 * AMD Performance Monitor K7 and later, up to and including Family 16h:
121 */ 225 */
@@ -865,9 +969,10 @@ __init int amd_pmu_init(void)
865 x86_pmu.amd_nb_constraints = 0; 969 x86_pmu.amd_nb_constraints = 0;
866 } 970 }
867 971
868 /* Events are common for all AMDs */ 972 if (boot_cpu_data.x86 >= 0x17)
869 memcpy(hw_cache_event_ids, amd_hw_cache_event_ids, 973 memcpy(hw_cache_event_ids, amd_hw_cache_event_ids_f17h, sizeof(hw_cache_event_ids));
870 sizeof(hw_cache_event_ids)); 974 else
975 memcpy(hw_cache_event_ids, amd_hw_cache_event_ids, sizeof(hw_cache_event_ids));
871 976
872 return 0; 977 return 0;
873} 978}