blob: 229e0b4e21e3153faff6ae524edaa0c623b15d21 [file] [log] [blame]
Paolo Ciarrocchid4413732008-02-19 23:51:27 +01001/*
Robert Richteradf5ec02008-07-22 21:08:48 +02002 * @file op_model_athlon.c
Barry Kasindorfbd87f1f2007-12-18 18:05:58 +01003 * athlon / K7 / K8 / Family 10h model-specific MSR operations
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
Robert Richteradf5ec02008-07-22 21:08:48 +02005 * @remark Copyright 2002-2008 OProfile authors
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 * @remark Read the file COPYING
7 *
8 * @author John Levon
9 * @author Philippe Elie
10 * @author Graydon Hoare
Robert Richteradf5ec02008-07-22 21:08:48 +020011 * @author Robert Richter <robert.richter@amd.com>
Barry Kasindorf56784f12008-07-22 21:08:55 +020012 * @author Barry Kasindorf
Robert Richteradf5ec02008-07-22 21:08:48 +020013*/
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
15#include <linux/oprofile.h>
Barry Kasindorf56784f12008-07-22 21:08:55 +020016#include <linux/device.h>
17#include <linux/pci.h>
18
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#include <asm/ptrace.h>
20#include <asm/msr.h>
Don Zickus3e4ff112006-06-26 13:57:01 +020021#include <asm/nmi.h>
Paolo Ciarrocchid4413732008-02-19 23:51:27 +010022
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#include "op_x86_model.h"
24#include "op_counter.h"
25
26#define NUM_COUNTERS 4
27#define NUM_CONTROLS 4
28
Paolo Ciarrocchid4413732008-02-19 23:51:27 +010029#define CTR_IS_RESERVED(msrs, c) (msrs->counters[(c)].addr ? 1 : 0)
30#define CTR_READ(l, h, msrs, c) do {rdmsr(msrs->counters[(c)].addr, (l), (h)); } while (0)
31#define CTR_WRITE(l, msrs, c) do {wrmsr(msrs->counters[(c)].addr, -(unsigned int)(l), -1); } while (0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070032#define CTR_OVERFLOWED(n) (!((n) & (1U<<31)))
33
Paolo Ciarrocchid4413732008-02-19 23:51:27 +010034#define CTRL_IS_RESERVED(msrs, c) (msrs->controls[(c)].addr ? 1 : 0)
35#define CTRL_READ(l, h, msrs, c) do {rdmsr(msrs->controls[(c)].addr, (l), (h)); } while (0)
36#define CTRL_WRITE(l, h, msrs, c) do {wrmsr(msrs->controls[(c)].addr, (l), (h)); } while (0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070037#define CTRL_SET_ACTIVE(n) (n |= (1<<22))
38#define CTRL_SET_INACTIVE(n) (n &= ~(1<<22))
Barry Kasindorfbd87f1f2007-12-18 18:05:58 +010039#define CTRL_CLEAR_LO(x) (x &= (1<<21))
40#define CTRL_CLEAR_HI(x) (x &= 0xfffffcf0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070041#define CTRL_SET_ENABLE(val) (val |= 1<<20)
Paolo Ciarrocchid4413732008-02-19 23:51:27 +010042#define CTRL_SET_USR(val, u) (val |= ((u & 1) << 16))
43#define CTRL_SET_KERN(val, k) (val |= ((k & 1) << 17))
Linus Torvalds1da177e2005-04-16 15:20:36 -070044#define CTRL_SET_UM(val, m) (val |= (m << 8))
Barry Kasindorfbd87f1f2007-12-18 18:05:58 +010045#define CTRL_SET_EVENT_LOW(val, e) (val |= (e & 0xff))
46#define CTRL_SET_EVENT_HIGH(val, e) (val |= ((e >> 8) & 0xf))
47#define CTRL_SET_HOST_ONLY(val, h) (val |= ((h & 1) << 9))
48#define CTRL_SET_GUEST_ONLY(val, h) (val |= ((h & 1) << 8))
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
Barry Kasindorf56784f12008-07-22 21:08:55 +020050#define IBS_FETCH_CTL_HIGH_MASK 0xFFFFFFFF
51/* high dword bit IbsFetchCtl[bit 49] */
52#define IBS_FETCH_VALID_BIT (1UL << 17)
53/* high dword bit IbsFetchCtl[bit 52] */
54#define IBS_FETCH_PHY_ADDR_VALID_BIT (1UL << 20)
55/* high dword bit IbsFetchCtl[bit 48] */
56#define IBS_FETCH_ENABLE (1UL << 16)
57
58#define IBS_FETCH_CTL_CNT_MASK 0x00000000FFFF0000UL
59#define IBS_FETCH_CTL_MAX_CNT_MASK 0x000000000000FFFFUL
60
61/*IbsOpCtl masks/bits */
62#define IBS_OP_VALID_BIT (1ULL<<18) /* IbsOpCtl[bit18] */
63#define IBS_OP_ENABLE (1ULL<<17) /* IBS_OP_ENABLE[bit17]*/
64
65/* Codes used in cpu_buffer.c */
66#define IBS_FETCH_BEGIN 3
67#define IBS_OP_BEGIN 4
68
69/*IbsOpData3 masks */
70#define IBS_CTL_LVT_OFFSET_VALID_BIT (1ULL<<8)
71
72/*PCI Extended Configuration Constants */
73/* MSR to set the IBS control register APIC LVT offset */
74#define IBS_LVT_OFFSET_PCI 0x1CC
75
76struct ibs_fetch_sample {
77 /* MSRC001_1031 IBS Fetch Linear Address Register */
78 unsigned int ibs_fetch_lin_addr_low;
79 unsigned int ibs_fetch_lin_addr_high;
80 /* MSRC001_1030 IBS Fetch Control Register */
81 unsigned int ibs_fetch_ctl_low;
82 unsigned int ibs_fetch_ctl_high;
83 /* MSRC001_1032 IBS Fetch Physical Address Register */
84 unsigned int ibs_fetch_phys_addr_low;
85 unsigned int ibs_fetch_phys_addr_high;
86};
87
88struct ibs_op_sample {
89 /* MSRC001_1034 IBS Op Logical Address Register (IbsRIP) */
90 unsigned int ibs_op_rip_low;
91 unsigned int ibs_op_rip_high;
92 /* MSRC001_1035 IBS Op Data Register */
93 unsigned int ibs_op_data1_low;
94 unsigned int ibs_op_data1_high;
95 /* MSRC001_1036 IBS Op Data 2 Register */
96 unsigned int ibs_op_data2_low;
97 unsigned int ibs_op_data2_high;
98 /* MSRC001_1037 IBS Op Data 3 Register */
99 unsigned int ibs_op_data3_low;
100 unsigned int ibs_op_data3_high;
101 /* MSRC001_1038 IBS DC Linear Address Register (IbsDcLinAd) */
102 unsigned int ibs_dc_linear_low;
103 unsigned int ibs_dc_linear_high;
104 /* MSRC001_1039 IBS DC Physical Address Register (IbsDcPhysAd) */
105 unsigned int ibs_dc_phys_low;
106 unsigned int ibs_dc_phys_high;
107};
108
109/*
110 * unitialize the APIC for the IBS interrupts if needed on AMD Family10h+
111*/
112static void clear_ibs_nmi(void);
113
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114static unsigned long reset_value[NUM_COUNTERS];
Barry Kasindorf56784f12008-07-22 21:08:55 +0200115static int ibs_allowed; /* AMD Family10h and later */
116
117struct op_ibs_config {
118 unsigned long op_enabled;
119 unsigned long fetch_enabled;
120 unsigned long max_cnt_fetch;
121 unsigned long max_cnt_op;
122 unsigned long rand_en;
123 unsigned long dispatched_ops;
124};
125
126static struct op_ibs_config ibs_config;
Paolo Ciarrocchid4413732008-02-19 23:51:27 +0100127
Robert Richter6657fe42008-07-22 21:08:50 +0200128/* functions for op_amd_spec */
Robert Richterdfa15422008-07-22 21:08:49 +0200129
Robert Richter6657fe42008-07-22 21:08:50 +0200130static void op_amd_fill_in_addresses(struct op_msrs * const msrs)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131{
Don Zickuscb9c4482006-09-26 10:52:26 +0200132 int i;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133
Paolo Ciarrocchid4413732008-02-19 23:51:27 +0100134 for (i = 0; i < NUM_COUNTERS; i++) {
Don Zickuscb9c4482006-09-26 10:52:26 +0200135 if (reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i))
136 msrs->counters[i].addr = MSR_K7_PERFCTR0 + i;
137 else
138 msrs->counters[i].addr = 0;
139 }
140
Paolo Ciarrocchid4413732008-02-19 23:51:27 +0100141 for (i = 0; i < NUM_CONTROLS; i++) {
Don Zickuscb9c4482006-09-26 10:52:26 +0200142 if (reserve_evntsel_nmi(MSR_K7_EVNTSEL0 + i))
143 msrs->controls[i].addr = MSR_K7_EVNTSEL0 + i;
144 else
145 msrs->controls[i].addr = 0;
146 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147}
148
Paolo Ciarrocchid4413732008-02-19 23:51:27 +0100149
Robert Richter6657fe42008-07-22 21:08:50 +0200150static void op_amd_setup_ctrs(struct op_msrs const * const msrs)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151{
152 unsigned int low, high;
153 int i;
Paolo Ciarrocchid4413732008-02-19 23:51:27 +0100154
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155 /* clear all counters */
156 for (i = 0 ; i < NUM_CONTROLS; ++i) {
Paolo Ciarrocchid4413732008-02-19 23:51:27 +0100157 if (unlikely(!CTRL_IS_RESERVED(msrs, i)))
Don Zickuscb9c4482006-09-26 10:52:26 +0200158 continue;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159 CTRL_READ(low, high, msrs, i);
Barry Kasindorfbd87f1f2007-12-18 18:05:58 +0100160 CTRL_CLEAR_LO(low);
161 CTRL_CLEAR_HI(high);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162 CTRL_WRITE(low, high, msrs, i);
163 }
Don Zickuscb9c4482006-09-26 10:52:26 +0200164
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165 /* avoid a false detection of ctr overflows in NMI handler */
166 for (i = 0; i < NUM_COUNTERS; ++i) {
Paolo Ciarrocchid4413732008-02-19 23:51:27 +0100167 if (unlikely(!CTR_IS_RESERVED(msrs, i)))
Don Zickuscb9c4482006-09-26 10:52:26 +0200168 continue;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169 CTR_WRITE(1, msrs, i);
170 }
171
172 /* enable active counters */
173 for (i = 0; i < NUM_COUNTERS; ++i) {
Paolo Ciarrocchid4413732008-02-19 23:51:27 +0100174 if ((counter_config[i].enabled) && (CTR_IS_RESERVED(msrs, i))) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175 reset_value[i] = counter_config[i].count;
176
177 CTR_WRITE(counter_config[i].count, msrs, i);
178
179 CTRL_READ(low, high, msrs, i);
Barry Kasindorfbd87f1f2007-12-18 18:05:58 +0100180 CTRL_CLEAR_LO(low);
181 CTRL_CLEAR_HI(high);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182 CTRL_SET_ENABLE(low);
183 CTRL_SET_USR(low, counter_config[i].user);
184 CTRL_SET_KERN(low, counter_config[i].kernel);
185 CTRL_SET_UM(low, counter_config[i].unit_mask);
Barry Kasindorfbd87f1f2007-12-18 18:05:58 +0100186 CTRL_SET_EVENT_LOW(low, counter_config[i].event);
187 CTRL_SET_EVENT_HIGH(high, counter_config[i].event);
188 CTRL_SET_HOST_ONLY(high, 0);
189 CTRL_SET_GUEST_ONLY(high, 0);
190
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191 CTRL_WRITE(low, high, msrs, i);
192 } else {
193 reset_value[i] = 0;
194 }
195 }
196}
197
Paolo Ciarrocchid4413732008-02-19 23:51:27 +0100198
Robert Richter6657fe42008-07-22 21:08:50 +0200199static int op_amd_check_ctrs(struct pt_regs * const regs,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700200 struct op_msrs const * const msrs)
201{
202 unsigned int low, high;
203 int i;
Barry Kasindorf56784f12008-07-22 21:08:55 +0200204 struct ibs_fetch_sample ibs_fetch;
205 struct ibs_op_sample ibs_op;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206
207 for (i = 0 ; i < NUM_COUNTERS; ++i) {
Don Zickuscb9c4482006-09-26 10:52:26 +0200208 if (!reset_value[i])
209 continue;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210 CTR_READ(low, high, msrs, i);
211 if (CTR_OVERFLOWED(low)) {
212 oprofile_add_sample(regs, i);
213 CTR_WRITE(reset_value[i], msrs, i);
214 }
215 }
216
Barry Kasindorf56784f12008-07-22 21:08:55 +0200217 /*If AMD and IBS is available */
218 if (ibs_allowed && ibs_config.fetch_enabled) {
219 rdmsr(MSR_AMD64_IBSFETCHCTL, low, high);
220 if (high & IBS_FETCH_VALID_BIT) {
221 ibs_fetch.ibs_fetch_ctl_high = high;
222 ibs_fetch.ibs_fetch_ctl_low = low;
223 rdmsr(MSR_AMD64_IBSFETCHLINAD, low, high);
224 ibs_fetch.ibs_fetch_lin_addr_high = high;
225 ibs_fetch.ibs_fetch_lin_addr_low = low;
226 rdmsr(MSR_AMD64_IBSFETCHPHYSAD, low, high);
227 ibs_fetch.ibs_fetch_phys_addr_high = high;
228 ibs_fetch.ibs_fetch_phys_addr_low = low;
229
230 oprofile_add_ibs_sample(regs,
231 (unsigned int *)&ibs_fetch,
232 IBS_FETCH_BEGIN);
233
234 /*reenable the IRQ */
235 rdmsr(MSR_AMD64_IBSFETCHCTL, low, high);
236 high &= ~(IBS_FETCH_VALID_BIT);
237 high |= IBS_FETCH_ENABLE;
238 low &= IBS_FETCH_CTL_MAX_CNT_MASK;
239 wrmsr(MSR_AMD64_IBSFETCHCTL, low, high);
240 }
241 }
242
243 if (ibs_allowed && ibs_config.op_enabled) {
244 rdmsr(MSR_AMD64_IBSOPCTL, low, high);
245 if (low & IBS_OP_VALID_BIT) {
246 rdmsr(MSR_AMD64_IBSOPRIP, low, high);
247 ibs_op.ibs_op_rip_low = low;
248 ibs_op.ibs_op_rip_high = high;
249 rdmsr(MSR_AMD64_IBSOPDATA, low, high);
250 ibs_op.ibs_op_data1_low = low;
251 ibs_op.ibs_op_data1_high = high;
252 rdmsr(MSR_AMD64_IBSOPDATA2, low, high);
253 ibs_op.ibs_op_data2_low = low;
254 ibs_op.ibs_op_data2_high = high;
255 rdmsr(MSR_AMD64_IBSOPDATA3, low, high);
256 ibs_op.ibs_op_data3_low = low;
257 ibs_op.ibs_op_data3_high = high;
258 rdmsr(MSR_AMD64_IBSDCLINAD, low, high);
259 ibs_op.ibs_dc_linear_low = low;
260 ibs_op.ibs_dc_linear_high = high;
261 rdmsr(MSR_AMD64_IBSDCPHYSAD, low, high);
262 ibs_op.ibs_dc_phys_low = low;
263 ibs_op.ibs_dc_phys_high = high;
264
265 /* reenable the IRQ */
266 oprofile_add_ibs_sample(regs,
267 (unsigned int *)&ibs_op,
268 IBS_OP_BEGIN);
269 rdmsr(MSR_AMD64_IBSOPCTL, low, high);
270 low &= ~(IBS_OP_VALID_BIT);
271 low |= IBS_OP_ENABLE;
272 wrmsr(MSR_AMD64_IBSOPCTL, low, high);
273 }
274 }
275
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276 /* See op_model_ppro.c */
277 return 1;
278}
279
Paolo Ciarrocchid4413732008-02-19 23:51:27 +0100280
Robert Richter6657fe42008-07-22 21:08:50 +0200281static void op_amd_start(struct op_msrs const * const msrs)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700282{
283 unsigned int low, high;
284 int i;
285 for (i = 0 ; i < NUM_COUNTERS ; ++i) {
286 if (reset_value[i]) {
287 CTRL_READ(low, high, msrs, i);
288 CTRL_SET_ACTIVE(low);
289 CTRL_WRITE(low, high, msrs, i);
290 }
291 }
Barry Kasindorf56784f12008-07-22 21:08:55 +0200292 if (ibs_allowed && ibs_config.fetch_enabled) {
293 low = (ibs_config.max_cnt_fetch >> 4) & 0xFFFF;
294 high = IBS_FETCH_ENABLE;
295 wrmsr(MSR_AMD64_IBSFETCHCTL, low, high);
296 }
297
298 if (ibs_allowed && ibs_config.op_enabled) {
299 low = ((ibs_config.max_cnt_op >> 4) & 0xFFFF) + IBS_OP_ENABLE;
300 high = 0;
301 wrmsr(MSR_AMD64_IBSOPCTL, low, high);
302 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700303}
304
305
Robert Richter6657fe42008-07-22 21:08:50 +0200306static void op_amd_stop(struct op_msrs const * const msrs)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307{
Paolo Ciarrocchid4413732008-02-19 23:51:27 +0100308 unsigned int low, high;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700309 int i;
310
311 /* Subtle: stop on all counters to avoid race with
312 * setting our pm callback */
313 for (i = 0 ; i < NUM_COUNTERS ; ++i) {
Don Zickuscb9c4482006-09-26 10:52:26 +0200314 if (!reset_value[i])
315 continue;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700316 CTRL_READ(low, high, msrs, i);
317 CTRL_SET_INACTIVE(low);
318 CTRL_WRITE(low, high, msrs, i);
319 }
Barry Kasindorf56784f12008-07-22 21:08:55 +0200320
321 if (ibs_allowed && ibs_config.fetch_enabled) {
322 low = 0; /* clear max count and enable */
323 high = 0;
324 wrmsr(MSR_AMD64_IBSFETCHCTL, low, high);
325 }
326
327 if (ibs_allowed && ibs_config.op_enabled) {
328 low = 0; /* clear max count and enable */
329 high = 0;
330 wrmsr(MSR_AMD64_IBSOPCTL, low, high);
331 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700332}
333
Robert Richter6657fe42008-07-22 21:08:50 +0200334static void op_amd_shutdown(struct op_msrs const * const msrs)
Don Zickuscb9c4482006-09-26 10:52:26 +0200335{
336 int i;
337
338 for (i = 0 ; i < NUM_COUNTERS ; ++i) {
Paolo Ciarrocchid4413732008-02-19 23:51:27 +0100339 if (CTR_IS_RESERVED(msrs, i))
Don Zickuscb9c4482006-09-26 10:52:26 +0200340 release_perfctr_nmi(MSR_K7_PERFCTR0 + i);
341 }
342 for (i = 0 ; i < NUM_CONTROLS ; ++i) {
Paolo Ciarrocchid4413732008-02-19 23:51:27 +0100343 if (CTRL_IS_RESERVED(msrs, i))
Don Zickuscb9c4482006-09-26 10:52:26 +0200344 release_evntsel_nmi(MSR_K7_EVNTSEL0 + i);
345 }
346}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700347
Barry Kasindorf56784f12008-07-22 21:08:55 +0200348static inline void apic_init_ibs_nmi_per_cpu(void *arg)
349{
350 setup_APIC_eilvt_ibs(0, APIC_EILVT_MSG_NMI, 0);
351}
352
353static inline void apic_clear_ibs_nmi_per_cpu(void *arg)
354{
355 setup_APIC_eilvt_ibs(0, APIC_EILVT_MSG_FIX, 1);
356}
357
358/*
359 * initialize the APIC for the IBS interrupts
360 * if needed on AMD Family10h rev B0 and later
361 */
362static void setup_ibs(void)
363{
364 struct pci_dev *gh_device = NULL;
365 u32 low, high;
366 u8 vector;
367
368 ibs_allowed = boot_cpu_has(X86_FEATURE_IBS);
369
370 if (!ibs_allowed)
371 return;
372
373 /* This gets the APIC_EILVT_LVTOFF_IBS value */
374 vector = setup_APIC_eilvt_ibs(0, 0, 1);
375
376 /*see if the IBS control register is already set correctly*/
377 /*remove this when we know for sure it is done
378 in the kernel init*/
379 rdmsr(MSR_AMD64_IBSCTL, low, high);
380 if ((low & (IBS_CTL_LVT_OFFSET_VALID_BIT | vector)) !=
381 (IBS_CTL_LVT_OFFSET_VALID_BIT | vector)) {
382
383 /**** Be sure to run loop until NULL is returned to
384 decrement reference count on any pci_dev structures
385 returned ****/
386 while ((gh_device = pci_get_device(PCI_VENDOR_ID_AMD,
387 PCI_DEVICE_ID_AMD_10H_NB_MISC, gh_device))
388 != NULL) {
389 /* This code may change if we can find a proper
390 * way to get at the PCI extended config space */
391 pci_write_config_dword(
392 gh_device, IBS_LVT_OFFSET_PCI,
393 (vector | IBS_CTL_LVT_OFFSET_VALID_BIT));
394 }
395 }
396 on_each_cpu(apic_init_ibs_nmi_per_cpu, NULL, 1, 1);
397}
398
399
400/*
401 * unitialize the APIC for the IBS interrupts if needed on AMD Family10h
402 * rev B0 and later */
403static void clear_ibs_nmi(void)
404{
405 if (ibs_allowed)
406 on_each_cpu(apic_clear_ibs_nmi_per_cpu, NULL, 1, 1);
407}
408
409static void setup_ibs_files(struct super_block *sb, struct dentry *root)
410{
411 char buf[12];
412 struct dentry *dir;
413
414 if (!ibs_allowed)
415 return;
416
417 /* setup some reasonable defaults */
418 ibs_config.max_cnt_fetch = 250000;
419 ibs_config.fetch_enabled = 0;
420 ibs_config.max_cnt_op = 250000;
421 ibs_config.op_enabled = 0;
422 ibs_config.dispatched_ops = 1;
423 snprintf(buf, sizeof(buf), "ibs_fetch");
424 dir = oprofilefs_mkdir(sb, root, buf);
425 oprofilefs_create_ulong(sb, dir, "rand_enable",
426 &ibs_config.rand_en);
427 oprofilefs_create_ulong(sb, dir, "enable",
428 &ibs_config.fetch_enabled);
429 oprofilefs_create_ulong(sb, dir, "max_count",
430 &ibs_config.max_cnt_fetch);
431 snprintf(buf, sizeof(buf), "ibs_uops");
432 dir = oprofilefs_mkdir(sb, root, buf);
433 oprofilefs_create_ulong(sb, dir, "enable",
434 &ibs_config.op_enabled);
435 oprofilefs_create_ulong(sb, dir, "max_count",
436 &ibs_config.max_cnt_op);
437 oprofilefs_create_ulong(sb, dir, "dispatched_ops",
438 &ibs_config.dispatched_ops);
439}
440
Robert Richteradf5ec02008-07-22 21:08:48 +0200441static int op_amd_init(struct oprofile_operations *ops)
442{
443 return 0;
444}
445
446static void op_amd_exit(void)
447{
448}
449
Robert Richter6657fe42008-07-22 21:08:50 +0200450struct op_x86_model_spec const op_amd_spec = {
Robert Richteradf5ec02008-07-22 21:08:48 +0200451 .init = op_amd_init,
452 .exit = op_amd_exit,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700453 .num_counters = NUM_COUNTERS,
454 .num_controls = NUM_CONTROLS,
Robert Richter6657fe42008-07-22 21:08:50 +0200455 .fill_in_addresses = &op_amd_fill_in_addresses,
456 .setup_ctrs = &op_amd_setup_ctrs,
457 .check_ctrs = &op_amd_check_ctrs,
458 .start = &op_amd_start,
459 .stop = &op_amd_stop,
460 .shutdown = &op_amd_shutdown
Linus Torvalds1da177e2005-04-16 15:20:36 -0700461};