Path: blob/master/arch/x86/oprofile/op_x86_model.h
10817 views
/**1* @file op_x86_model.h2* interface to x86 model-specific MSR operations3*4* @remark Copyright 2002 OProfile authors5* @remark Read the file COPYING6*7* @author Graydon Hoare8* @author Robert Richter <[email protected]>9*/1011#ifndef OP_X86_MODEL_H12#define OP_X86_MODEL_H1314#include <asm/types.h>15#include <asm/perf_event.h>1617struct op_msr {18unsigned long addr;19u64 saved;20};2122struct op_msrs {23struct op_msr *counters;24struct op_msr *controls;25struct op_msr *multiplex;26};2728struct pt_regs;2930struct oprofile_operations;3132/* The model vtable abstracts the differences between33* various x86 CPU models' perfctr support.34*/35struct op_x86_model_spec {36unsigned int num_counters;37unsigned int num_controls;38unsigned int num_virt_counters;39u64 reserved;40u16 event_mask;41int (*init)(struct oprofile_operations *ops);42int (*fill_in_addresses)(struct op_msrs * const msrs);43void (*setup_ctrs)(struct op_x86_model_spec const *model,44struct op_msrs const * const msrs);45void (*cpu_down)(void);46int (*check_ctrs)(struct pt_regs * const regs,47struct op_msrs const * const msrs);48void (*start)(struct op_msrs const * const msrs);49void (*stop)(struct op_msrs const * const msrs);50void (*shutdown)(struct op_msrs const * const msrs);51#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX52void (*switch_ctrl)(struct op_x86_model_spec const *model,53struct op_msrs const * const msrs);54#endif55};5657struct op_counter_config;5859static inline void op_x86_warn_in_use(int counter)60{61/*62* The warning indicates an already running counter. If63* oprofile doesn't collect data, then try using a different64* performance counter on your platform to monitor the desired65* event. Delete counter #%d from the desired event by editing66* the /usr/share/oprofile/%s/<cpu>/events file. If the event67* cannot be monitored by any other counter, contact your68* hardware or BIOS vendor.69*/70pr_warning("oprofile: counter #%d on cpu #%d may already be used\n",71counter, smp_processor_id());72}7374static inline void op_x86_warn_reserved(int counter)75{76pr_warning("oprofile: counter #%d is already reserved\n", counter);77}7879extern u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,80struct op_counter_config *counter_config);81extern int op_x86_phys_to_virt(int phys);82extern int op_x86_virt_to_phys(int virt);8384extern struct op_x86_model_spec op_ppro_spec;85extern struct op_x86_model_spec op_p4_spec;86extern struct op_x86_model_spec op_p4_ht2_spec;87extern struct op_x86_model_spec op_amd_spec;88extern struct op_x86_model_spec op_arch_perfmon_spec;8990#endif /* OP_X86_MODEL_H */919293