[PATCH 2/2] drm/imagination: Don't wait for a running META to idle on a hard reset
From: Ryan Brue
Date: Wed Nov 25 2026 - 18:26:52 EST
A hard reset skips the idle and power-off requests, because the firmware
is presumed hung, and then calls pvr_fw_stop(). On a META firmware
processor that is still running, the Garten wrapper never reports idle,
so pvr_fw_stop() times out and every hard reset ends with the device
lost, even with an idle GPU. On a GX6250 (MT8173) every other idle poll
in pvr_fw_stop() passes.
Skip the Garten idle wait on a hard reset, as is already done when a
debugger has halted META, and let the soft reset that follows stop it.
The decision is META's must_wait_fw_idle() hook, so pass it hard_reset.
The other idle polls, and other firmware processors, are unchanged.
Fixes: cc1aeedb98ad ("drm/imagination: Implement firmware infrastructure and META FW support")
Signed-off-by: Ryan Brue <ryanbrue.dev@xxxxxxxxx>
---
drivers/gpu/drm/imagination/pvr_fw.c | 2 +-
drivers/gpu/drm/imagination/pvr_fw.h | 3 ++-
drivers/gpu/drm/imagination/pvr_fw_meta.c | 6 ++++--
drivers/gpu/drm/imagination/pvr_fw_startstop.c | 10 ++++++----
drivers/gpu/drm/imagination/pvr_fw_startstop.h | 4 +++-
drivers/gpu/drm/imagination/pvr_power.c | 4 ++--
6 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/imagination/pvr_fw.c b/drivers/gpu/drm/imagination/pvr_fw.c
index d620141b5df0..d75fa3e4c575 100644
--- a/drivers/gpu/drm/imagination/pvr_fw.c
+++ b/drivers/gpu/drm/imagination/pvr_fw.c
@@ -976,7 +976,7 @@ pvr_fw_init(struct pvr_device *pvr_dev)
return 0;
err_fw_stop:
- pvr_fw_stop(pvr_dev);
+ pvr_fw_stop(pvr_dev, false);
err_destroy_structures:
pvr_fw_destroy_structures(pvr_dev);
diff --git a/drivers/gpu/drm/imagination/pvr_fw.h b/drivers/gpu/drm/imagination/pvr_fw.h
index e9a802be45b2..d985089ae191 100644
--- a/drivers/gpu/drm/imagination/pvr_fw.h
+++ b/drivers/gpu/drm/imagination/pvr_fw.h
@@ -189,6 +189,7 @@ struct pvr_fw_defs {
* to report FW idle before proceeding.
*
* @pvr_dev: Target PowerVR device.
+ * @hard_reset: The FW was not asked to idle before this stop.
* @wait[out]: Whether the FW stop sequence should wait for FW idle.
*
* This function is optional. The assumption is that we must always wait
@@ -199,7 +200,7 @@ struct pvr_fw_defs {
* * 0 on success.
* * Any appropriate error on failure.
*/
- int (*must_wait_fw_idle)(struct pvr_device *pvr_dev, bool *wait);
+ int (*must_wait_fw_idle)(struct pvr_device *pvr_dev, bool hard_reset, bool *wait);
/**
* @has_fixed_data_addr: Specify whether the firmware fixed data must be loaded at the
diff --git a/drivers/gpu/drm/imagination/pvr_fw_meta.c b/drivers/gpu/drm/imagination/pvr_fw_meta.c
index 41f5e9ddc7f0..19baea23c434 100644
--- a/drivers/gpu/drm/imagination/pvr_fw_meta.c
+++ b/drivers/gpu/drm/imagination/pvr_fw_meta.c
@@ -562,7 +562,7 @@ pvr_meta_irq_clear(struct pvr_device *pvr_dev)
}
static int
-pvr_meta_must_wait_fw_idle(struct pvr_device *pvr_dev, bool *wait)
+pvr_meta_must_wait_fw_idle(struct pvr_device *pvr_dev, bool hard_reset, bool *wait)
{
u32 reg_value;
int err;
@@ -574,8 +574,10 @@ pvr_meta_must_wait_fw_idle(struct pvr_device *pvr_dev, bool *wait)
/*
* Wait for Sidekick/Jones to signal IDLE including the Garten
* Wrapper if there is no debugger attached (TxVECINT_BHALT = 0x0).
+ * A META that was not asked to idle (hard reset) keeps the Garten
+ * Wrapper busy; the soft reset that follows stops it.
*/
- *wait = !reg_value;
+ *wait = !reg_value && !hard_reset;
return 0;
}
diff --git a/drivers/gpu/drm/imagination/pvr_fw_startstop.c b/drivers/gpu/drm/imagination/pvr_fw_startstop.c
index 40af04a64b0c..f543ebd2f56d 100644
--- a/drivers/gpu/drm/imagination/pvr_fw_startstop.c
+++ b/drivers/gpu/drm/imagination/pvr_fw_startstop.c
@@ -188,13 +188,14 @@ static inline bool layout_is_mars(struct pvr_device *pvr_dev)
return layout_mars_value > 0;
}
-static inline int must_wait_fw_idle_before_stop(struct pvr_device *pvr_dev)
+static inline int must_wait_fw_idle_before_stop(struct pvr_device *pvr_dev, bool hard_reset)
{
bool wait_fw_idle = true;
int err;
if (pvr_dev->fw_dev.defs->must_wait_fw_idle) {
- err = pvr_dev->fw_dev.defs->must_wait_fw_idle(pvr_dev, &wait_fw_idle);
+ err = pvr_dev->fw_dev.defs->must_wait_fw_idle(pvr_dev, hard_reset,
+ &wait_fw_idle);
if (err)
return err;
}
@@ -205,13 +206,14 @@ static inline int must_wait_fw_idle_before_stop(struct pvr_device *pvr_dev)
/**
* pvr_fw_stop() - Stop FW processor
* @pvr_dev: Target PowerVR device.
+ * @hard_reset: The FW processor was not asked to idle first.
*
* Returns:
* * 0 on success, or
* * Any error returned by pvr_cr_poll_reg32().
*/
int
-pvr_fw_stop(struct pvr_device *pvr_dev)
+pvr_fw_stop(struct pvr_device *pvr_dev, bool hard_reset)
{
const u32 sidekick_idle_mask = ROGUE_CR_SIDEKICK_IDLE_MASKFULL &
~(ROGUE_CR_SIDEKICK_IDLE_GARTEN_EN |
@@ -309,7 +311,7 @@ pvr_fw_stop(struct pvr_device *pvr_dev)
if (err)
return err;
- wait_fw_idle = must_wait_fw_idle_before_stop(pvr_dev);
+ wait_fw_idle = must_wait_fw_idle_before_stop(pvr_dev, hard_reset);
if (wait_fw_idle < 0)
return wait_fw_idle;
diff --git a/drivers/gpu/drm/imagination/pvr_fw_startstop.h b/drivers/gpu/drm/imagination/pvr_fw_startstop.h
index a3cef061bd60..79a95bbbe4e1 100644
--- a/drivers/gpu/drm/imagination/pvr_fw_startstop.h
+++ b/drivers/gpu/drm/imagination/pvr_fw_startstop.h
@@ -4,10 +4,12 @@
#ifndef PVR_FW_STARTSTOP_H
#define PVR_FW_STARTSTOP_H
+#include <linux/types.h>
+
/* Forward declaration from pvr_device.h. */
struct pvr_device;
int pvr_fw_start(struct pvr_device *pvr_dev);
-int pvr_fw_stop(struct pvr_device *pvr_dev);
+int pvr_fw_stop(struct pvr_device *pvr_dev, bool hard_reset);
#endif /* PVR_FW_STARTSTOP_H */
diff --git a/drivers/gpu/drm/imagination/pvr_power.c b/drivers/gpu/drm/imagination/pvr_power.c
index eb4b6ecdf4f4..d88a522c4bfd 100644
--- a/drivers/gpu/drm/imagination/pvr_power.c
+++ b/drivers/gpu/drm/imagination/pvr_power.c
@@ -111,7 +111,7 @@ pvr_power_fw_disable(struct pvr_device *pvr_dev, bool hard_reset, bool rpm_suspe
disable_irq(pvr_dev->irq);
}
- err = pvr_fw_stop(pvr_dev);
+ err = pvr_fw_stop(pvr_dev, hard_reset);
if (err && rpm_suspend)
enable_irq(pvr_dev->irq);
@@ -133,7 +133,7 @@ pvr_power_fw_enable(struct pvr_device *pvr_dev, bool rpm_resume)
err = pvr_wait_for_fw_boot(pvr_dev);
if (err) {
drm_err(from_pvr_device(pvr_dev), "Firmware failed to boot\n");
- pvr_fw_stop(pvr_dev);
+ pvr_fw_stop(pvr_dev, false);
goto out;
}
--
2.56.1