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> |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame^] | 16 | #include <asm/perf_event.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 | 25ad291 | 2008-09-05 17:12:36 +0200 | [diff] [blame] | 24 | struct op_msr *counters; |
| 25 | struct op_msr *controls; |
Jason Yeh | 4d4036e | 2009-07-08 13:49:38 +0200 | [diff] [blame] | 26 | struct op_msr *multiplex; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | }; |
| 28 | |
| 29 | struct pt_regs; |
| 30 | |
Robert Richter | 3370d35 | 2009-05-25 15:10:32 +0200 | [diff] [blame] | 31 | struct oprofile_operations; |
| 32 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | /* The model vtable abstracts the differences between |
Simon Arlott | 27b46d7 | 2007-10-20 01:13:56 +0200 | [diff] [blame] | 34 | * various x86 CPU models' perfctr support. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | */ |
| 36 | struct op_x86_model_spec { |
Robert Richter | 06552cc | 2009-05-28 02:12:36 +0200 | [diff] [blame] | 37 | unsigned int num_counters; |
| 38 | unsigned int num_controls; |
Jason Yeh | 4d4036e | 2009-07-08 13:49:38 +0200 | [diff] [blame] | 39 | unsigned int num_virt_counters; |
Robert Richter | 3370d35 | 2009-05-25 15:10:32 +0200 | [diff] [blame] | 40 | u64 reserved; |
| 41 | u16 event_mask; |
Robert Richter | 06552cc | 2009-05-28 02:12:36 +0200 | [diff] [blame] | 42 | int (*init)(struct oprofile_operations *ops); |
| 43 | void (*exit)(void); |
| 44 | void (*fill_in_addresses)(struct op_msrs * const msrs); |
Robert Richter | ef8828d | 2009-05-25 19:31:44 +0200 | [diff] [blame] | 45 | void (*setup_ctrs)(struct op_x86_model_spec const *model, |
| 46 | struct op_msrs const * const msrs); |
Robert Richter | 06552cc | 2009-05-28 02:12:36 +0200 | [diff] [blame] | 47 | int (*check_ctrs)(struct pt_regs * const regs, |
| 48 | struct op_msrs const * const msrs); |
| 49 | void (*start)(struct op_msrs const * const msrs); |
| 50 | void (*stop)(struct op_msrs const * const msrs); |
| 51 | void (*shutdown)(struct op_msrs const * const msrs); |
Jason Yeh | 4d4036e | 2009-07-08 13:49:38 +0200 | [diff] [blame] | 52 | #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX |
| 53 | void (*switch_ctrl)(struct op_x86_model_spec const *model, |
| 54 | struct op_msrs const * const msrs); |
| 55 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | }; |
| 57 | |
Robert Richter | 3370d35 | 2009-05-25 15:10:32 +0200 | [diff] [blame] | 58 | struct op_counter_config; |
| 59 | |
| 60 | extern u64 op_x86_get_ctrl(struct op_x86_model_spec const *model, |
| 61 | struct op_counter_config *counter_config); |
Robert Richter | d8471ad | 2009-07-16 13:04:43 +0200 | [diff] [blame] | 62 | extern int op_x86_phys_to_virt(int phys); |
Robert Richter | 61d149d | 2009-07-10 15:47:17 +0200 | [diff] [blame] | 63 | extern int op_x86_virt_to_phys(int virt); |
Robert Richter | 3370d35 | 2009-05-25 15:10:32 +0200 | [diff] [blame] | 64 | |
Robert Richter | 259a83a | 2009-07-09 15:12:35 +0200 | [diff] [blame] | 65 | extern struct op_x86_model_spec op_ppro_spec; |
| 66 | extern struct op_x86_model_spec op_p4_spec; |
| 67 | extern struct op_x86_model_spec op_p4_ht2_spec; |
| 68 | extern struct op_x86_model_spec op_amd_spec; |
Andi Kleen | b991702 | 2008-08-18 14:50:31 +0200 | [diff] [blame] | 69 | extern struct op_x86_model_spec op_arch_perfmon_spec; |
| 70 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | #endif /* OP_X86_MODEL_H */ |