Skip to content

Commit d38376b

Browse files
alessiob-imgMTCoster
authored andcommitted
drm/imagination: Fix kernel crash when hard resetting the GPU
The GPU hard reset sequence calls pm_runtime_force_suspend() and pm_runtime_force_resume(), which according to their documentation should only be used during system-wide PM transitions to sleep states. The main issue though is that depending on some internal runtime PM state as seen by pm_runtime_force_suspend() (whether the usage count is <= 1), pm_runtime_force_resume() might not resume the device unless needed. If that happens, the runtime PM resume callback pvr_power_device_resume() is not called, the GPU clocks are not re-enabled, and the kernel crashes on the next attempt to access GPU registers as part of the power-on sequence. Replace calls to pm_runtime_force_suspend() and pm_runtime_force_resume() with direct calls to the driver's runtime PM callbacks, pvr_power_device_suspend() and pvr_power_device_resume(), to ensure clocks are re-enabled and avoid the kernel crash. Fixes: cc1aeed ("drm/imagination: Implement firmware infrastructure and META FW support") Signed-off-by: Alessio Belle <[email protected]> Reviewed-by: Matt Coster <[email protected]> Link: https://lore.kernel.org/r/20250624-fix-kernel-crash-gpu-hard-reset-v1-1-6d24810d72a6@imgtec.com Cc: [email protected] Signed-off-by: Matt Coster <[email protected]>
1 parent 44306a6 commit d38376b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/imagination/pvr_power.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,13 +386,13 @@ pvr_power_reset(struct pvr_device *pvr_dev, bool hard_reset)
386386
if (!err) {
387387
if (hard_reset) {
388388
pvr_dev->fw_dev.booted = false;
389-
WARN_ON(pm_runtime_force_suspend(from_pvr_device(pvr_dev)->dev));
389+
WARN_ON(pvr_power_device_suspend(from_pvr_device(pvr_dev)->dev));
390390

391391
err = pvr_fw_hard_reset(pvr_dev);
392392
if (err)
393393
goto err_device_lost;
394394

395-
err = pm_runtime_force_resume(from_pvr_device(pvr_dev)->dev);
395+
err = pvr_power_device_resume(from_pvr_device(pvr_dev)->dev);
396396
pvr_dev->fw_dev.booted = true;
397397
if (err)
398398
goto err_device_lost;

0 commit comments

Comments
 (0)