coresight-etm-perf.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright(C) 2015 Linaro Limited. All rights reserved.
  4. * Author: Mathieu Poirier <mathieu.poirier@linaro.org>
  5. */
  6. #ifndef _CORESIGHT_ETM_PERF_H
  7. #define _CORESIGHT_ETM_PERF_H
  8. #include <linux/percpu-defs.h>
  9. #include "coresight-priv.h"
  10. struct coresight_device;
  11. /*
  12. * In both ETMv3 and v4 the maximum number of address comparator implentable
  13. * is 8. The actual number is implementation specific and will be checked
  14. * when filters are applied.
  15. */
  16. #define ETM_ADDR_CMP_MAX 8
  17. /**
  18. * struct etm_filter - single instruction range or start/stop configuration.
  19. * @start_addr: The address to start tracing on.
  20. * @stop_addr: The address to stop tracing on.
  21. * @type: Is this a range or start/stop filter.
  22. */
  23. struct etm_filter {
  24. unsigned long start_addr;
  25. unsigned long stop_addr;
  26. enum etm_addr_type type;
  27. };
  28. /**
  29. * struct etm_filters - set of filters for a session
  30. * @etm_filter: All the filters for this session.
  31. * @nr_filters: Number of filters
  32. * @ssstatus: Status of the start/stop logic.
  33. */
  34. struct etm_filters {
  35. struct etm_filter etm_filter[ETM_ADDR_CMP_MAX];
  36. unsigned int nr_filters;
  37. bool ssstatus;
  38. };
  39. /**
  40. * struct etm_event_data - Coresight specifics associated to an event
  41. * @work: Handle to free allocated memory outside IRQ context.
  42. * @mask: Hold the CPU(s) this event was set for.
  43. * @snk_config: The sink configuration.
  44. * @path: An array of path, each slot for one CPU.
  45. */
  46. struct etm_event_data {
  47. struct work_struct work;
  48. cpumask_t mask;
  49. void *snk_config;
  50. struct list_head * __percpu *path;
  51. };
  52. #ifdef CONFIG_CORESIGHT
  53. int etm_perf_symlink(struct coresight_device *csdev, bool link);
  54. static inline void *etm_perf_sink_config(struct perf_output_handle *handle)
  55. {
  56. struct etm_event_data *data = perf_get_aux(handle);
  57. if (data)
  58. return data->snk_config;
  59. return NULL;
  60. }
  61. #else
  62. static inline int etm_perf_symlink(struct coresight_device *csdev, bool link)
  63. { return -EINVAL; }
  64. static inline void *etm_perf_sink_config(struct perf_output_handle *handle)
  65. {
  66. return NULL;
  67. }
  68. #endif /* CONFIG_CORESIGHT */
  69. #endif