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 9 */ 10 11 #ifndef OP_X86_MODEL_H 12 #define OP_X86_MODEL_H 13 14 struct op_msr { 15 unsigned long addr; 16 uint64_t value; 17 }; 18 19 struct op_msrs { 20 struct op_msr * counters; 21 struct op_msr * controls; 22 }; 23 24 struct pt_regs; 25 26 /* The model vtable abstracts the differences between 27 * various x86 CPU model's perfctr support. 28 */ 29 struct op_x86_model_spec { 30 unsigned int num_counters; 31 unsigned int num_controls; 32 void (*fill_in_addresses)(struct op_msrs * const msrs); 33 void (*setup_ctrs)(struct op_msrs const * const msrs); 34 int (*check_ctrs)(unsigned int const cpu, 35 struct op_msrs const * const msrs, 36 struct cpu_user_regs const * const regs); 37 void (*start)(struct op_msrs const * const msrs); 38 void (*stop)(struct op_msrs const * const msrs); 39 int (*is_arch_pmu_msr)(u64 msr_index, int *type, int *index); 40 int (*allocated_msr)(struct vcpu *v); 41 void (*free_msr)(struct vcpu *v); 42 void (*load_msr)(struct vcpu * const v, int type, int index, u64 *msr_content); 43 void (*save_msr)(struct vcpu * const v, int type, int index, u64 msr_content); 44 }; 45 46 extern struct op_x86_model_spec op_ppro_spec; 47 extern struct op_x86_model_spec op_arch_perfmon_spec; 48 extern struct op_x86_model_spec const op_p4_spec; 49 extern struct op_x86_model_spec const op_p4_ht2_spec; 50 extern struct op_x86_model_spec const op_athlon_spec; 51 extern struct op_x86_model_spec const op_amd_fam15h_spec; 52 53 void arch_perfmon_setup_counters(void); 54 55 extern int ppro_has_global_ctrl; 56 extern struct op_x86_model_spec const *model; 57 58 #endif /* OP_X86_MODEL_H */ 59