Axi Performance monitor Linux Driver for Zynq and Zynq Ultrascale+ MPSoC

Introduction
This page describes the APM driver which is available in mainline and Xilinx Linux distribution as
drivers/uio/uio_xilinx_apm.c

HW IP features
  • Connects as a 32-bit slave on AXI4-Lite interface
  • Configurable number of (AXI4/AXI3/ AXI4-Stream/AXI4-Lite) monitor slots (up to eight)
  • Flexible support for monitor slots with any data width, ID width and frequency
  • Free running Global Clock Counter
  • Supports AXI and external events logging
  • Supports AXI and external events counting
  • Supports external event triggering and cross probing between event counting and event logging

Features supported in driver

  • Connects as a 32-bit slave on AXI4-Lite interface
  • Configurable number of (AXI4/AXI3/ AXI4-Stream/AXI4-Lite) monitor slots (up to eight)
  • Flexible support for monitor slots with any data width, ID width and frequency
  • Free running Global Clock Counter
  • Supports AXI and external events logging
  • Supports AXI and external events counting
  • Supports external event triggering and cross probing between event counting and event logging

Missing Features and known Issues/Limitations in Driver
  • None

Kernel Configuration

The following config options should be enabled in order to build the apm driver:
config UIO_XILINX_APM
    tristate "Xilinx AXI Performance Monitor driver"
    depends on MICROBLAZE || ARCH_ZYNQ || ARCH_ZYNQMP
    help
      This driver is developed for AXI Performance Monitor IP, designed to
      monitor AXI4 traffic for performance analysis of AXI bus in the
      system. Driver maps HW registers and parameters to userspace.
 
      To compile this driver as a module, choose M here; the module
      will be called uio_xilinx_apm.

Devicetree

AXI PL APM Example:
apm_pl: apm@800A0000 {
    xlnx,enable-profile = <0>;
    xlnx,enable-trace = <0>;
    xlnx,num-monitor-slots = <4>;
    xlnx,enable-event-count = <1>;
    xlnx,enable-event-log = <1>;
    xlnx,have-sampled-metric-cnt = <1>;
    xlnx,num-of-counters = <8>;
    xlnx,metric-count-width = <32>;
    xlnx,metrics-sample-count-width = <32>;
    xlnx,global-count-width = <32>;
    xlnx,metric-count-scale = <1>;
    xlnx,id-filter-32bit;
    status = "okay";
    compatible = "xlnx,axi-perf-monitor";
    interrupt-parent = <&gic>;                /* Check for Interrupt Controller Node
    clocks = <&clkc 71>;                      /* Check for the CLK */
    interrupts = <0x0 93 0x4>;                /* Check for the interrupt number */
    reg = <0x0 0x800A0000 0x0 0x10000>;
};


There are 4 APMs available on the Zynq Ultrascale PS:
apm.png

PS APM DDR Example:
apm: apm@FD0B0000 {
    xlnx,enable-profile = <0>;
    xlnx,enable-trace = <0>;
    xlnx,num-monitor-slots = <4>;
    xlnx,enable-event-count = <1>;
    xlnx,enable-event-log = <1>;
    xlnx,have-sampled-metric-cnt = <1>;
    xlnx,num-of-counters = <8>;
    xlnx,metric-count-width = <32>;
    xlnx,metrics-sample-count-width = <32>;
    xlnx,global-count-width = <32>;
    xlnx,metric-count-scale = <1>;
    xlnx,id-filter-32bit;
    status = "okay";
    compatible = "xlnx,axi-perf-monitor";
    interrupt-parent = <&gic>;                /* Check for Interrupt Controller Node
    clocks = <&clkc 28>;                      /* Check for the CLK */
    interrupts = <0x0 123 0x4>;                /* Check for the interrupt number */
    reg = <0x0 0xFD0B0000 0x0 0x10000>;
};

Test Procedure

Run the apm app.
The app can be found at
https://github.com/Xilinx/linux-xlnx/tree/master/samples/xilinx_apm
./main -d /dev/uio0
AXI PMON is in Advanced Mode
Required metrics: 0

Mainline Status

The driver is not mainlined.

Change Log

2016.3
Summary:
None

2017.1
Summary:
None

2017.2
Summary:
None

2017.3
Summary:
  • Add runtime support
  • Warning fixes.
Commits:
cbc0b6f : uio: apm: Add runtime support
cbc0b: uio : uio_xilinx_apm: Fix warnings in the driver
acbf6de: uio: uio_xilinx_apm: Fix Kernel doc warnings

2017.4
Summary:
None

Related Links