On 11/10/26 8:33 PM, [email protected] wrote:
[Severity: Low]
In 727538a4bbff ("drm/imagination: Implement power management"),
pvr_power_fw_disable() was an unimplemented stub returning -ENODEV and
pvr_power_device_suspend() only disabled clocks.  Should the Fixes: tag
point to cc1aeedb98ad ("drm/imagination: Implement firmware infrastructure
and META FW support"), which introduced pvr_fw_stop() and wired up
pvr_power_fw_disable() in runtime suspend (or 74ef7844dd8c
("drm/imagination: Disable interrupts before suspending the GPU"), which
added the disable_irq() call before pvr_fw_stop())?


[Severity: Medium]
Can pvr_dev->fw_irq_count fall behind osdata->interrupt_count when
pvr_fw_irq_clear() is called outside pvr_device_irq_thread_handler(), such
as during a soft reset in pvr_power_reset()?

drivers/gpu/drm/imagination/pvr_power.c:pvr_power_reset() {
     ...
                err = pvr_power_fw_disable(pvr_dev, hard_reset, false);
                if (!err) {
                        if (hard_reset) {
     ...
                        } else {
                                /* Clear the FW faulted flags. */
                                pvr_dev->fw_dev.fwif_sysdata->hwr_state_flags &=
                                        ~(ROGUE_FWIF_HWR_FW_FAULT |
                                          ROGUE_FWIF_HWR_RESTART_REQUESTED);
                        }

                        pvr_fw_irq_clear(pvr_dev);

                        err = pvr_power_fw_enable(pvr_dev, false);
                }
     ...
}

On a soft reset (hard_reset == false), pvr_fw_hard_reset() is not called,
so osdata->interrupt_count keeps its non-zero values while
disable_irq_nosync() is in effect.  If the firmware raises another
interrupt after pvr_device_irq_thread_handler() sampled
osdata->interrupt_count (or while pvr_power_fw_disable() sends the idle
and power-off requests), pvr_fw_irq_clear() in pvr_power_reset() clears
the pending hardware interrupt without updating pvr_dev->fw_irq_count.
Because the hardware status bit is cleared, pvr_device_irq_thread_handler()
will not run for that interrupt, and the next runtime suspend will see
osdata->interrupt_count[i] != pvr_dev->fw_irq_count[i] in
pvr_power_wait_for_fw_irqs(), stalling for the full 1-second
POWER_SYNC_TIMEOUT_US and logging a false warning.  The same can happen at
boot when pvr_device_irq_init() calls pvr_fw_irq_clear() after
pvr_device_gpu_init() has already started the firmware.


I always manage to trigger Sashiko bot with drm/imagination changes :D

Both of these are correct. I'll fix in v2 -- the host's copy of the firmware interrupt count will be taken inside pvr_fw_irq_clear(), so every clear updates it (IRQ thread, probe, pvr_power_reset()).

I'll wait a little bit for human review if there's anything else I missed.

Thanks,
Ryan Brue

Reply via email to