* [PATCH] accel/ivpu: Move register poll timeouts to vdev->timeout
@ 2026-09-14 8:26 Karol Wachowski
2026-09-14 8:41 ` sashiko-bot
2026-10-02 16:54 ` Jeff Hugo
0 siblings, 2 replies; 3+ messages in thread
From: Karol Wachowski @ 2026-09-14 8:26 UTC (permalink / raw)
To: dri-devel
Cc: oded.gabbay, jeff.hugo, lizhi.hou, andrzej.kacprowski,
dawid.osuchowski, Tomasz Rusinowicz
From: Tomasz Rusinowicz <tomasz.rusinowicz@intel.com>
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.
Signed-off-by: Tomasz Rusinowicz <tomasz.rusinowicz@intel.com>
---
drivers/accel/ivpu/ivpu_drv.h | 3 +++
drivers/accel/ivpu/ivpu_hw.c | 20 ++++++++++++++++++++
drivers/accel/ivpu/ivpu_hw_ip.c | 6 ++----
drivers/accel/ivpu/ivpu_mmu.c | 12 ++++--------
4 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_drv.h b/drivers/accel/ivpu/ivpu_drv.h
index 8f29f1dc52b9..3b26a64ed04f 100644
--- a/drivers/accel/ivpu/ivpu_drv.h
+++ b/drivers/accel/ivpu/ivpu_drv.h
@@ -186,6 +186,9 @@ struct ivpu_device {
int autosuspend;
int d0i3_entry_msg;
int state_dump_msg;
+ int mmu_reg;
+ int mmu_queue;
+ int pwr_island_status;
} timeout;
};
diff --git a/drivers/accel/ivpu/ivpu_hw.c b/drivers/accel/ivpu/ivpu_hw.c
index 647dc045c231..613bcdbc364c 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;
} else if (ivpu_is_fpga(vdev)) {
+ /* in milliseconds */
vdev->timeout.boot = 50;
vdev->timeout.jsm = 15000;
vdev->timeout.tdr = 30000;
@@ -113,7 +119,12 @@ static void timeouts_init(struct ivpu_device *vdev)
vdev->timeout.autosuspend = -1;
vdev->timeout.d0i3_entry_msg = 500;
vdev->timeout.state_dump_msg = 10000;
+ /* in microseconds */
+ vdev->timeout.mmu_reg = 100 * USEC_PER_MSEC;
+ vdev->timeout.mmu_queue = 1000 * USEC_PER_MSEC;
+ vdev->timeout.pwr_island_status = 5 * USEC_PER_MSEC;
} else if (ivpu_is_simics(vdev)) {
+ /* in milliseconds */
vdev->timeout.boot = 50;
vdev->timeout.jsm = 500;
vdev->timeout.tdr = 10000;
@@ -121,7 +132,12 @@ static void timeouts_init(struct ivpu_device *vdev)
vdev->timeout.autosuspend = 100;
vdev->timeout.d0i3_entry_msg = 100;
vdev->timeout.state_dump_msg = 10;
+ /* in microseconds */
+ vdev->timeout.mmu_reg = 10 * USEC_PER_MSEC;
+ vdev->timeout.mmu_queue = 100 * USEC_PER_MSEC;
+ vdev->timeout.pwr_island_status = 5 * USEC_PER_MSEC;
} else {
+ /* in milliseconds */
vdev->timeout.boot = 1000;
vdev->timeout.jsm = 500;
vdev->timeout.tdr = 2000;
@@ -132,6 +148,10 @@ static void timeouts_init(struct ivpu_device *vdev)
vdev->timeout.autosuspend = 100;
vdev->timeout.d0i3_entry_msg = 5;
vdev->timeout.state_dump_msg = 100;
+ /* in microseconds */
+ vdev->timeout.mmu_reg = 10 * USEC_PER_MSEC;
+ vdev->timeout.mmu_queue = 100 * USEC_PER_MSEC;
+ vdev->timeout.pwr_island_status = 5 * USEC_PER_MSEC;
}
}
diff --git a/drivers/accel/ivpu/ivpu_hw_ip.c b/drivers/accel/ivpu/ivpu_hw_ip.c
index 81f0b1f8f5a6..46661fbf9d05 100644
--- a/drivers/accel/ivpu/ivpu_hw_ip.c
+++ b/drivers/accel/ivpu/ivpu_hw_ip.c
@@ -15,8 +15,6 @@
#include "ivpu_mmu.h"
#include "ivpu_pm.h"
-#define PWR_ISLAND_STATUS_TIMEOUT_US (5 * USEC_PER_MSEC)
-
#define TIM_SAFE_ENABLE 0xf1d0dead
#define TIM_WATCHDOG_RESET_VALUE 0xffffffff
@@ -350,10 +348,10 @@ static int wait_for_pwr_island_status(struct ivpu_device *vdev, u32 exp_val)
if (ivpu_hw_ip_gen(vdev) == IVPU_HW_IP_37XX)
return REGV_POLL_FLD(VPU_37XX_HOST_SS_AON_PWR_ISLAND_STATUS0, MSS_CPU, exp_val,
- PWR_ISLAND_STATUS_TIMEOUT_US);
+ vdev->timeout.pwr_island_status);
else
return REGV_POLL_FLD(VPU_40XX_HOST_SS_AON_PWR_ISLAND_STATUS0, CSS_CPU, exp_val,
- PWR_ISLAND_STATUS_TIMEOUT_US);
+ vdev->timeout.pwr_island_status);
}
static void pwr_island_isolation_drive_37xx(struct ivpu_device *vdev, bool enable)
diff --git a/drivers/accel/ivpu/ivpu_mmu.c b/drivers/accel/ivpu/ivpu_mmu.c
index 41efd8985fa6..1908375ff128 100644
--- a/drivers/accel/ivpu/ivpu_mmu.c
+++ b/drivers/accel/ivpu/ivpu_mmu.c
@@ -220,9 +220,6 @@
#define IVPU_MMU_STE_1_S1DSS GENMASK_ULL(1, 0)
#define IVPU_MMU_STE_1_S1DSS_TERMINATE 0x0
-#define IVPU_MMU_REG_TIMEOUT_US (10 * USEC_PER_MSEC)
-#define IVPU_MMU_QUEUE_TIMEOUT_US (100 * USEC_PER_MSEC)
-
#define IVPU_MMU_GERROR_ERR_MASK ((REG_FLD(IVPU_MMU_REG_GERROR, CMDQ)) | \
(REG_FLD(IVPU_MMU_REG_GERROR, EVTQ_ABT)) | \
(REG_FLD(IVPU_MMU_REG_GERROR, PRIQ_ABT)) | \
@@ -438,14 +435,14 @@ static int ivpu_mmu_reg_write_cr0(struct ivpu_device *vdev, u32 val)
{
REGV_WR32(IVPU_MMU_REG_CR0, val);
- return REGV_POLL_FLD(IVPU_MMU_REG_CR0ACK, VAL, val, IVPU_MMU_REG_TIMEOUT_US);
+ return REGV_POLL_FLD(IVPU_MMU_REG_CR0ACK, VAL, val, vdev->timeout.mmu_reg);
}
static int ivpu_mmu_reg_write_irq_ctrl(struct ivpu_device *vdev, u32 val)
{
REGV_WR32(IVPU_MMU_REG_IRQ_CTRL, val);
- return REGV_POLL_FLD(IVPU_MMU_REG_IRQ_CTRLACK, VAL, val, IVPU_MMU_REG_TIMEOUT_US);
+ return REGV_POLL_FLD(IVPU_MMU_REG_IRQ_CTRLACK, VAL, val, vdev->timeout.mmu_reg);
}
static int ivpu_mmu_irqs_setup(struct ivpu_device *vdev)
@@ -465,8 +462,7 @@ static int ivpu_mmu_cmdq_wait_for_cons(struct ivpu_device *vdev)
struct ivpu_mmu_queue *cmdq = &vdev->mmu->cmdq;
int ret;
- ret = REGV_POLL_FLD(IVPU_MMU_REG_CMDQ_CONS, VAL, cmdq->prod,
- IVPU_MMU_QUEUE_TIMEOUT_US);
+ ret = REGV_POLL_FLD(IVPU_MMU_REG_CMDQ_CONS, VAL, cmdq->prod, vdev->timeout.mmu_queue);
if (ret)
return ret;
@@ -880,7 +876,7 @@ static int ivpu_mmu_evtq_set(struct ivpu_device *vdev, bool enable)
val = REG_CLR_FLD(IVPU_MMU_REG_CR0, EVTQEN, val);
REGV_WR32(IVPU_MMU_REG_CR0, val);
- return REGV_POLL_FLD(IVPU_MMU_REG_CR0ACK, VAL, val, IVPU_MMU_REG_TIMEOUT_US);
+ return REGV_POLL_FLD(IVPU_MMU_REG_CR0ACK, VAL, val, vdev->timeout.mmu_reg);
}
static int ivpu_mmu_evtq_enable(struct ivpu_device *vdev)
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] accel/ivpu: Move register poll timeouts to vdev->timeout
2026-09-14 8:26 [PATCH] accel/ivpu: Move register poll timeouts to vdev->timeout Karol Wachowski
@ 2026-09-14 8:41 ` sashiko-bot
2026-10-02 16:54 ` Jeff Hugo
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-09-14 8:41 UTC (permalink / raw)
To: Karol Wachowski; +Cc: dri-devel
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 <tomasz.rusinowicz@intel.com>
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/20260914082649.891871-1-karol.wachowski@linux.intel.com?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] accel/ivpu: Move register poll timeouts to vdev->timeout
2026-09-14 8:26 [PATCH] accel/ivpu: Move register poll timeouts to vdev->timeout Karol Wachowski
2026-09-14 8:41 ` sashiko-bot
@ 2026-10-02 16:54 ` Jeff Hugo
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Hugo @ 2026-10-02 16:54 UTC (permalink / raw)
To: Karol Wachowski, dri-devel
Cc: oded.gabbay, lizhi.hou, andrzej.kacprowski, dawid.osuchowski,
Tomasz Rusinowicz
On 9/14/2026 2:26 AM, Karol Wachowski wrote:
> From: Tomasz Rusinowicz <tomasz.rusinowicz@intel.com>
>
> 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.
>
> Signed-off-by: Tomasz Rusinowicz <tomasz.rusinowicz@intel.com>
Karol, this is missing your SOB.
-Jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-02 16:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-14 8:26 [PATCH] accel/ivpu: Move register poll timeouts to vdev->timeout Karol Wachowski
2026-09-14 8:41 ` sashiko-bot
2026-10-02 16:54 ` Jeff Hugo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox