coresight-cfg-sample.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright(C) 2020 Linaro Limited. All rights reserved.
  4. * Author: Mike Leach <mike.leach@linaro.org>
  5. */
  6. #include "coresight-config.h"
  7. #include "coresight-syscfg.h"
  8. /* create an alternate autofdo configuration */
  9. /* we will provide 4 sets of preset parameter values */
  10. #define AFDO2_NR_PRESETS 4
  11. /* the total number of parameters in used features - strobing has 2 */
  12. #define AFDO2_NR_PARAM_SUM 2
  13. static const char *afdo2_ref_names[] = {
  14. "strobing",
  15. };
  16. /*
  17. * set of presets leaves strobing window constant while varying period to allow
  18. * experimentation with mark / space ratios for various workloads
  19. */
  20. static u64 afdo2_presets[AFDO2_NR_PRESETS][AFDO2_NR_PARAM_SUM] = {
  21. { 1000, 100 },
  22. { 1000, 1000 },
  23. { 1000, 5000 },
  24. { 1000, 10000 },
  25. };
  26. struct cscfg_config_desc afdo2 = {
  27. .name = "autofdo2",
  28. .description = "Setup ETMs with strobing for autofdo\n"
  29. "Supplied presets allow experimentation with mark-space ratio for various loads\n",
  30. .nr_feat_refs = ARRAY_SIZE(afdo2_ref_names),
  31. .feat_ref_names = afdo2_ref_names,
  32. .nr_presets = AFDO2_NR_PRESETS,
  33. .nr_total_params = AFDO2_NR_PARAM_SUM,
  34. .presets = &afdo2_presets[0][0],
  35. };
  36. static struct cscfg_feature_desc *sample_feats[] = {
  37. NULL
  38. };
  39. static struct cscfg_config_desc *sample_cfgs[] = {
  40. &afdo2,
  41. NULL
  42. };
  43. static struct cscfg_load_owner_info mod_owner = {
  44. .type = CSCFG_OWNER_MODULE,
  45. .owner_handle = THIS_MODULE,
  46. };
  47. /* module init and exit - just load and unload configs */
  48. static int __init cscfg_sample_init(void)
  49. {
  50. return cscfg_load_config_sets(sample_cfgs, sample_feats, &mod_owner);
  51. }
  52. static void __exit cscfg_sample_exit(void)
  53. {
  54. cscfg_unload_config_sets(&mod_owner);
  55. }
  56. module_init(cscfg_sample_init);
  57. module_exit(cscfg_sample_exit);
  58. MODULE_LICENSE("GPL v2");
  59. MODULE_AUTHOR("Mike Leach <mike.leach@linaro.org>");
  60. MODULE_DESCRIPTION("CoreSight Syscfg Example");