[PATCH] drm/imagination: Treat firmware as idle until kicked after boot

From: Gyeyoung Baek

Date: Sun Nov 29 2026 - 01:01:33 EST


After the firmware boots during probe, the GPU should autosuspend, but
its power and clocks stay on indefinitely until the first command is
sent:

pvr_device_init()
pvr_device_gpu_init()
pvr_fw_init() /* firmware boot */
pm_runtime_put()
pvr_power_device_idle() /* .runtime_idle, async */
pvr_power_is_idle() /* false */
return -EBUSY

Since pvr_power_device_idle() returns -EBUSY, the PM core never
attempts to suspend.

The cause:

- pvr_power_is_idle() requires the firmware to report
ROGUE_FWIF_POW_IDLE.
- The firmware does not report ROGUE_FWIF_POW_IDLE until it has
processed a command. On J722S it stays in ROGUE_FWIF_POW_ON.

Fix this by treating a firmware that has not been kicked since boot as
idle regardless of pow_state, as it has no work to do. The downstream
driver likewise powers off a freshly booted firmware without waiting
for ROGUE_FWIF_POW_IDLE.

Track this with a flag:

- Clear it once the firmware has booted (pvr_wait_for_fw_boot()).
- Set it when the firmware is kicked (pvr_fw_mts_schedule()).
- Skip the pow_state check in pvr_power_is_idle() while it is clear.

To reproduce, load the driver and check runtime_status after a second
(J722S, FW 36.53.104.796, 10 iterations):

# modprobe -r powervr; modprobe powervr; sleep 1
# cat /sys/bus/platform/drivers/powervr/*/power/runtime_status

without this patch: active (10/10)
with this patch: suspended (10/10)

Fixes: cc1aeedb98ad ("drm/imagination: Implement firmware infrastructure and META FW support")
Signed-off-by: Gyeyoung Baek <gye976@xxxxxxxxx>
---
Found while testing [1]. With [1] alone, runtime suspend is retried
forever after probe, so this patch should be applied first.

Tested on J722S with and without [1] (module reload, repeated
vulkaninfo, remove right after probe). The hard reset path is untested.

[1] https://lore.kernel.org/dri-devel/20261127-img-pm-autosuspend-v3-1-3a65ee22d9b2@xxxxxxxxxxxxxxxxxx/
---
drivers/gpu/drm/imagination/pvr_fw.c | 6 +++++-
drivers/gpu/drm/imagination/pvr_fw.h | 7 +++++++
drivers/gpu/drm/imagination/pvr_power.c | 8 ++++++++
3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imagination/pvr_fw.c b/drivers/gpu/drm/imagination/pvr_fw.c
index c7988278df3..cf7930617a0 100644
--- a/drivers/gpu/drm/imagination/pvr_fw.c
+++ b/drivers/gpu/drm/imagination/pvr_fw.c
@@ -850,8 +850,10 @@ pvr_wait_for_fw_boot(struct pvr_device *pvr_dev)
struct pvr_fw_device *fw_dev = &pvr_dev->fw_dev;

while (ktime_to_ns(ktime_sub(deadline, ktime_get())) > 0) {
- if (READ_ONCE(fw_dev->fwif_sysinit->firmware_started))
+ if (READ_ONCE(fw_dev->fwif_sysinit->firmware_started)) {
+ WRITE_ONCE(fw_dev->kicked, false);
return 0;
+ }
}

return -ETIMEDOUT;
@@ -1043,6 +1045,8 @@ pvr_fw_mts_schedule(struct pvr_device *pvr_dev, u32 val)

/* Ensure the MTS kick goes through before continuing. */
mb();
+
+ WRITE_ONCE(pvr_dev->fw_dev.kicked, true);
}

/**
diff --git a/drivers/gpu/drm/imagination/pvr_fw.h b/drivers/gpu/drm/imagination/pvr_fw.h
index 626a1fdb6a4..d32950e35b3 100644
--- a/drivers/gpu/drm/imagination/pvr_fw.h
+++ b/drivers/gpu/drm/imagination/pvr_fw.h
@@ -301,6 +301,13 @@ struct pvr_fw_device {
*/
bool initialised;

+ /**
+ * @kicked: %true if the firmware has been kicked since it last booted,
+ * %false otherwise.
+ * Must be accessed by READ_ONCE()/WRITE_ONCE().
+ */
+ bool kicked;
+
/**
* @processor_type: FW processor type for this device. Must be one of
* %PVR_FW_PROCESSOR_TYPE_*.
diff --git a/drivers/gpu/drm/imagination/pvr_power.c b/drivers/gpu/drm/imagination/pvr_power.c
index c7c160913d7..f1268d91cf0 100644
--- a/drivers/gpu/drm/imagination/pvr_power.c
+++ b/drivers/gpu/drm/imagination/pvr_power.c
@@ -160,6 +160,14 @@ pvr_power_is_idle(struct pvr_device *pvr_dev)
enum rogue_fwif_pow_state pow_state = READ_ONCE(pvr_dev->fw_dev.fwif_sysdata->pow_state);
bool kccb_idle = pvr_kccb_is_idle(pvr_dev);

+ /*
+ * The FW only reports ROGUE_FWIF_POW_IDLE after processing a command, and stays in
+ * ROGUE_FWIF_POW_ON after boot until then. A FW that hasn't been kicked since boot has no
+ * work to do, so treat it as idle.
+ */
+ if (!READ_ONCE(pvr_dev->fw_dev.kicked))
+ return kccb_idle;
+
return (pow_state == ROGUE_FWIF_POW_IDLE) && kccb_idle;
}


---
base-commit: e950f467b8adbfb2f460d9b9454280cdbf597885
change-id: 20261129-pvr-fw-idle-after-boot-679eef72f02d

Best regards,
--
Gyeyoung Baek <gye976@xxxxxxxxx>