* [PATCH v2 1/2] drm/imagination: Improve firmware power off for layout_mars config
2026-03-13 6:38 [PATCH v2 0/2] drm/imagination: Improve power off sequence Brajesh Gupta
@ 2026-03-13 6:38 ` Brajesh Gupta
2026-03-13 6:38 ` [PATCH v2 2/2] drm/imagination: Skip 2nd thread DM association for non META Firmware Brajesh Gupta
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Brajesh Gupta @ 2026-03-13 6:38 UTC (permalink / raw)
To: Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Alessio Belle,
Alexandru Dadu
Cc: dri-devel, linux-kernel, Brajesh Gupta
In layout_mars HW config, Firmware MCU moved from Sidekick to new Mars
domain so Firmware takes care of powering down Sidekick/Jones and SLC.
Skip checks for those from kernel and check idle bits for Firmware MCU
and system arbiter excluding SOCIF.
Signed-off-by: Brajesh Gupta <brajesh.gupta@imgtec.com>
---
drivers/gpu/drm/imagination/pvr_fw_startstop.c | 85 +++++++++++++++++---------
1 file changed, 57 insertions(+), 28 deletions(-)
diff --git a/drivers/gpu/drm/imagination/pvr_fw_startstop.c b/drivers/gpu/drm/imagination/pvr_fw_startstop.c
index dcbb9903e791..e47224ac0547 100644
--- a/drivers/gpu/drm/imagination/pvr_fw_startstop.c
+++ b/drivers/gpu/drm/imagination/pvr_fw_startstop.c
@@ -209,18 +209,32 @@ pvr_fw_stop(struct pvr_device *pvr_dev)
ROGUE_CR_SIDEKICK_IDLE_SOCIF_EN |
ROGUE_CR_SIDEKICK_IDLE_HOSTIF_EN);
bool skip_garten_idle = false;
+ u64 layout_mars_value = 0;
+ bool layout_mars = false;
+ bool meta_fw = pvr_dev->fw_dev.processor_type == PVR_FW_PROCESSOR_TYPE_META;
u32 reg_value;
int err;
+ if (PVR_FEATURE_VALUE(pvr_dev, layout_mars, &layout_mars_value) == 0)
+ layout_mars = layout_mars_value > 0;
+
/*
- * Wait for Sidekick/Jones to signal IDLE except for the Garten Wrapper.
- * For cores with the LAYOUT_MARS feature, SIDEKICK would have been
+ * For cores with the LAYOUT_MARS feature, SIDEKICK and SLC would have been
* powered down by the FW.
*/
- err = pvr_cr_poll_reg32(pvr_dev, ROGUE_CR_SIDEKICK_IDLE, sidekick_idle_mask,
- sidekick_idle_mask, POLL_TIMEOUT_USEC);
- if (err)
- return err;
+ if (!layout_mars) {
+ /* Wait for Sidekick/Jones to signal IDLE except for the Garten Wrapper. */
+ err = pvr_cr_poll_reg32(pvr_dev, ROGUE_CR_SIDEKICK_IDLE, sidekick_idle_mask,
+ sidekick_idle_mask, POLL_TIMEOUT_USEC);
+ if (err)
+ return err;
+
+ /* Wait for SLC to signal IDLE. */
+ err = pvr_cr_poll_reg32(pvr_dev, ROGUE_CR_SLC_IDLE, ROGUE_CR_SLC_IDLE_MASKFULL,
+ ROGUE_CR_SLC_IDLE_MASKFULL, POLL_TIMEOUT_USEC);
+ if (err)
+ return err;
+ }
/* Unset MTS DM association with threads. */
pvr_cr_write32(pvr_dev, ROGUE_CR_MTS_INTCTX_THREAD0_DM_ASSOC,
@@ -270,27 +284,25 @@ pvr_fw_stop(struct pvr_device *pvr_dev)
return err;
/*
- * Wait for SLC to signal IDLE.
- * For cores with the LAYOUT_MARS feature, SLC would have been powered
- * down by the FW.
+ * For cores with the LAYOUT_MARS feature, SIDEKICK and SLC would have been
+ * powered down by the FW.
*/
- err = pvr_cr_poll_reg32(pvr_dev, ROGUE_CR_SLC_IDLE,
- ROGUE_CR_SLC_IDLE_MASKFULL,
- ROGUE_CR_SLC_IDLE_MASKFULL, POLL_TIMEOUT_USEC);
- if (err)
- return err;
+ if (!layout_mars) {
+ /* Wait for SLC to signal IDLE. */
+ err = pvr_cr_poll_reg32(pvr_dev, ROGUE_CR_SLC_IDLE,
+ ROGUE_CR_SLC_IDLE_MASKFULL,
+ ROGUE_CR_SLC_IDLE_MASKFULL, POLL_TIMEOUT_USEC);
+ if (err)
+ return err;
- /*
- * Wait for Sidekick/Jones to signal IDLE except for the Garten Wrapper.
- * For cores with the LAYOUT_MARS feature, SIDEKICK would have been powered
- * down by the FW.
- */
- err = pvr_cr_poll_reg32(pvr_dev, ROGUE_CR_SIDEKICK_IDLE, sidekick_idle_mask,
- sidekick_idle_mask, POLL_TIMEOUT_USEC);
- if (err)
- return err;
+ /* Wait for Sidekick/Jones to signal IDLE except for the Garten Wrapper. */
+ err = pvr_cr_poll_reg32(pvr_dev, ROGUE_CR_SIDEKICK_IDLE, sidekick_idle_mask,
+ sidekick_idle_mask, POLL_TIMEOUT_USEC);
+ if (err)
+ return err;
+ }
- if (pvr_dev->fw_dev.processor_type == PVR_FW_PROCESSOR_TYPE_META) {
+ if (meta_fw) {
err = pvr_meta_cr_read32(pvr_dev, META_CR_TxVECINT_BHALT, ®_value);
if (err)
return err;
@@ -304,11 +316,28 @@ pvr_fw_stop(struct pvr_device *pvr_dev)
skip_garten_idle = true;
}
- if (!skip_garten_idle) {
- err = pvr_cr_poll_reg32(pvr_dev, ROGUE_CR_SIDEKICK_IDLE,
- ROGUE_CR_SIDEKICK_IDLE_GARTEN_EN,
- ROGUE_CR_SIDEKICK_IDLE_GARTEN_EN,
+ if (meta_fw || !layout_mars) {
+ if (!skip_garten_idle) {
+ err = pvr_cr_poll_reg32(pvr_dev, ROGUE_CR_SIDEKICK_IDLE,
+ ROGUE_CR_SIDEKICK_IDLE_GARTEN_EN,
+ ROGUE_CR_SIDEKICK_IDLE_GARTEN_EN,
+ POLL_TIMEOUT_USEC);
+ if (err)
+ return err;
+ }
+ } else {
+ /*
+ * As FW core has been moved from SIDEKICK to the new MARS domain, checking
+ * idle bits for CPU & System Arbiter excluding SOCIF which will never be
+ * idle if Host polling on this register
+ */
+ err = pvr_cr_poll_reg32(pvr_dev, ROGUE_CR_MARS_IDLE,
+ ROGUE_CR_MARS_IDLE_CPU_EN |
+ ROGUE_CR_MARS_IDLE_MH_SYSARB0_EN,
+ ROGUE_CR_MARS_IDLE_CPU_EN |
+ ROGUE_CR_MARS_IDLE_MH_SYSARB0_EN,
POLL_TIMEOUT_USEC);
+
if (err)
return err;
}
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v2 2/2] drm/imagination: Skip 2nd thread DM association for non META Firmware
2026-03-13 6:38 [PATCH v2 0/2] drm/imagination: Improve power off sequence Brajesh Gupta
2026-03-13 6:38 ` [PATCH v2 1/2] drm/imagination: Improve firmware power off for layout_mars config Brajesh Gupta
@ 2026-03-13 6:38 ` Brajesh Gupta
2026-03-20 15:53 ` [PATCH v2 0/2] drm/imagination: Improve power off sequence Matt Coster
2026-03-23 15:13 ` Matt Coster
3 siblings, 0 replies; 5+ messages in thread
From: Brajesh Gupta @ 2026-03-13 6:38 UTC (permalink / raw)
To: Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Alessio Belle,
Alexandru Dadu
Cc: dri-devel, linux-kernel, Brajesh Gupta
Only a META firmware can have two threads.
Signed-off-by: Brajesh Gupta <brajesh.gupta@imgtec.com>
---
drivers/gpu/drm/imagination/pvr_fw_startstop.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/imagination/pvr_fw_startstop.c b/drivers/gpu/drm/imagination/pvr_fw_startstop.c
index e47224ac0547..2f90bc1bf084 100644
--- a/drivers/gpu/drm/imagination/pvr_fw_startstop.c
+++ b/drivers/gpu/drm/imagination/pvr_fw_startstop.c
@@ -243,12 +243,15 @@ pvr_fw_stop(struct pvr_device *pvr_dev)
pvr_cr_write32(pvr_dev, ROGUE_CR_MTS_BGCTX_THREAD0_DM_ASSOC,
ROGUE_CR_MTS_BGCTX_THREAD0_DM_ASSOC_MASKFULL &
ROGUE_CR_MTS_BGCTX_THREAD0_DM_ASSOC_DM_ASSOC_CLRMSK);
- pvr_cr_write32(pvr_dev, ROGUE_CR_MTS_INTCTX_THREAD1_DM_ASSOC,
- ROGUE_CR_MTS_INTCTX_THREAD1_DM_ASSOC_MASKFULL &
- ROGUE_CR_MTS_INTCTX_THREAD1_DM_ASSOC_DM_ASSOC_CLRMSK);
- pvr_cr_write32(pvr_dev, ROGUE_CR_MTS_BGCTX_THREAD1_DM_ASSOC,
- ROGUE_CR_MTS_BGCTX_THREAD1_DM_ASSOC_MASKFULL &
- ROGUE_CR_MTS_BGCTX_THREAD1_DM_ASSOC_DM_ASSOC_CLRMSK);
+
+ if (meta_fw) {
+ pvr_cr_write32(pvr_dev, ROGUE_CR_MTS_INTCTX_THREAD1_DM_ASSOC,
+ ROGUE_CR_MTS_INTCTX_THREAD1_DM_ASSOC_MASKFULL &
+ ROGUE_CR_MTS_INTCTX_THREAD1_DM_ASSOC_DM_ASSOC_CLRMSK);
+ pvr_cr_write32(pvr_dev, ROGUE_CR_MTS_BGCTX_THREAD1_DM_ASSOC,
+ ROGUE_CR_MTS_BGCTX_THREAD1_DM_ASSOC_MASKFULL &
+ ROGUE_CR_MTS_BGCTX_THREAD1_DM_ASSOC_DM_ASSOC_CLRMSK);
+ }
/* Extra Idle checks. */
err = pvr_cr_poll_reg32(pvr_dev, ROGUE_CR_BIF_STATUS_MMU, 0,
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2 0/2] drm/imagination: Improve power off sequence
2026-03-13 6:38 [PATCH v2 0/2] drm/imagination: Improve power off sequence Brajesh Gupta
2026-03-13 6:38 ` [PATCH v2 1/2] drm/imagination: Improve firmware power off for layout_mars config Brajesh Gupta
2026-03-13 6:38 ` [PATCH v2 2/2] drm/imagination: Skip 2nd thread DM association for non META Firmware Brajesh Gupta
@ 2026-03-20 15:53 ` Matt Coster
2026-03-23 15:13 ` Matt Coster
3 siblings, 0 replies; 5+ messages in thread
From: Matt Coster @ 2026-03-20 15:53 UTC (permalink / raw)
To: Brajesh Gupta
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Frank Binns, Alessio Belle,
Alexandru Dadu, dri-devel, linux-kernel
[-- Attachment #1.1: Type: text/plain, Size: 1051 bytes --]
On 13/03/2026 06:38, Brajesh Gupta wrote:
> Signed-off-by: Brajesh Gupta <brajesh.gupta@imgtec.com>
For the series,
Reviewed-by: Matt Coster <matt.coster@imgtec.com>
I'll apply this to drm-misc-next shortly, unless you (or anyone) thinks
it should go to -fixes instead.
Cheers,
Matt
> ---
> Changes in v2:
> - Patch updates as per feedback
> - Link to v1: https://lore.kernel.org/r/20260305-b4-staging-layout_mars_base-v1-0-09831fa17cef@imgtec.com
>
> ---
> Brajesh Gupta (2):
> drm/imagination: Improve firmware power off for layout_mars config
> drm/imagination: Skip 2nd thread DM association for non META Firmware
>
> drivers/gpu/drm/imagination/pvr_fw_startstop.c | 100 ++++++++++++++++---------
> 1 file changed, 66 insertions(+), 34 deletions(-)
> ---
> base-commit: 68b271a3a94cfd6c7695a96b6398b52feb89e2c2
> change-id: 20260304-b4-staging-layout_mars_base-dfbbf1a53b3c
>
> Best regards,
> --
> Brajesh Gupta <brajesh.gupta@imgtec.com>
>
--
Matt Coster
E: matt.coster@imgtec.com
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread