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.
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.
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:
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.
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.
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.
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.