Linux Versal Sysmon Driver

Table of Contents


Linux Versal Sysmon Driver uses IIO framework for abstraction in Linux. The following section describes the hardware as well as the software design.

Basic HW Architecture:

Sysmon for Versal follows a different architecture than the previous generations. The Sysmon is capable of measuring upto 160 supply and temperature measurement and monitoring across the chip.
Each supply has its dedicated alarm enable and alarm flag bit to allow for voltage monitoring. The S80 chip has 184 measurement points scattered across the chip, but the user can monitor only 160 at
a given time. As far as temperature is concerned, the Sysmon provides the user with current Min and Max values on the chip as well as the historical Min and Max values reached on the chip. Both
temperature and supply voltages have upper and a lower threshold around which the monitoring is done. An event is generated when the thresholds are breached by temperature and voltage. This event
is reflected in the ISR register as well as ALARM_FLAG_REG for supplies. 

SW Architecture:

As mentioned earlier the Sysmon Driver uses Linux IIO framework which was used to abstract the supply voltages and temperatures across the chip as Voltage and Temperature Channels in the framework.
Since there are only 160 supply voltage registers and 184 measurement points, there is no constant mapping of supply voltage registers and the measurement points. User has to select the voltages to monitor
in Vivado. Depending on the selection, a voltage supply gets mapped to one of the supply registers. So, this mapping information is provided to the driver via a device tree. Depending on the number of supplies
enabled in the design, the device tree will contain the information of name of the supply enabled and the supply register it maps to.

Device Tree: 

Example Device Tree looks as follows:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 sysmon@f1270000 {                compatible = "xlnx,versal-sysmon";                reg = <0x00 0xf1270000 0x00 0x4000>;                interrupts = <0x00 0x90 0x04>;                xlnx,numchannels = [08];                status = "okay";                  vccint {                        xlnx,register = [00];                        xlnx,bipolar;                        xlnx,name = "vccint";                };                  vccsoc {                        xlnx,register = [1f];                        xlnx,bipolar;                        xlnx,name = "vccsoc";                };                  vccram {                        xlnx,register = [3f];                        xlnx,bipolar;                        xlnx,name = "vccram";                };                  vccaux {                        xlnx,register = [20];                        xlnx,bipolar;                        xlnx,name = "vccaux";                };                  vccbram {                        xlnx,register = [5f];                        xlnx,name = "vccbram";                };                  gtavaux {                        xlnx,register = [60];                        xlnx,name = "gt_avaux";                };                  gtvccaux {                        xlnx,register = [40];                        xlnx,bipolar;                        xlnx,name = "gt_vccaux";                };                vccintir {                        xlnx,register = [7f];                        xlnx,bipolar;                        xlnx,name = "vccint_ir";                };        };

Using the above device tree the sysmon driver will allocate and create 8 Voltage channels and 4 temperature channels in the IIO Framework. Each channel will have two ways of reading values RAW ADC value and the Processed ADC value. 

Current Supported Features:

Temperature Channels:

  • MIN and MAX values on the chip. 

  • Historical MIN and MAX values on the chip.

  • Temperature and OT events configuration:
    Upper and Lower Threshold Configuration
    Event configuration based on Hysteresis or Window mode

  • RAW ADC and Processed values in Deg Celsius.

Supply Channels:

  • A separate supply channel will be created for each channel enabled in the design.

  • The channel will allow for event configuration:
    Upper and Lower Thresholds for Supplies
    Event configuration based on levels.

  • RAW ADC and Processed values in Volts.

/sys/bus/iio/iio:deviceX/, this represents a hardware sensor and groups together the data channels of the same chip.

Where to Find the sysfs interface?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 root@xilinx-vck190-2020_2_SAM_EA3:~# cd /sys/bus/iio/devices/iio\:device0 root@xilinx-vck190-2020_2_SAM_EA3:/sys/bus/iio/devices/iio:device0# ls dev                                    in_voltage22_gty_avccaux_105_input     in_voltage3_gty_avcc_104_input         in_voltage57_vcc_batt_input events                                 in_voltage22_gty_avccaux_105_raw       in_voltage3_gty_avcc_104_raw           in_voltage57_vcc_batt_raw in_temp160_max_input                   in_voltage23_gty_avtt_204_input        in_voltage40_vcco_501_input            in_voltage58_vcc_pmc_input in_temp160_max_raw                     in_voltage23_gty_avtt_204_raw          in_voltage40_vcco_501_raw              in_voltage58_vcc_pmc_raw in_temp161_min_input                   in_voltage24_gty_avtt_205_input        in_voltage41_vcco_502_input            in_voltage59_vcc_psfp_input in_temp161_min_raw                     in_voltage24_gty_avtt_205_raw          in_voltage41_vcco_502_raw              in_voltage59_vcc_psfp_raw in_temp162_max_max_input               in_voltage25_gty_avtt_206_input        in_voltage42_vcco_503_input            in_voltage5_gty_avcc_106_input in_temp162_max_max_raw                 in_voltage25_gty_avtt_206_raw          in_voltage42_vcco_503_raw              in_voltage5_gty_avcc_106_raw in_temp163_min_min_input               in_voltage26_lpd_mio_vccaux_502_input  in_voltage43_vcco_700_input            in_voltage60_vcc_pslp_input in_temp163_min_min_raw                 in_voltage26_lpd_mio_vccaux_502_raw    in_voltage43_vcco_700_raw              in_voltage60_vcc_pslp_raw in_voltage0_gty_avccaux_103_input      in_voltage27_pmc_dio_vccaux_503_input  in_voltage44_gty_avccaux_200_input     in_voltage61_vcc_ram_input in_voltage0_gty_avccaux_103_raw        in_voltage27_pmc_dio_vccaux_503_raw    in_voltage44_gty_avccaux_200_raw       in_voltage61_vcc_ram_raw in_voltage10_gty_avcc_204_input        in_voltage28_pmc_mio_vccaux_500_input  in_voltage45_vcco_701_input            in_voltage62_vcc_soc_input in_voltage10_gty_avcc_204_raw          in_voltage28_pmc_mio_vccaux_500_raw    in_voltage45_vcco_701_raw              in_voltage62_vcc_soc_raw in_voltage11_gty_avccaux_104_input     in_voltage29_pmc_mio_vccaux_501_input  in_voltage46_vcco_702_input            in_voltage63_vp_vn_input in_voltage11_gty_avccaux_104_raw       in_voltage29_pmc_mio_vccaux_501_raw    in_voltage46_vcco_702_raw              in_voltage63_vp_vn_raw in_voltage12_gty_avcc_205_input        in_voltage2_gty_avcc_103_input         in_voltage47_vcco_703_input            in_voltage64_gty_avccaux_202_input in_voltage12_gty_avcc_205_raw          in_voltage2_gty_avcc_103_raw           in_voltage47_vcco_703_raw              in_voltage64_gty_avccaux_202_raw in_voltage13_gty_avcc_206_input        in_voltage30_vccaux_input              in_voltage48_vcco_704_input            in_voltage65_gty_avccaux_203_input in_voltage13_gty_avcc_206_raw          in_voltage30_vccaux_raw                in_voltage48_vcco_704_raw              in_voltage65_gty_avccaux_203_raw in_voltage14_gty_avtt_103_input        in_voltage31_vccaux_io_306_input       in_voltage49_vcco_705_input            in_voltage66_gty_avccaux_204_input in_voltage14_gty_avtt_103_raw          in_voltage31_vccaux_io_306_raw         in_voltage49_vcco_705_raw              in_voltage66_gty_avccaux_204_raw in_voltage15_gty_avtt_104_input        in_voltage32_vccaux_io_406_input       in_voltage4_gty_avcc_105_input         in_voltage67_gty_avccaux_205_input in_voltage15_gty_avtt_104_raw          in_voltage32_vccaux_io_406_raw         in_voltage4_gty_avcc_105_raw           in_voltage67_gty_avccaux_205_raw in_voltage16_gty_avtt_105_input        in_voltage33_gty_avccaux_106_input     in_voltage50_vcco_706_input            in_voltage6_gty_avcc_200_input in_voltage16_gty_avtt_105_raw          in_voltage33_gty_avccaux_106_raw       in_voltage50_vcco_706_raw              in_voltage6_gty_avcc_200_raw in_voltage17_gty_avtt_106_input        in_voltage34_vccaux_pmc_input          in_voltage51_vcco_707_input            in_voltage7_gty_avcc_201_input in_voltage17_gty_avtt_106_raw          in_voltage34_vccaux_pmc_raw            in_voltage51_vcco_707_raw              in_voltage7_gty_avcc_201_raw in_voltage18_gty_avtt_200_input        in_voltage35_vccaux_smon_input         in_voltage52_vcco_708_input            in_voltage8_gty_avcc_202_input in_voltage18_gty_avtt_200_raw          in_voltage35_vccaux_smon_raw           in_voltage52_vcco_708_raw              in_voltage8_gty_avcc_202_raw in_voltage19_gty_avtt_201_input        in_voltage36_vccint_input              in_voltage53_vcco_709_input            in_voltage9_gty_avcc_203_input in_voltage19_gty_avtt_201_raw          in_voltage36_vccint_raw                in_voltage53_vcco_709_raw              in_voltage9_gty_avcc_203_raw in_voltage1_gty_avccaux_206_input      in_voltage37_vcco_306_input            in_voltage54_vcco_710_input            name in_voltage1_gty_avccaux_206_raw        in_voltage37_vcco_306_raw              in_voltage54_vcco_710_raw              of_node in_voltage20_gty_avtt_202_input        in_voltage38_vcco_406_input            in_voltage55_gty_avccaux_201_input     power in_voltage20_gty_avtt_202_raw          in_voltage38_vcco_406_raw              in_voltage55_gty_avccaux_201_raw       subsystem in_voltage21_gty_avtt_203_input        in_voltage39_vcco_500_input            in_voltage56_vcco_711_input            uevent in_voltage21_gty_avtt_203_raw          in_voltage39_vcco_500_raw              in_voltage56_vcco_711_raw

Name of the device:

1 2 root@xilinx-vck190-2020_2_SAM_EA3:/sys/bus/iio/devices/iio:device0# cat name xlnx,versal-sysmon

Reading a voltage value:

_input value is a processed value in volts.

_raw will provide value in ADC RAW units

1 2 root@xilinx-vck190-2020_2_SAM_EA3:/sys/bus/iio/devices/iio:device0# cat in_voltage13_gty_avcc_206_input 0.877166748

Reading Temperature Value:

_input value is a processed value in Deg Celsius.

_raw will provide value in ADC RAW units

1 2 3 4 root@xilinx-vck190-2020_2_SAM_EA3:/sys/bus/iio/devices/iio:device0# cat in_temp160_max_input 35.33678 root@xilinx-vck190-2020_2_SAM_EA3:/sys/bus/iio/devices/iio:device0# cat in_temp160_min_input 34.32156

Testing Events:

Please refer the following in the linux kernel on how to test the events:


Configuring Events and Testing Events:

For sysmon, there is no way of getting rid of the Interrupt status as long as the voltage or temperature violates the threshold conditions.

So, when an event occurs, the event is notified and the event gets disabled. Once the user consumes and processes the event, the user needs to
re-enable the event once the values are within the permissible range.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 root@xilinx-vck190-2020_2_SAM_EA3:/sys/bus/iio/devices/iio:device0# cat name xlnx,versal-sysmon root@xilinx-vck190-2020_2_SAM_EA3:/sys/bus/iio/devices/iio:device0# ~/iio_event_monitor "xlnx,versal-sysmon" & [1] 621 Found IIO device with name xlnx,versal-sysmon with device number 0 root@xilinx-vck190-2020_2_SAM_EA3:/sys/bus/iio/devices/iio:device0# cat in_voltage13_gty_avcc_206_input 0.877166748 root@xilinx-vck190-2020_2_SAM_EA3:/sys/bus/iio/devices/iio:device0# cat events/in_voltage13_gty_avcc_206_thresh_either_en 0 root@xilinx-vck190-2020_2_SAM_EA3:/sys/bus/iio/devices/iio:device0# cat events/in_voltage13_gty_avcc_206_thresh_rising_value 1.999969482 root@xilinx-vck190-2020_2_SAM_EA3:/sys/bus/iio/devices/iio:device0# cat events/in_voltage13_gty_avcc_206_thresh_falling_value 0.000000000 root@xilinx-vck190-2020_2_SAM_EA3:/sys/bus/iio/devices/iio:device0# echo 1.23 >voltage13_gty_avcc_206_thresh_falling_value root@xilinx-vck190-2020_2_SAM_EA3:/sys/bus/iio/devices/iio:device0# echo 1 > events/in_voltage13_gty_avcc_206_thresh_either_en Event: time: 1599838091670617650, type: voltage, channel: 13, evtype: thresh, direction: either root@xilinx-vck190-2020_2_SAM_EA3:/sys/bus/iio/devices/iio:device0# cat events/in_voltage13_gty_avcc_206_thresh_either_en 0 root@xilinx-vck190-2020_2_SAM_EA3:/sys/bus/iio/devices/iio:device0# cat events/in_voltage13_gty_avcc_206_thresh_rising_value 1.999969482 root@xilinx-vck190-2020_2_SAM_EA3:/sys/bus/iio/devices/iio:device0# cat events/in_voltage13_gty_avcc_206_thresh_falling_value 1.229980468

If the driver is correctly registered, each temperature and voltage channels appear in the sysfs interface as a file handle.
Currently the driver supports, Raw and Processed values for all the enabled channels. Temperature channels are enabled in the HW by default.

Change log


Related Links