3 * interface to x86 model-specific MSR operations
5 * @remark Copyright 2002 OProfile authors
6 * @remark Read the file COPYING
8 * @author Graydon Hoare
9 * @author Robert Richter <robert.richter@amd.com>
12 #ifndef OP_X86_MODEL_H
13 #define OP_X86_MODEL_H
15 #include <asm/types.h>
16 #include <asm/perf_event.h>
24 struct op_msr *counters;
25 struct op_msr *controls;
26 struct op_msr *multiplex;
31 struct oprofile_operations;
33 /* The model vtable abstracts the differences between
34 * various x86 CPU models' perfctr support.
36 struct op_x86_model_spec {
37 unsigned int num_counters;
38 unsigned int num_controls;
39 unsigned int num_virt_counters;
42 int (*init)(struct oprofile_operations *ops);
44 void (*fill_in_addresses)(struct op_msrs * const msrs);
45 void (*setup_ctrs)(struct op_x86_model_spec const *model,
46 struct op_msrs const * const msrs);
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);
52 #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
53 void (*switch_ctrl)(struct op_x86_model_spec const *model,
54 struct op_msrs const * const msrs);
58 struct op_counter_config;
60 static inline void op_x86_warn_in_use(int counter)
62 pr_warning("oprofile: counter #%d on cpu #%d may already be used\n",
63 counter, smp_processor_id());
66 static inline void op_x86_warn_reserved(int counter)
68 pr_warning("oprofile: counter #%d is already reserved\n", counter);
71 extern u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
72 struct op_counter_config *counter_config);
73 extern int op_x86_phys_to_virt(int phys);
74 extern int op_x86_virt_to_phys(int virt);
76 extern struct op_x86_model_spec op_ppro_spec;
77 extern struct op_x86_model_spec op_p4_spec;
78 extern struct op_x86_model_spec op_p4_ht2_spec;
79 extern struct op_x86_model_spec op_amd_spec;
80 extern struct op_x86_model_spec op_arch_perfmon_spec;
82 #endif /* OP_X86_MODEL_H */