imx-ddr.rst 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. =====================================================
  2. Freescale i.MX8 DDR Performance Monitoring Unit (PMU)
  3. =====================================================
  4. There are no performance counters inside the DRAM controller, so performance
  5. signals are brought out to the edge of the controller where a set of 4 x 32 bit
  6. counters is implemented. This is controlled by the CSV modes programmed in counter
  7. control register which causes a large number of PERF signals to be generated.
  8. Selection of the value for each counter is done via the config registers. There
  9. is one register for each counter. Counter 0 is special in that it always counts
  10. “time” and when expired causes a lock on itself and the other counters and an
  11. interrupt is raised. If any other counter overflows, it continues counting, and
  12. no interrupt is raised.
  13. The "format" directory describes format of the config (event ID) and config1/2
  14. (AXI filter setting) fields of the perf_event_attr structure, see /sys/bus/event_source/
  15. devices/imx8_ddr0/format/. The "events" directory describes the events types
  16. hardware supported that can be used with perf tool, see /sys/bus/event_source/
  17. devices/imx8_ddr0/events/. The "caps" directory describes filter features implemented
  18. in DDR PMU, see /sys/bus/events_source/devices/imx8_ddr0/caps/.
  19. .. code-block:: bash
  20. perf stat -a -e imx8_ddr0/cycles/ cmd
  21. perf stat -a -e imx8_ddr0/read/,imx8_ddr0/write/ cmd
  22. AXI filtering is only used by CSV modes 0x41 (axid-read) and 0x42 (axid-write)
  23. to count reading or writing matches filter setting. Filter setting is various
  24. from different DRAM controller implementations, which is distinguished by quirks
  25. in the driver. You also can dump info from userspace, "caps" directory show the
  26. type of AXI filter (filter, enhanced_filter and super_filter). Value 0 for
  27. un-supported, and value 1 for supported.
  28. * With DDR_CAP_AXI_ID_FILTER quirk(filter: 1, enhanced_filter: 0, super_filter: 0).
  29. Filter is defined with two configuration parts:
  30. --AXI_ID defines AxID matching value.
  31. --AXI_MASKING defines which bits of AxID are meaningful for the matching.
  32. - 0: corresponding bit is masked.
  33. - 1: corresponding bit is not masked, i.e. used to do the matching.
  34. AXI_ID and AXI_MASKING are mapped on DPCR1 register in performance counter.
  35. When non-masked bits are matching corresponding AXI_ID bits then counter is
  36. incremented. Perf counter is incremented if::
  37. AxID && AXI_MASKING == AXI_ID && AXI_MASKING
  38. This filter doesn't support filter different AXI ID for axid-read and axid-write
  39. event at the same time as this filter is shared between counters.
  40. .. code-block:: bash
  41. perf stat -a -e imx8_ddr0/axid-read,axi_mask=0xMMMM,axi_id=0xDDDD/ cmd
  42. perf stat -a -e imx8_ddr0/axid-write,axi_mask=0xMMMM,axi_id=0xDDDD/ cmd
  43. .. note::
  44. axi_mask is inverted in userspace(i.e. set bits are bits to mask), and
  45. it will be reverted in driver automatically. so that the user can just specify
  46. axi_id to monitor a specific id, rather than having to specify axi_mask.
  47. .. code-block:: bash
  48. perf stat -a -e imx8_ddr0/axid-read,axi_id=0x12/ cmd, which will monitor ARID=0x12
  49. * With DDR_CAP_AXI_ID_FILTER_ENHANCED quirk(filter: 1, enhanced_filter: 1, super_filter: 0).
  50. This is an extension to the DDR_CAP_AXI_ID_FILTER quirk which permits
  51. counting the number of bytes (as opposed to the number of bursts) from DDR
  52. read and write transactions concurrently with another set of data counters.
  53. * With DDR_CAP_AXI_ID_PORT_CHANNEL_FILTER quirk(filter: 0, enhanced_filter: 0, super_filter: 1).
  54. There is a limitation in previous AXI filter, it cannot filter different IDs
  55. at the same time as the filter is shared between counters. This quirk is the
  56. extension of AXI ID filter. One improvement is that counter 1-3 has their own
  57. filter, means that it supports concurrently filter various IDs. Another
  58. improvement is that counter 1-3 supports AXI PORT and CHANNEL selection. Support
  59. selecting address channel or data channel.
  60. Filter is defined with 2 configuration registers per counter 1-3.
  61. --Counter N MASK COMP register - including AXI_ID and AXI_MASKING.
  62. --Counter N MUX CNTL register - including AXI CHANNEL and AXI PORT.
  63. - 0: address channel
  64. - 1: data channel
  65. PMU in DDR subsystem, only one single port0 exists, so axi_port is reserved
  66. which should be 0.
  67. .. code-block:: bash
  68. perf stat -a -e imx8_ddr0/axid-read,axi_mask=0xMMMM,axi_id=0xDDDD,axi_channel=0xH/ cmd
  69. perf stat -a -e imx8_ddr0/axid-write,axi_mask=0xMMMM,axi_id=0xDDDD,axi_channel=0xH/ cmd
  70. .. note::
  71. axi_channel is inverted in userspace, and it will be reverted in driver
  72. automatically. So that users do not need specify axi_channel if want to
  73. monitor data channel from DDR transactions, since data channel is more
  74. meaningful.