Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

accel/ivpu: Wait for CDYN de-assertion during power down sequence

During power down, pending DVFS operations may still be in progress
when the NPU reset is asserted after CDYN=0 is set. Since the READY
bit may already be deasserted at this point, checking only the READY
bit is insufficient to ensure all transactions have completed.

Add an explicit check for CDYN de-assertion after the READY bit check
to guarantee no outstanding transactions remain before proceeding.

Fixes: 550f4dd2cedd ("accel/ivpu: Add support for Nova Lake's NPU")
Reviewed-by: Maciej Falkowski <maciej.falkowski@linux.intel.com>
Reviewed-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>
Link: https://patch.msgid.link/20251030091700.293341-1-karol.wachowski@linux.intel.com

+19
+16
drivers/accel/ivpu/ivpu_hw_btrs.c
··· 321 321 return REGB_POLL_FLD(VPU_HW_BTRS_MTL_PLL_STATUS, LOCK, exp_val, PLL_TIMEOUT_US); 322 322 } 323 323 324 + static int wait_for_cdyn_deassert(struct ivpu_device *vdev) 325 + { 326 + if (ivpu_hw_btrs_gen(vdev) == IVPU_HW_BTRS_MTL) 327 + return 0; 328 + 329 + return REGB_POLL_FLD(VPU_HW_BTRS_LNL_CDYN, CDYN, 0, PLL_TIMEOUT_US); 330 + } 331 + 324 332 int ivpu_hw_btrs_wp_drive(struct ivpu_device *vdev, bool enable) 325 333 { 326 334 struct wp_request wp; ··· 360 352 if (ret) { 361 353 ivpu_err(vdev, "Timed out waiting for NPU ready status\n"); 362 354 return ret; 355 + } 356 + 357 + if (!enable) { 358 + ret = wait_for_cdyn_deassert(vdev); 359 + if (ret) { 360 + ivpu_err(vdev, "Timed out waiting for CDYN deassert\n"); 361 + return ret; 362 + } 363 363 } 364 364 365 365 return 0;
+3
drivers/accel/ivpu/ivpu_hw_btrs_lnl_reg.h
··· 74 74 #define VPU_HW_BTRS_LNL_PLL_FREQ 0x00000148u 75 75 #define VPU_HW_BTRS_LNL_PLL_FREQ_RATIO_MASK GENMASK(15, 0) 76 76 77 + #define VPU_HW_BTRS_LNL_CDYN 0x0000014cu 78 + #define VPU_HW_BTRS_LNL_CDYN_CDYN_MASK GENMASK(15, 0) 79 + 77 80 #define VPU_HW_BTRS_LNL_TILE_FUSE 0x00000150u 78 81 #define VPU_HW_BTRS_LNL_TILE_FUSE_VALID_MASK BIT_MASK(0) 79 82 #define VPU_HW_BTRS_LNL_TILE_FUSE_CONFIG_MASK GENMASK(6, 1)