Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] Assigning -1 to microsecond timeouts in 
IVPU_TEST_MODE_DISABLE_TIMEOUTS creates a finite ~71-minute timeout rather than 
an infinite wait.
--

commit 73e55519ec65b6a56b9989c4bbb3ea1e656f8c4b
Author: Tomasz Rusinowicz <[email protected]>

accel/ivpu: Move register poll timeouts to vdev->timeout
    
Use the vdev->timeout structure for register poll timeouts. This allows
adjusting those timeouts depending on the platform type.
For FPGA set MMU timeouts to 10x.

Link: 
https://lore.kernel.org/dri-devel/[email protected]/T/#u

[ ... ]

> 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]
Will this assignment result in a finite 71-minute timeout instead of an
infinite wait?

These timeout fields are passed to REGV_POLL_FLD() later on. For example,
in ivpu_mmu_reg_write_cr0():

    return REGV_POLL_FLD(IVPU_MMU_REG_CR0ACK, VAL, val, vdev->timeout.mmu_reg);

REGV_POLL_FLD() passes this value as a u32 timeout_us parameter down to
read_poll_timeout(). When -1 is cast to u32, it becomes 4294967295.

Unlike wait_event_timeout(), read_poll_timeout() explicitly requires 0 to
wait indefinitely. Passing 4294967295 to read_poll_timeout() means it will
loop for ~71.58 minutes before returning -ETIMEDOUT.

Could we assign 0 to these microsecond timeouts instead when
IVPU_TEST_MODE_DISABLE_TIMEOUTS is active?

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

Reply via email to