blob: 505489873b9d31f95a356cc3f478c7290a79a082 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/**
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 Richter3370d352009-05-25 15:10:32 +02009 * @author Robert Richter <robert.richter@amd.com>
Linus Torvalds1da177e2005-04-16 15:20:36 -070010 */
11
12#ifndef OP_X86_MODEL_H
13#define OP_X86_MODEL_H
14
Robert Richter3370d352009-05-25 15:10:32 +020015#include <asm/types.h>
Robert Richter1241eb82009-06-12 17:58:48 +020016#include <asm/perf_counter.h>
Robert Richterec064c02009-05-25 15:05:50 +020017
Linus Torvalds1da177e2005-04-16 15:20:36 -070018struct op_msr {
Robert Richter95e74e62009-06-03 19:09:27 +020019 unsigned long addr;
20 u64 saved;
Linus Torvalds1da177e2005-04-16 15:20:36 -070021};
22
23struct op_msrs {
Robert Richter25ad29132008-09-05 17:12:36 +020024 struct op_msr *counters;
25 struct op_msr *controls;
Linus Torvalds1da177e2005-04-16 15:20:36 -070026};
27
28struct pt_regs;
29
Robert Richter3370d352009-05-25 15:10:32 +020030struct oprofile_operations;
31
Linus Torvalds1da177e2005-04-16 15:20:36 -070032/* The model vtable abstracts the differences between
Simon Arlott27b46d72007-10-20 01:13:56 +020033 * various x86 CPU models' perfctr support.
Linus Torvalds1da177e2005-04-16 15:20:36 -070034 */
35struct op_x86_model_spec {
Robert Richter06552cc2009-05-28 02:12:36 +020036 unsigned int num_counters;
37 unsigned int num_controls;
Robert Richter3370d352009-05-25 15:10:32 +020038 u64 reserved;
39 u16 event_mask;
Robert Richter06552cc2009-05-28 02:12:36 +020040 int (*init)(struct oprofile_operations *ops);
41 void (*exit)(void);
42 void (*fill_in_addresses)(struct op_msrs * const msrs);
Robert Richteref8828d2009-05-25 19:31:44 +020043 void (*setup_ctrs)(struct op_x86_model_spec const *model,
44 struct op_msrs const * const msrs);
Robert Richter06552cc2009-05-28 02:12:36 +020045 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 Torvalds1da177e2005-04-16 15:20:36 -070050};
51
Robert Richter3370d352009-05-25 15:10:32 +020052struct op_counter_config;
53
54extern u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
55 struct op_counter_config *counter_config);
56
Robert Richter849620f2009-05-14 17:10:52 +020057extern struct op_x86_model_spec const op_ppro_spec;
Linus Torvalds1da177e2005-04-16 15:20:36 -070058extern struct op_x86_model_spec const op_p4_spec;
59extern struct op_x86_model_spec const op_p4_ht2_spec;
Robert Richter6657fe42008-07-22 21:08:50 +020060extern struct op_x86_model_spec const op_amd_spec;
Andi Kleenb9917022008-08-18 14:50:31 +020061extern struct op_x86_model_spec op_arch_perfmon_spec;
62
Linus Torvalds1da177e2005-04-16 15:20:36 -070063#endif /* OP_X86_MODEL_H */