op_x86_model.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. * @author Robert Richter <robert.richter@amd.com>
  10. */
  11. #ifndef OP_X86_MODEL_H
  12. #define OP_X86_MODEL_H
  13. #include <asm/types.h>
  14. #include <asm/perf_event.h>
  15. struct op_msr {
  16. unsigned long addr;
  17. u64 saved;
  18. };
  19. struct op_msrs {
  20. struct op_msr *counters;
  21. struct op_msr *controls;
  22. struct op_msr *multiplex;
  23. };
  24. struct pt_regs;
  25. struct oprofile_operations;
  26. /* The model vtable abstracts the differences between
  27. * various x86 CPU models' perfctr support.
  28. */
  29. struct op_x86_model_spec {
  30. unsigned int num_counters;
  31. unsigned int num_controls;
  32. unsigned int num_virt_counters;
  33. u64 reserved;
  34. u16 event_mask;
  35. int (*init)(struct oprofile_operations *ops);
  36. void (*exit)(void);
  37. void (*fill_in_addresses)(struct op_msrs * const msrs);
  38. void (*setup_ctrs)(struct op_x86_model_spec const *model,
  39. struct op_msrs const * const msrs);
  40. int (*check_ctrs)(struct pt_regs * const regs,
  41. struct op_msrs const * const msrs);
  42. void (*start)(struct op_msrs const * const msrs);
  43. void (*stop)(struct op_msrs const * const msrs);
  44. void (*shutdown)(struct op_msrs const * const msrs);
  45. #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
  46. void (*switch_ctrl)(struct op_x86_model_spec const *model,
  47. struct op_msrs const * const msrs);
  48. #endif
  49. };
  50. struct op_counter_config;
  51. extern u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
  52. struct op_counter_config *counter_config);
  53. extern int op_x86_phys_to_virt(int phys);
  54. extern int op_x86_virt_to_phys(int virt);
  55. extern struct op_x86_model_spec op_ppro_spec;
  56. extern struct op_x86_model_spec op_p4_spec;
  57. extern struct op_x86_model_spec op_p4_ht2_spec;
  58. extern struct op_x86_model_spec op_amd_spec;
  59. extern struct op_x86_model_spec op_arch_perfmon_spec;
  60. #endif /* OP_X86_MODEL_H */