aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2010-02-25 13:43:07 -0500
committerRobert Richter <robert.richter@amd.com>2010-03-01 05:23:15 -0500
commita163b1099dc7016704043c7fc572ae42519f08f7 (patch)
tree3ef749366e7a8a3bf94468ff7230f701fa2a49c8 /arch
parent1d6040f17d12a65b9f7ab4cb9fd6d721206b79ec (diff)
perf, x86: add some IBS macros to perf_event.h
Signed-off-by: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/include/asm/perf_event.h4
-rw-r--r--arch/x86/oprofile/op_model_amd.c6
2 files changed, 6 insertions, 4 deletions
diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h
index 4933ccde96c4..c7f60e1297ab 100644
--- a/arch/x86/include/asm/perf_event.h
+++ b/arch/x86/include/asm/perf_event.h
@@ -121,12 +121,14 @@ union cpuid10_edx {
121#define IBS_FETCH_RAND_EN (1ULL<<57) 121#define IBS_FETCH_RAND_EN (1ULL<<57)
122#define IBS_FETCH_VAL (1ULL<<49) 122#define IBS_FETCH_VAL (1ULL<<49)
123#define IBS_FETCH_ENABLE (1ULL<<48) 123#define IBS_FETCH_ENABLE (1ULL<<48)
124#define IBS_FETCH_CNT_MASK 0xFFFF0000ULL 124#define IBS_FETCH_CNT 0xFFFF0000ULL
125#define IBS_FETCH_MAX_CNT 0x0000FFFFULL
125 126
126/* IbsOpCtl bits */ 127/* IbsOpCtl bits */
127#define IBS_OP_CNT_CTL (1ULL<<19) 128#define IBS_OP_CNT_CTL (1ULL<<19)
128#define IBS_OP_VAL (1ULL<<18) 129#define IBS_OP_VAL (1ULL<<18)
129#define IBS_OP_ENABLE (1ULL<<17) 130#define IBS_OP_ENABLE (1ULL<<17)
131#define IBS_OP_MAX_CNT 0x0000FFFFULL
130 132
131#ifdef CONFIG_PERF_EVENTS 133#ifdef CONFIG_PERF_EVENTS
132extern void init_hw_perf_events(void); 134extern void init_hw_perf_events(void);
diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c
index c67174917305..8ddb9fa9c1b2 100644
--- a/arch/x86/oprofile/op_model_amd.c
+++ b/arch/x86/oprofile/op_model_amd.c
@@ -279,7 +279,7 @@ op_amd_handle_ibs(struct pt_regs * const regs,
279 oprofile_write_commit(&entry); 279 oprofile_write_commit(&entry);
280 280
281 /* reenable the IRQ */ 281 /* reenable the IRQ */
282 ctl &= ~(IBS_FETCH_VAL | IBS_FETCH_CNT_MASK); 282 ctl &= ~(IBS_FETCH_VAL | IBS_FETCH_CNT);
283 ctl |= IBS_FETCH_ENABLE; 283 ctl |= IBS_FETCH_ENABLE;
284 wrmsrl(MSR_AMD64_IBSFETCHCTL, ctl); 284 wrmsrl(MSR_AMD64_IBSFETCHCTL, ctl);
285 } 285 }
@@ -319,7 +319,7 @@ static inline void op_amd_start_ibs(void)
319 return; 319 return;
320 320
321 if (ibs_config.fetch_enabled) { 321 if (ibs_config.fetch_enabled) {
322 val = (ibs_config.max_cnt_fetch >> 4) & 0xFFFF; 322 val = (ibs_config.max_cnt_fetch >> 4) & IBS_FETCH_MAX_CNT;
323 val |= ibs_config.rand_en ? IBS_FETCH_RAND_EN : 0; 323 val |= ibs_config.rand_en ? IBS_FETCH_RAND_EN : 0;
324 val |= IBS_FETCH_ENABLE; 324 val |= IBS_FETCH_ENABLE;
325 wrmsrl(MSR_AMD64_IBSFETCHCTL, val); 325 wrmsrl(MSR_AMD64_IBSFETCHCTL, val);
@@ -341,7 +341,7 @@ static inline void op_amd_start_ibs(void)
341 * avoid underflows. 341 * avoid underflows.
342 */ 342 */
343 ibs_op_ctl = min(ibs_op_ctl + IBS_RANDOM_MAXCNT_OFFSET, 343 ibs_op_ctl = min(ibs_op_ctl + IBS_RANDOM_MAXCNT_OFFSET,
344 0xFFFFULL); 344 IBS_OP_MAX_CNT);
345 } 345 }
346 if (ibs_caps & IBS_CAPS_OPCNT && ibs_config.dispatched_ops) 346 if (ibs_caps & IBS_CAPS_OPCNT && ibs_config.dispatched_ops)
347 ibs_op_ctl |= IBS_OP_CNT_CTL; 347 ibs_op_ctl |= IBS_OP_CNT_CTL;