On 6/15/24 09:21, Guenter Roeck wrote:
On 6/15/24 08:51, L.Q wrote:
Step 1:
Call imx2_wdt_set_timeout with a timeout value greater than 128
This illegal value will be stored in wdog->timeout
This is not an illegal value because the driver sets max_hw_heartbeat_ms
which lets the watchdog core handle timeout values exceeding the maximum
timeout supported by the chip.
From Documentation/watchdog/watchdog-kernel-api.rst:
* set_timeout: this routine checks and changes the timeout of the watchdog
timer device. It returns 0 on success, -EINVAL for "parameter out of range"
and -EIO for "could not write value to the watchdog". On success this
routine should set the timeout value of the watchdog_device to the
achieved timeout value (which may be different from the requested one
because the watchdog does not necessarily have a 1 second resolution).
Drivers implementing max_hw_heartbeat_ms set the hardware watchdog heartbeat
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
to the minimum of timeout and max_hw_heartbeat_ms. Those drivers set the
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
timeout value of the watchdog_device either to the requested timeout value
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(if it is larger than max_hw_heartbeat_ms), or to the achieved timeout value.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If any of this is difficult to understand, please feel free to suggest
a better wording.
Thanks,
Guenter