Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] Setting microsecond poll timeouts to -1 to disable them results in a 
finite 71.5-minute timeout instead of an infinite wait, violating the 
read_poll_timeout API.
--

commit 6c5311f9650a7506bd940962ab4f3fafb765f71e
Author: Tomasz Rusinowicz <[email protected]>

accel/ivpu: Move register poll timeouts to vdev->timeout

This patch moves the register poll timeouts into the vdev->timeout
structure. This allows the driver to adjust these timeouts based on
platform type, such as increasing MMU timeouts by 10x on FPGA.

[ ... ]

> diff --git a/drivers/accel/ivpu/ivpu_hw.c b/drivers/accel/ivpu/ivpu_hw.c
> index 647dc045c231a..613bcdbc364cc 100644
> --- a/drivers/accel/ivpu/ivpu_hw.c
> +++ b/drivers/accel/ivpu/ivpu_hw.c
> @@ -99,13 +99,19 @@ static void wa_init(struct ivpu_device *vdev)
>  static void timeouts_init(struct ivpu_device *vdev)
>  {
>       if (ivpu_test_mode & IVPU_TEST_MODE_DISABLE_TIMEOUTS) {
> +             /* in milliseconds */
>               vdev->timeout.boot = -1;
>               vdev->timeout.jsm = -1;
>               vdev->timeout.tdr = -1;
>               vdev->timeout.inference = -1;
>               vdev->timeout.autosuspend = -1;
>               vdev->timeout.d0i3_entry_msg = -1;
> +             /* in microseconds */
> +             vdev->timeout.mmu_reg = -1;
> +             vdev->timeout.mmu_queue = -1;
> +             vdev->timeout.pwr_island_status = -1;

[Severity: Medium]
When initializing the microsecond timeouts in timeouts_init(), is it intended
to set these fields to -1?

The read_poll_timeout() macro expects a timeout_us value of 0 to indicate
that it should wait indefinitely. Because the timeout_us argument is typically
handled as an unsigned 32-bit integer, passing -1 results in a value of
0xFFFFFFFF.

Instead of completely disabling the timeout as the
IVPU_TEST_MODE_DISABLE_TIMEOUTS flag implies, wouldn't this result in
read_poll_timeout() calculating a finite deadline of roughly 4294 seconds
(71.5 minutes)?

Should these microsecond timeouts be set to 0 instead of -1 to properly
instruct read_poll_timeout() to wait forever?

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to