Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /** |
| 2 | * @file op_x86_model.h |
| 3 | * interface to x86 model-specific MSR operations |
| 4 | * |
| 5 | * @remark Copyright 2002 OProfile authors |
| 6 | * @remark Read the file COPYING |
| 7 | * |
| 8 | * @author Graydon Hoare |
Robert Richter | 3370d35 | 2009-05-25 15:10:32 +0200 | [diff] [blame] | 9 | * @author Robert Richter <robert.richter@amd.com> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #ifndef OP_X86_MODEL_H |
| 13 | #define OP_X86_MODEL_H |
| 14 | |
Robert Richter | 3370d35 | 2009-05-25 15:10:32 +0200 | [diff] [blame] | 15 | #include <asm/types.h> |
Robert Richter | 1241eb8 | 2009-06-12 17:58:48 +0200 | [diff] [blame] | 16 | #include <asm/perf_counter.h> |
Robert Richter | ec064c0 | 2009-05-25 15:05:50 +0200 | [diff] [blame] | 17 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | struct op_msr { |
Robert Richter | 95e74e6 | 2009-06-03 19:09:27 +0200 | [diff] [blame] | 19 | unsigned long addr; |
| 20 | u64 saved; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | }; |
| 22 | |
| 23 | struct op_msrs { |
Robert Richter | 25ad2913 | 2008-09-05 17:12:36 +0200 | [diff] [blame] | 24 | struct op_msr *counters; |
| 25 | struct op_msr *controls; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | }; |
| 27 | |
| 28 | struct pt_regs; |
| 29 | |
Robert Richter | 3370d35 | 2009-05-25 15:10:32 +0200 | [diff] [blame] | 30 | struct oprofile_operations; |
| 31 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | /* The model vtable abstracts the differences between |
Simon Arlott | 27b46d7 | 2007-10-20 01:13:56 +0200 | [diff] [blame] | 33 | * various x86 CPU models' perfctr support. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | */ |
| 35 | struct op_x86_model_spec { |
Robert Richter | 06552cc | 2009-05-28 02:12:36 +0200 | [diff] [blame] | 36 | unsigned int num_counters; |
| 37 | unsigned int num_controls; |
Robert Richter | 3370d35 | 2009-05-25 15:10:32 +0200 | [diff] [blame] | 38 | u64 reserved; |
| 39 | u16 event_mask; |
Robert Richter | 06552cc | 2009-05-28 02:12:36 +0200 | [diff] [blame] | 40 | int (*init)(struct oprofile_operations *ops); |
| 41 | void (*exit)(void); |
| 42 | void (*fill_in_addresses)(struct op_msrs * const msrs); |
Robert Richter | ef8828d | 2009-05-25 19:31:44 +0200 | [diff] [blame] | 43 | void (*setup_ctrs)(struct op_x86_model_spec const *model, |
| 44 | struct op_msrs const * const msrs); |
Robert Richter | 06552cc | 2009-05-28 02:12:36 +0200 | [diff] [blame] | 45 | int (*check_ctrs)(struct pt_regs * const regs, |
| 46 | struct op_msrs const * const msrs); |
| 47 | void (*start)(struct op_msrs const * const msrs); |
| 48 | void (*stop)(struct op_msrs const * const msrs); |
| 49 | void (*shutdown)(struct op_msrs const * const msrs); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | }; |
| 51 | |
Robert Richter | 3370d35 | 2009-05-25 15:10:32 +0200 | [diff] [blame] | 52 | struct op_counter_config; |
| 53 | |
| 54 | extern u64 op_x86_get_ctrl(struct op_x86_model_spec const *model, |
| 55 | struct op_counter_config *counter_config); |
| 56 | |
Robert Richter | 849620f | 2009-05-14 17:10:52 +0200 | [diff] [blame] | 57 | extern struct op_x86_model_spec const op_ppro_spec; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | extern struct op_x86_model_spec const op_p4_spec; |
| 59 | extern struct op_x86_model_spec const op_p4_ht2_spec; |
Robert Richter | 6657fe4 | 2008-07-22 21:08:50 +0200 | [diff] [blame] | 60 | extern struct op_x86_model_spec const op_amd_spec; |
Andi Kleen | b991702 | 2008-08-18 14:50:31 +0200 | [diff] [blame] | 61 | extern struct op_x86_model_spec op_arch_perfmon_spec; |
| 62 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | #endif /* OP_X86_MODEL_H */ |