public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] qcom: Refactor GPU GX GDSC handling and IFPC behavior on A8x GPUs
@ 2026-04-27  6:38 Taniya Das
  2026-04-27  6:38 ` [PATCH v2 1/6] clk: qcom: gdsc: Add custom disable callback for GX GDSC Taniya Das
                   ` (6 more replies)
  0 siblings, 7 replies; 18+ messages in thread
From: Taniya Das @ 2026-04-27  6:38 UTC (permalink / raw)
  To: Bjorn Andersson, Michael Turquette, Stephen Boyd, Konrad Dybcio,
	Abel Vesa, Rob Clark, Sean Paul, Konrad Dybcio, Akhil P Oommen,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Marijn Suijten,
	David Airlie, Simona Vetter
  Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
	linux-clk, linux-kernel, dri-devel, freedreno, Taniya Das,
	Pengyu Luo, Alexander Koskovich

This series fixes two closely related issues around GX GDSC ownership and
rail control on A8x GPUs, where recent hardware changes and runtime PM
interactions violate GMU and IFPC(Inter Frame Power Collapse) architectural
expectations.

Problem statement 1: Incorrect GX GDSC disable by OS
----------------------------------------------------
GX GDSC is a special GPU power domain that must be exclusively controlled
by GMU firmware during normal operation. The OS is expected to force‑
disable GX GDSC only during GPU/GMU recovery.

However, when GX GDSC is managed through the generic GenPD runtime PM
framework, it can be unintentionally disabled by the OS during system
resume (resume_noirq/complete phases) or runtime PM suspend paths. This
can race with GMU firmware usage and result in warnings such as:

  gx_clkctl_gx_gdsc status stuck at 'on'

and failures in gdsc_toggle_logic(), leading to broken GPU suspend/resume
behaviour.

Solution:
Introduce a custom disable callback for GX GDSC that prevents the OS from
touching GX GDSC hardware during normal runtime PM and system PM flows.
The callback relies on GenPD’s synced_poweroff flag, which is asserted by
the GMU driver only during recovery, explicitly allowing GX GDSC to be
disabled by the OS in that case.

This ensures strict GX GDSC ownership by GMU while still supporting
recovery use cases.

Problem statement 2: Unintended GX/GMxC rail votes from APPS RSC
--------------------------------------------------------------
On A8x platforms, GX GDSC has been moved to a dedicated GXCLKCTL block
under the GX power domain. Due to the current runtime PM device links
between supplier and consumer, when GMU device is moved to RPM_ACTIVE
state, GXCLKCTL device will also be moved to RPM_ACTIVE and result in
GX/GMxC rail votes from the OS.

This behavior conflicts with IFPC and Adreno architecture requirements,
which mandate that GMU firmware must be the sole voter of these
collapsible rails on behalf of the GPU. Linux is expected to intervene
only during GPU/GMU recovery.

Solution:
The runtime PM of GXCLKCTL can be disabled post the GX CLKCTL is runtime
suspended in probe, so the runtime PM requests of GMU device are not propagated
to its supplier GXCLKCTL.  To avoid incomplete runtime suspend during probe on
clock controllers using runtime PM, ensure pm_runtime_put_sync() is used so that
runtime PM suspend completes before returning from probe.

This along with GMU driver change to vote on GX GDSC only during GMU recovery will
prevent the votes on GX/GMXC rails from APPS RSC during normal GMU operation.

Patch overview:
--------------
1. clk: qcom: gdsc: Add custom disable callback for GX GDSC
   - Prevents unintended GX GDSC disable outside recovery.

2. clk: qcom: gxclkctl: Use custom disable callback for gx_gdsc
   - Applies the custom behavior to GXCLKCTL and fixes runtime PM warnings.

3. clk: qcom: common: ensure runtime PM suspend completes on probe
   - Guarantees synchronous runtime suspend during probe.

4. clk: qcom: gxclkctl: Remove GX/GMxC rail votes to align with IFPC
   - Eliminates unintended APPS RSC rail votes, restoring GMU ownership.

5. drm/msm/a8xx: Make a8xx_recover IFPC safe
   - Makes the A8xx recovery path IFPC‑aware by checking GX power‑domain
   state before accessing GX MMIO, matching a6xx behavior.

6. drm/msm/a6xx: Limit GXPD votes to recovery in A8x
   - Removes GXPD voting from normal GMU runtime PM and restricts it to
   recovery using the synced_poweroff mechanism.

Together, these changes restore strict GMU ownership of GX GDSC and GPU
rails, align Linux behavior with IFPC architecture, resolves reported
runtime warnings and failures, and enable correct power collapse of
GX/GMxC on A8x GPUs.

Changes in v2:
- Update commit text for patchset#3 [Konrad]
- Add RB-by tag for patch #2, #5 from v1 [Konrad]
- Link to v1: https://lore.kernel.org/r/20260407-gfx-clk-fixes-v1-0-4bb5583a5054@oss.qualcomm.com

Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
---
Akhil P Oommen (2):
      drm/msm/a8xx: Make a8xx_recover IFPC safe
      drm/msm/a6xx: Limit GXPD votes to recovery in A8x

Jagadeesh Kona (1):
      clk: qcom: gdsc: Add custom disable callback for GX GDSC

Taniya Das (3):
      clk: qcom: gxclkctl: Use custom disable callback for gx_gdsc
      clk: qcom: common: ensure runtime PM suspend completes on probe
      clk: qcom: gxclkctl: Remove GX/GMxC rail votes to align with IFPC

 drivers/clk/qcom/common.c             |  2 +-
 drivers/clk/qcom/gdsc.c               | 22 ++++++++++++
 drivers/clk/qcom/gdsc.h               |  1 +
 drivers/clk/qcom/gxclkctl-kaanapali.c | 12 ++++++-
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 64 +++++++++++++++++++++++++++++------
 drivers/gpu/drm/msm/adreno/a8xx_gpu.c | 15 +++++---
 6 files changed, 99 insertions(+), 17 deletions(-)
---
base-commit: 2febe6e6ee6e34c7754eff3c4d81aa7b0dcb7979
change-id: 20260406-gfx-clk-fixes-24a492bb7676

Best regards,
-- 
Taniya Das <taniya.das@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 1/6] clk: qcom: gdsc: Add custom disable callback for GX GDSC
  2026-04-27  6:38 [PATCH v2 0/6] qcom: Refactor GPU GX GDSC handling and IFPC behavior on A8x GPUs Taniya Das
@ 2026-04-27  6:38 ` Taniya Das
  2026-04-27 13:13   ` Konrad Dybcio
  2026-04-28  5:05   ` Claude review: " Claude Code Review Bot
  2026-04-27  6:38 ` [PATCH v2 2/6] clk: qcom: gxclkctl: Use custom disable callback for gx_gdsc Taniya Das
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 18+ messages in thread
From: Taniya Das @ 2026-04-27  6:38 UTC (permalink / raw)
  To: Bjorn Andersson, Michael Turquette, Stephen Boyd, Konrad Dybcio,
	Abel Vesa, Rob Clark, Sean Paul, Konrad Dybcio, Akhil P Oommen,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Marijn Suijten,
	David Airlie, Simona Vetter
  Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
	linux-clk, linux-kernel, dri-devel, freedreno, Taniya Das

From: Jagadeesh Kona <jagadeesh.kona@oss.qualcomm.com>

The GX GDSC is a special power domain that should only be disabled
by OS during GMU recovery. In all other scenarios, the GMU firmware
is responsible for handling its disable sequence, and OS must not
interfere.

During the resume_noirq() phase of system resume, the GenPD framework
enables all power domains and later disables them in the complete()
phase if there are no active votes from OS. This behavior can
incorrectly disable the GX GDSC while the GMU firmware is still using
it.

To prevent this, implement a custom disable callback for GX GDSC that
relies on GenPD’s synced_poweroff flag. The GMU driver sets this flag
only during recovery, allowing OS to explicitly disable GX GDSC in
hardware in that case. In all other situations, the disable callback
will avoid touching GX GDSC hardware.

Signed-off-by: Jagadeesh Kona <jagadeesh.kona@oss.qualcomm.com>
Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
---
 drivers/clk/qcom/gdsc.c | 22 ++++++++++++++++++++++
 drivers/clk/qcom/gdsc.h |  1 +
 2 files changed, 23 insertions(+)

diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c
index 95aa071202455421d818171d04f95d15e2b581fa..ab5d741a2e2351bfac06a6814c5a8ba7355bc8bc 100644
--- a/drivers/clk/qcom/gdsc.c
+++ b/drivers/clk/qcom/gdsc.c
@@ -675,3 +675,25 @@ int gdsc_gx_do_nothing_enable(struct generic_pm_domain *domain)
 	return ret;
 }
 EXPORT_SYMBOL_GPL(gdsc_gx_do_nothing_enable);
+
+/*
+ * GX GDSC is a special power domain. Normally, its disable sequence
+ * is managed by the GMU firmware, and high level OS must not attempt
+ * to disable it. The only exception is during GMU recovery, where the
+ * GMU driver can set GenPD’s synced_poweroff flag to allow explicitly
+ * disable GX GDSC in hardware.
+ */
+int gdsc_gx_disable(struct generic_pm_domain *domain)
+{
+	struct gdsc *sc = domain_to_gdsc(domain);
+
+	if (domain->synced_poweroff)
+		return gdsc_disable(domain);
+
+	/* Remove parent-supply placed in enable */
+	if (sc->rsupply)
+		return regulator_disable(sc->rsupply);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(gdsc_gx_disable);
diff --git a/drivers/clk/qcom/gdsc.h b/drivers/clk/qcom/gdsc.h
index dd843e86c05b2f30e6d9e978681580016333839d..495daebaf99519ba0571070b41d133ee867c4fd3 100644
--- a/drivers/clk/qcom/gdsc.h
+++ b/drivers/clk/qcom/gdsc.h
@@ -88,6 +88,7 @@ int gdsc_register(struct gdsc_desc *desc, struct reset_controller_dev *,
 		  struct regmap *);
 void gdsc_unregister(struct gdsc_desc *desc);
 int gdsc_gx_do_nothing_enable(struct generic_pm_domain *domain);
+int gdsc_gx_disable(struct generic_pm_domain *domain);
 #else
 static inline int gdsc_register(struct gdsc_desc *desc,
 				struct reset_controller_dev *rcdev,

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 2/6] clk: qcom: gxclkctl: Use custom disable callback for gx_gdsc
  2026-04-27  6:38 [PATCH v2 0/6] qcom: Refactor GPU GX GDSC handling and IFPC behavior on A8x GPUs Taniya Das
  2026-04-27  6:38 ` [PATCH v2 1/6] clk: qcom: gdsc: Add custom disable callback for GX GDSC Taniya Das
@ 2026-04-27  6:38 ` Taniya Das
  2026-04-28  5:05   ` Claude review: " Claude Code Review Bot
  2026-04-27  6:38 ` [PATCH v2 3/6] clk: qcom: common: ensure runtime PM suspend completes on probe Taniya Das
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 18+ messages in thread
From: Taniya Das @ 2026-04-27  6:38 UTC (permalink / raw)
  To: Bjorn Andersson, Michael Turquette, Stephen Boyd, Konrad Dybcio,
	Abel Vesa, Rob Clark, Sean Paul, Konrad Dybcio, Akhil P Oommen,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Marijn Suijten,
	David Airlie, Simona Vetter
  Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
	linux-clk, linux-kernel, dri-devel, freedreno, Taniya Das,
	Pengyu Luo, Alexander Koskovich

The GX GDSC represents a special GPU power domain that must not be
disabled during normal runtime PM flows. As per the GMU architecture,
GX GDSC should only be force-disabled during GMU/GPU recovery, where the
OS explicitly resets the GX power domain.

However, when managed by the generic GDSC runtime PM path, GX GDSC may be
disabled during GMU runtime suspend, resulting in warnings such as:

  gx_clkctl_gx_gdsc status stuck at 'on'

and failures in gdsc_toggle_logic() during rpm suspend.

Use the newly added custom disable callback for gx_gdsc to ensure the
GDSC is toggled only in recovery scenarios, while preventing unintended
disable attempts during normal GMU runtime PM operations.

Reported-by: Pengyu Luo <mitltlatltl@gmail.com>
Closes: https://lore.kernel.org/all/CAH2e8h4Vp9fJYAUUbOmoHSKB25wakPBvmpwa62BTRqgRQbMWuw@mail.gmail.com/
Reported-by: Alexander Koskovich <akoskovich@pm.me>
Closes: https://lore.kernel.org/all/gwVAH2mJerU4dBInw8pKmOs5aQK55Q7W6q_UQAlLFCsEgX6eyvSgXAWbNNMqAX4WmPlYCKUSMhfkr5Jry4Ps5EqnxYZqEEDd3Whwv7ZXGlc=@pm.me/
Fixes: 5af11acae660 ("clk: qcom: Add a driver for SM8750 GPU clocks")
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
---
 drivers/clk/qcom/gxclkctl-kaanapali.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/qcom/gxclkctl-kaanapali.c b/drivers/clk/qcom/gxclkctl-kaanapali.c
index 40d856378a74aeb706c2f4a7a17a2c5602042af2..d7cf6834dd77c2a5320ffb8548cdb515be237bdc 100644
--- a/drivers/clk/qcom/gxclkctl-kaanapali.c
+++ b/drivers/clk/qcom/gxclkctl-kaanapali.c
@@ -26,6 +26,7 @@ static struct gdsc gx_clkctl_gx_gdsc = {
 	.pd = {
 		.name = "gx_clkctl_gx_gdsc",
 		.power_on = gdsc_gx_do_nothing_enable,
+		.power_off = gdsc_gx_disable,
 	},
 	.pwrsts = PWRSTS_OFF_ON,
 	.flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE,

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 3/6] clk: qcom: common: ensure runtime PM suspend completes on probe
  2026-04-27  6:38 [PATCH v2 0/6] qcom: Refactor GPU GX GDSC handling and IFPC behavior on A8x GPUs Taniya Das
  2026-04-27  6:38 ` [PATCH v2 1/6] clk: qcom: gdsc: Add custom disable callback for GX GDSC Taniya Das
  2026-04-27  6:38 ` [PATCH v2 2/6] clk: qcom: gxclkctl: Use custom disable callback for gx_gdsc Taniya Das
@ 2026-04-27  6:38 ` Taniya Das
  2026-04-27 13:17   ` Konrad Dybcio
  2026-04-28  5:05   ` Claude review: " Claude Code Review Bot
  2026-04-27  6:38 ` [PATCH v2 4/6] clk: qcom: gxclkctl: Remove GX/GMxC rail votes to align with IFPC Taniya Das
                   ` (3 subsequent siblings)
  6 siblings, 2 replies; 18+ messages in thread
From: Taniya Das @ 2026-04-27  6:38 UTC (permalink / raw)
  To: Bjorn Andersson, Michael Turquette, Stephen Boyd, Konrad Dybcio,
	Abel Vesa, Rob Clark, Sean Paul, Konrad Dybcio, Akhil P Oommen,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Marijn Suijten,
	David Airlie, Simona Vetter
  Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
	linux-clk, linux-kernel, dri-devel, freedreno, Taniya Das

When the clock controller is probed with 'use_rpm' enabled, the
runtime PM reference is currently released using pm_runtime_put(),
which may return before the runtime suspend has completed. When the
clock controller device is registered through this function, calling
pm_runtime_disable() immediately after pm_runtime_put() prevents
the runtime suspend from completing, leaving the clock controller
active and the HW rails in the ON state.

Use pm_runtime_put_sync() instead to ensure the runtime PM “putV
completes synchronously during probe. This does not have any functional
impact, but it guarantees that the device is fully runtime-suspended
before returning.

Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
---
 drivers/clk/qcom/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c
index eec369d2173b5ce24bc1ca860d2ac1bbdce04524..2c09abaf1d2a15b7fbbbfeb67c03075381185a00 100644
--- a/drivers/clk/qcom/common.c
+++ b/drivers/clk/qcom/common.c
@@ -428,7 +428,7 @@ int qcom_cc_really_probe(struct device *dev,
 
 put_rpm:
 	if (desc->use_rpm)
-		pm_runtime_put(dev);
+		pm_runtime_put_sync(dev);
 
 	return ret;
 }

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 4/6] clk: qcom: gxclkctl: Remove GX/GMxC rail votes to align with IFPC
  2026-04-27  6:38 [PATCH v2 0/6] qcom: Refactor GPU GX GDSC handling and IFPC behavior on A8x GPUs Taniya Das
                   ` (2 preceding siblings ...)
  2026-04-27  6:38 ` [PATCH v2 3/6] clk: qcom: common: ensure runtime PM suspend completes on probe Taniya Das
@ 2026-04-27  6:38 ` Taniya Das
  2026-04-27 13:14   ` Konrad Dybcio
  2026-04-28  5:05   ` Claude review: " Claude Code Review Bot
  2026-04-27  6:38 ` [PATCH v2 5/6] drm/msm/a8xx: Make a8xx_recover IFPC safe Taniya Das
                   ` (2 subsequent siblings)
  6 siblings, 2 replies; 18+ messages in thread
From: Taniya Das @ 2026-04-27  6:38 UTC (permalink / raw)
  To: Bjorn Andersson, Michael Turquette, Stephen Boyd, Konrad Dybcio,
	Abel Vesa, Rob Clark, Sean Paul, Konrad Dybcio, Akhil P Oommen,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Marijn Suijten,
	David Airlie, Simona Vetter
  Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
	linux-clk, linux-kernel, dri-devel, freedreno, Taniya Das

The GX GDSC control is handled through a dedicated clock controller,
and the enable/disable sequencing depends on correct rail voting.
The driver votes for the GX/GMxC rails and CX GDSC before toggling
the GX GDSC. Currently, during GMU runtime PM resume, rails remain
enabled due to upstream votes propagated via RPM-enabled devlinks
and explicit pm_runtime votes on GX GDSC.

This is not an expected behaviour of IFPC(Inter Frame Power Collapse)
requirements of GPU as GMU firmware is expected to control these rails,
except during the GPU/GMU recovery via the OS and that is where the GX
GDSC should be voting for the rails (GX/GMxC and CX GDSC) before
toggling the GX GDSC.

Thus, disable runtime PM after successfully registering the clock
controller.

Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
---
 drivers/clk/qcom/gxclkctl-kaanapali.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/gxclkctl-kaanapali.c b/drivers/clk/qcom/gxclkctl-kaanapali.c
index d7cf6834dd77c2a5320ffb8548cdb515be237bdc..d470ade11b0d11eb40843fe84c809e71646dce27 100644
--- a/drivers/clk/qcom/gxclkctl-kaanapali.c
+++ b/drivers/clk/qcom/gxclkctl-kaanapali.c
@@ -7,6 +7,7 @@
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/regmap.h>
 
 #include <dt-bindings/clock/qcom,kaanapali-gxclkctl.h>
@@ -61,7 +62,15 @@ MODULE_DEVICE_TABLE(of, gx_clkctl_kaanapali_match_table);
 
 static int gx_clkctl_kaanapali_probe(struct platform_device *pdev)
 {
-	return qcom_cc_probe(pdev, &gx_clkctl_kaanapali_desc);
+	int ret;
+
+	ret = qcom_cc_probe(pdev, &gx_clkctl_kaanapali_desc);
+	if (ret)
+		return ret;
+
+	pm_runtime_disable(&pdev->dev);
+
+	return ret;
 }
 
 static struct platform_driver gx_clkctl_kaanapali_driver = {

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 5/6] drm/msm/a8xx: Make a8xx_recover IFPC safe
  2026-04-27  6:38 [PATCH v2 0/6] qcom: Refactor GPU GX GDSC handling and IFPC behavior on A8x GPUs Taniya Das
                   ` (3 preceding siblings ...)
  2026-04-27  6:38 ` [PATCH v2 4/6] clk: qcom: gxclkctl: Remove GX/GMxC rail votes to align with IFPC Taniya Das
@ 2026-04-27  6:38 ` Taniya Das
  2026-04-28  5:05   ` Claude review: " Claude Code Review Bot
  2026-04-27  6:39 ` [PATCH v2 6/6] drm/msm/a6xx: Limit GXPD votes to recovery in A8x Taniya Das
  2026-04-28  5:05 ` Claude review: qcom: Refactor GPU GX GDSC handling and IFPC behavior on A8x GPUs Claude Code Review Bot
  6 siblings, 1 reply; 18+ messages in thread
From: Taniya Das @ 2026-04-27  6:38 UTC (permalink / raw)
  To: Bjorn Andersson, Michael Turquette, Stephen Boyd, Konrad Dybcio,
	Abel Vesa, Rob Clark, Sean Paul, Konrad Dybcio, Akhil P Oommen,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Marijn Suijten,
	David Airlie, Simona Vetter
  Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
	linux-clk, linux-kernel, dri-devel, freedreno, Taniya Das

From: Akhil P Oommen <akhilpo@oss.qualcomm.com>

Similar to a6xx_recover(), check the GX power domain status before
accessing mmio in GX domain a8xx_recover().

Fixes: 288a93200892 ("drm/msm/adreno: Introduce A8x GPU Support")
Signed-off-by: Akhil P Oommen <akhilpo@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
---
 drivers/gpu/drm/msm/adreno/a8xx_gpu.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a8xx_gpu.c b/drivers/gpu/drm/msm/adreno/a8xx_gpu.c
index ccfccc45133fda53168d3475ebd3d543f10268af..9b99ec5ceeb5826fbd5cd1059febf5bc5ba468b5 100644
--- a/drivers/gpu/drm/msm/adreno/a8xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a8xx_gpu.c
@@ -886,17 +886,22 @@ void a8xx_recover(struct msm_gpu *gpu)
 
 	adreno_dump_info(gpu);
 
-	if (hang_debug)
-		a8xx_dump(gpu);
-
 	/*
 	 * To handle recovery specific sequences during the rpm suspend we are
 	 * about to trigger
 	 */
 	a6xx_gpu->hung = true;
 
-	/* Halt SQE first */
-	gpu_write(gpu, REG_A8XX_CP_SQE_CNTL, 3);
+	if (adreno_gpu->funcs->gx_is_on(adreno_gpu)) {
+		/*
+		 * Sometimes crashstate capture is skipped, so SQE should be
+		 * halted here again
+		 */
+		gpu_write(gpu, REG_A8XX_CP_SQE_CNTL, 3);
+
+		if (hang_debug)
+			a8xx_dump(gpu);
+	}
 
 	pm_runtime_dont_use_autosuspend(&gpu->pdev->dev);
 

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 6/6] drm/msm/a6xx: Limit GXPD votes to recovery in A8x
  2026-04-27  6:38 [PATCH v2 0/6] qcom: Refactor GPU GX GDSC handling and IFPC behavior on A8x GPUs Taniya Das
                   ` (4 preceding siblings ...)
  2026-04-27  6:38 ` [PATCH v2 5/6] drm/msm/a8xx: Make a8xx_recover IFPC safe Taniya Das
@ 2026-04-27  6:39 ` Taniya Das
  2026-04-27 13:17   ` Konrad Dybcio
  2026-04-28  5:05   ` Claude review: " Claude Code Review Bot
  2026-04-28  5:05 ` Claude review: qcom: Refactor GPU GX GDSC handling and IFPC behavior on A8x GPUs Claude Code Review Bot
  6 siblings, 2 replies; 18+ messages in thread
From: Taniya Das @ 2026-04-27  6:39 UTC (permalink / raw)
  To: Bjorn Andersson, Michael Turquette, Stephen Boyd, Konrad Dybcio,
	Abel Vesa, Rob Clark, Sean Paul, Konrad Dybcio, Akhil P Oommen,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Marijn Suijten,
	David Airlie, Simona Vetter
  Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
	linux-clk, linux-kernel, dri-devel, freedreno, Taniya Das

From: Akhil P Oommen <akhilpo@oss.qualcomm.com>

In A8x GPUs, the GX GDSC is moved to a separate block called GXCLKCTL
which is under the GX power domain. Due to the way the support for this
block is implemented in its driver, pm_runtime votes result in a vote on
GX/GMxC/MxC rails from the APPS RSC. This is against the Adreno
architecture which require GMU to be the sole voter of these collapsible
rails on behalf of GPU, except during the GPU/GMU recovery.

To align with this architectural requirement and to realize the power
benefits of the IFPC feature, remove the GXPD votes during gmu resume
and suspend. And during the recovery sequence, enable/disable the GXPD
along with the 'synced_poweroff' genpd hint to force collapse this GDSC.

Signed-off-by: Akhil P Oommen <akhilpo@oss.qualcomm.com>
Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
---
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 64 +++++++++++++++++++++++++++++------
 1 file changed, 54 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index 1b44b9e21ad868e6454b9140284cc7ebedc4f59a..b7166a883b018f459caae742e9a589f32167f8d2 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -1250,6 +1250,56 @@ static int a6xx_gmu_secure_init(struct a6xx_gpu *a6xx_gpu)
 	return 0;
 }
 
+static int a6xx_gmu_gxpd_get(struct a6xx_gmu *gmu)
+{
+	struct a6xx_gpu *a6xx_gpu = container_of(gmu, struct a6xx_gpu, gmu);
+	struct adreno_gpu *adreno_gpu = &a6xx_gpu->base;
+
+	if (IS_ERR_OR_NULL(gmu->gxpd))
+		return 0;
+
+	/*
+	 * On A8xx HW, GX GDSC is moved to a new clk controller block under GX
+	 * power domain. The clock driver for this new block keeps the GX rail
+	 * voted when gxpd is voted. So, use the gxpd only during gpu recovery.
+	 */
+	if (adreno_gpu->info->family >= ADRENO_8XX_GEN1)
+		return 0;
+
+	/*
+	 * On A6x/A7x, "enable" the GX power domain which won't actually do
+	 * anything but it will make sure that the refcounting is correct in
+	 * case we need to bring down the GX after a GMU failure
+	 */
+	return pm_runtime_get_sync(gmu->gxpd);
+}
+
+static int a6xx_gmu_gxpd_put(struct a6xx_gmu *gmu)
+{
+	struct a6xx_gpu *a6xx_gpu = container_of(gmu, struct a6xx_gpu, gmu);
+	struct adreno_gpu *adreno_gpu = &a6xx_gpu->base;
+
+	if (IS_ERR_OR_NULL(gmu->gxpd))
+		return 0;
+
+	if (adreno_gpu->info->family < ADRENO_8XX_GEN1)
+		return pm_runtime_put_sync(gmu->gxpd);
+
+	/*
+	 * On A8x, GX GDSC collapse should be triggered only when it is stuck ON
+	 */
+	if (adreno_gpu->funcs->gx_is_on(adreno_gpu)) {
+		pm_runtime_get_sync(gmu->gxpd);
+		/*
+		 * Hint to gfxclkctl driver to do a hw collapse during the next
+		 * RPM PUT. This is a special behavior in the gfxclkctl driver
+		 */
+		dev_pm_genpd_synced_poweroff(gmu->gxpd);
+		pm_runtime_put_sync(gmu->gxpd);
+	}
+
+	return 0;
+}
 
 int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
 {
@@ -1266,13 +1316,7 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
 	/* Turn on the resources */
 	pm_runtime_get_sync(gmu->dev);
 
-	/*
-	 * "enable" the GX power domain which won't actually do anything but it
-	 * will make sure that the refcounting is correct in case we need to
-	 * bring down the GX after a GMU failure
-	 */
-	if (!IS_ERR_OR_NULL(gmu->gxpd))
-		pm_runtime_get_sync(gmu->gxpd);
+	a6xx_gmu_gxpd_get(gmu);
 
 	/* Use a known rate to bring up the GMU */
 	clk_set_rate(gmu->core_clk, 200000000);
@@ -1339,7 +1383,8 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
 disable_clk:
 	clk_bulk_disable_unprepare(gmu->nr_clocks, gmu->clocks);
 rpm_put:
-	pm_runtime_put(gmu->gxpd);
+	a6xx_gmu_gxpd_put(gmu);
+
 	pm_runtime_put(gmu->dev);
 
 	return ret;
@@ -1455,8 +1500,7 @@ int a6xx_gmu_stop(struct a6xx_gpu *a6xx_gpu)
 	 * domain. Usually the GMU does this but only if the shutdown sequence
 	 * was successful
 	 */
-	if (!IS_ERR_OR_NULL(gmu->gxpd))
-		pm_runtime_put_sync(gmu->gxpd);
+	a6xx_gmu_gxpd_put(gmu);
 
 	clk_bulk_disable_unprepare(gmu->nr_clocks, gmu->clocks);
 

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/6] clk: qcom: gdsc: Add custom disable callback for GX GDSC
  2026-04-27  6:38 ` [PATCH v2 1/6] clk: qcom: gdsc: Add custom disable callback for GX GDSC Taniya Das
@ 2026-04-27 13:13   ` Konrad Dybcio
  2026-04-28  5:05   ` Claude review: " Claude Code Review Bot
  1 sibling, 0 replies; 18+ messages in thread
From: Konrad Dybcio @ 2026-04-27 13:13 UTC (permalink / raw)
  To: Taniya Das, Bjorn Andersson, Michael Turquette, Stephen Boyd,
	Abel Vesa, Rob Clark, Sean Paul, Konrad Dybcio, Akhil P Oommen,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Marijn Suijten,
	David Airlie, Simona Vetter
  Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
	linux-clk, linux-kernel, dri-devel, freedreno

On 4/27/26 8:38 AM, Taniya Das wrote:
> From: Jagadeesh Kona <jagadeesh.kona@oss.qualcomm.com>
> 
> The GX GDSC is a special power domain that should only be disabled
> by OS during GMU recovery. In all other scenarios, the GMU firmware
> is responsible for handling its disable sequence, and OS must not
> interfere.
> 
> During the resume_noirq() phase of system resume, the GenPD framework
> enables all power domains and later disables them in the complete()
> phase if there are no active votes from OS. This behavior can
> incorrectly disable the GX GDSC while the GMU firmware is still using
> it.
> 
> To prevent this, implement a custom disable callback for GX GDSC that
> relies on GenPD’s synced_poweroff flag. The GMU driver sets this flag
> only during recovery, allowing OS to explicitly disable GX GDSC in
> hardware in that case. In all other situations, the disable callback
> will avoid touching GX GDSC hardware.
> 
> Signed-off-by: Jagadeesh Kona <jagadeesh.kona@oss.qualcomm.com>
> Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
> ---

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 4/6] clk: qcom: gxclkctl: Remove GX/GMxC rail votes to align with IFPC
  2026-04-27  6:38 ` [PATCH v2 4/6] clk: qcom: gxclkctl: Remove GX/GMxC rail votes to align with IFPC Taniya Das
@ 2026-04-27 13:14   ` Konrad Dybcio
  2026-04-28  5:05   ` Claude review: " Claude Code Review Bot
  1 sibling, 0 replies; 18+ messages in thread
From: Konrad Dybcio @ 2026-04-27 13:14 UTC (permalink / raw)
  To: Taniya Das, Bjorn Andersson, Michael Turquette, Stephen Boyd,
	Abel Vesa, Rob Clark, Sean Paul, Konrad Dybcio, Akhil P Oommen,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Marijn Suijten,
	David Airlie, Simona Vetter
  Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
	linux-clk, linux-kernel, dri-devel, freedreno

On 4/27/26 8:38 AM, Taniya Das wrote:
> The GX GDSC control is handled through a dedicated clock controller,
> and the enable/disable sequencing depends on correct rail voting.
> The driver votes for the GX/GMxC rails and CX GDSC before toggling
> the GX GDSC. Currently, during GMU runtime PM resume, rails remain
> enabled due to upstream votes propagated via RPM-enabled devlinks
> and explicit pm_runtime votes on GX GDSC.
> 
> This is not an expected behaviour of IFPC(Inter Frame Power Collapse)
> requirements of GPU as GMU firmware is expected to control these rails,
> except during the GPU/GMU recovery via the OS and that is where the GX
> GDSC should be voting for the rails (GX/GMxC and CX GDSC) before
> toggling the GX GDSC.
> 
> Thus, disable runtime PM after successfully registering the clock
> controller.
> 
> Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
> ---

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 6/6] drm/msm/a6xx: Limit GXPD votes to recovery in A8x
  2026-04-27  6:39 ` [PATCH v2 6/6] drm/msm/a6xx: Limit GXPD votes to recovery in A8x Taniya Das
@ 2026-04-27 13:17   ` Konrad Dybcio
  2026-04-28  5:05   ` Claude review: " Claude Code Review Bot
  1 sibling, 0 replies; 18+ messages in thread
From: Konrad Dybcio @ 2026-04-27 13:17 UTC (permalink / raw)
  To: Taniya Das, Bjorn Andersson, Michael Turquette, Stephen Boyd,
	Abel Vesa, Rob Clark, Sean Paul, Konrad Dybcio, Akhil P Oommen,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Marijn Suijten,
	David Airlie, Simona Vetter
  Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
	linux-clk, linux-kernel, dri-devel, freedreno

On 4/27/26 8:39 AM, Taniya Das wrote:
> From: Akhil P Oommen <akhilpo@oss.qualcomm.com>
> 
> In A8x GPUs, the GX GDSC is moved to a separate block called GXCLKCTL
> which is under the GX power domain. Due to the way the support for this
> block is implemented in its driver, pm_runtime votes result in a vote on
> GX/GMxC/MxC rails from the APPS RSC. This is against the Adreno
> architecture which require GMU to be the sole voter of these collapsible
> rails on behalf of GPU, except during the GPU/GMU recovery.
> 
> To align with this architectural requirement and to realize the power
> benefits of the IFPC feature, remove the GXPD votes during gmu resume
> and suspend. And during the recovery sequence, enable/disable the GXPD
> along with the 'synced_poweroff' genpd hint to force collapse this GDSC.
> 
> Signed-off-by: Akhil P Oommen <akhilpo@oss.qualcomm.com>
> Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
> ---

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 3/6] clk: qcom: common: ensure runtime PM suspend completes on probe
  2026-04-27  6:38 ` [PATCH v2 3/6] clk: qcom: common: ensure runtime PM suspend completes on probe Taniya Das
@ 2026-04-27 13:17   ` Konrad Dybcio
  2026-04-28  5:05   ` Claude review: " Claude Code Review Bot
  1 sibling, 0 replies; 18+ messages in thread
From: Konrad Dybcio @ 2026-04-27 13:17 UTC (permalink / raw)
  To: Taniya Das, Bjorn Andersson, Michael Turquette, Stephen Boyd,
	Abel Vesa, Rob Clark, Sean Paul, Konrad Dybcio, Akhil P Oommen,
	Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Marijn Suijten,
	David Airlie, Simona Vetter
  Cc: Ajit Pandey, Imran Shaik, Jagadeesh Kona, linux-arm-msm,
	linux-clk, linux-kernel, dri-devel, freedreno

On 4/27/26 8:38 AM, Taniya Das wrote:
> When the clock controller is probed with 'use_rpm' enabled, the
> runtime PM reference is currently released using pm_runtime_put(),
> which may return before the runtime suspend has completed. When the
> clock controller device is registered through this function, calling
> pm_runtime_disable() immediately after pm_runtime_put() prevents
> the runtime suspend from completing, leaving the clock controller
> active and the HW rails in the ON state.
> 
> Use pm_runtime_put_sync() instead to ensure the runtime PM “putV
> completes synchronously during probe. This does not have any functional
> impact, but it guarantees that the device is fully runtime-suspended
> before returning.
> 
> Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
> ---

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Claude review: qcom: Refactor GPU GX GDSC handling and IFPC behavior on A8x GPUs
  2026-04-27  6:38 [PATCH v2 0/6] qcom: Refactor GPU GX GDSC handling and IFPC behavior on A8x GPUs Taniya Das
                   ` (5 preceding siblings ...)
  2026-04-27  6:39 ` [PATCH v2 6/6] drm/msm/a6xx: Limit GXPD votes to recovery in A8x Taniya Das
@ 2026-04-28  5:05 ` Claude Code Review Bot
  6 siblings, 0 replies; 18+ messages in thread
From: Claude Code Review Bot @ 2026-04-28  5:05 UTC (permalink / raw)
  To: dri-devel-reviews

Overall Series Review

Subject: qcom: Refactor GPU GX GDSC handling and IFPC behavior on A8x GPUs
Author: Taniya Das <taniya.das@oss.qualcomm.com>
Patches: 11
Reviewed: 2026-04-28T15:05:23.093289

---

This is a well-structured 6-patch series addressing two related power management issues on Qualcomm A8x GPUs: (1) GX GDSC being incorrectly disabled by the OS during runtime/system PM flows, and (2) unintended GX/GMxC rail votes from the APPS RSC conflicting with IFPC architecture requirements. The cover letter clearly explains both problems and the solutions.

The clock-side patches (1-4) are clean and well-scoped. The DRM patches (5-6) are reasonable but have a few issues worth discussing, particularly around error handling and the asymmetry of the new gxpd_get/put helpers. The series has cross-subsystem dependencies (clk and drm/msm) that need coordinated merging.

**Nit in the cover letter commit text:** "resolves" should be "resolve" to maintain parallel verb form in the final paragraph.

---

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Claude review: clk: qcom: gdsc: Add custom disable callback for GX GDSC
  2026-04-27  6:38 ` [PATCH v2 1/6] clk: qcom: gdsc: Add custom disable callback for GX GDSC Taniya Das
  2026-04-27 13:13   ` Konrad Dybcio
@ 2026-04-28  5:05   ` Claude Code Review Bot
  1 sibling, 0 replies; 18+ messages in thread
From: Claude Code Review Bot @ 2026-04-28  5:05 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Author:** Jagadeesh Kona

This patch adds `gdsc_gx_disable()` which mirrors the existing `gdsc_gx_do_nothing_enable()` pattern. The logic is:
- If `synced_poweroff` is set (recovery), allow the real `gdsc_disable()` path.
- Otherwise, only disable the regulator supply and skip HW toggling.

```c
+int gdsc_gx_disable(struct generic_pm_domain *domain)
+{
+	struct gdsc *sc = domain_to_gdsc(domain);
+
+	if (domain->synced_poweroff)
+		return gdsc_disable(domain);
+
+	/* Remove parent-supply placed in enable */
+	if (sc->rsupply)
+		return regulator_disable(sc->rsupply);
+
+	return 0;
+}
```

This looks correct and symmetric with `gdsc_gx_do_nothing_enable()`, which does `regulator_enable(sc->rsupply)`. The `synced_poweroff` flag is a clean GenPD mechanism for communicating the recovery intent.

No issues found.

---

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Claude review: clk: qcom: gxclkctl: Use custom disable callback for gx_gdsc
  2026-04-27  6:38 ` [PATCH v2 2/6] clk: qcom: gxclkctl: Use custom disable callback for gx_gdsc Taniya Das
@ 2026-04-28  5:05   ` Claude Code Review Bot
  0 siblings, 0 replies; 18+ messages in thread
From: Claude Code Review Bot @ 2026-04-28  5:05 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Author:** Taniya Das

Single-line change wiring the new callback:

```c
 	.pd = {
 		.name = "gx_clkctl_gx_gdsc",
 		.power_on = gdsc_gx_do_nothing_enable,
+		.power_off = gdsc_gx_disable,
 	},
```

This is the correct fix for the reported issue. It has proper `Reported-by`, `Closes`, `Fixes`, and `Reviewed-by` tags.

No issues found.

---

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Claude review: clk: qcom: common: ensure runtime PM suspend completes on probe
  2026-04-27  6:38 ` [PATCH v2 3/6] clk: qcom: common: ensure runtime PM suspend completes on probe Taniya Das
  2026-04-27 13:17   ` Konrad Dybcio
@ 2026-04-28  5:05   ` Claude Code Review Bot
  1 sibling, 0 replies; 18+ messages in thread
From: Claude Code Review Bot @ 2026-04-28  5:05 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Author:** Taniya Das

```c
-		pm_runtime_put(dev);
+		pm_runtime_put_sync(dev);
```

The commit message has a minor formatting artifact: `"putV` appears to be a copy-paste error for `"put"`. Otherwise the change is straightforward and the rationale is sound -- the async `pm_runtime_put()` can race with a subsequent `pm_runtime_disable()` called by the gxclkctl probe in patch 4.

**Minor concern:** This is a generic change to `qcom_cc_really_probe()` which affects all Qualcomm clock controllers using `use_rpm`, not just gxclkctl. The commit message says "This does not have any functional impact" but `pm_runtime_put_sync()` will block in probe, which could add latency for all qcom clock controllers. This deserves a comment from the clock maintainers about whether the broader impact is acceptable, or whether this change should be scoped to gxclkctl only.

Note also that `put_rpm:` is used for both the success path and the error path. On the error path, synchronous completion may not matter. On the success path for other clock controllers, blocking unnecessarily could delay boot.

---

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Claude review: clk: qcom: gxclkctl: Remove GX/GMxC rail votes to align with IFPC
  2026-04-27  6:38 ` [PATCH v2 4/6] clk: qcom: gxclkctl: Remove GX/GMxC rail votes to align with IFPC Taniya Das
  2026-04-27 13:14   ` Konrad Dybcio
@ 2026-04-28  5:05   ` Claude Code Review Bot
  1 sibling, 0 replies; 18+ messages in thread
From: Claude Code Review Bot @ 2026-04-28  5:05 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Author:** Taniya Das

```c
 static int gx_clkctl_kaanapali_probe(struct platform_device *pdev)
 {
-	return qcom_cc_probe(pdev, &gx_clkctl_kaanapali_desc);
+	int ret;
+
+	ret = qcom_cc_probe(pdev, &gx_clkctl_kaanapali_desc);
+	if (ret)
+		return ret;
+
+	pm_runtime_disable(&pdev->dev);
+
+	return ret;
+}
```

The `return ret;` at the end is fine since `ret` is 0 at that point, but `return 0;` would be more idiomatic and clearer, since the error case already returned above.

**Ordering concern:** This patch depends on patch 3. If `pm_runtime_put()` inside `qcom_cc_probe()` returns before the runtime suspend callback completes (the async case), then calling `pm_runtime_disable()` here could prevent the pending suspend from ever completing. Patch 3 ensures the put is synchronous, making this safe. The dependency should be noted in the commit message since these must be applied together.

The approach of disabling runtime PM post-probe is a reasonable way to prevent devlink-propagated runtime PM transitions from reaching the gxclkctl device.

---

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Claude review: drm/msm/a8xx: Make a8xx_recover IFPC safe
  2026-04-27  6:38 ` [PATCH v2 5/6] drm/msm/a8xx: Make a8xx_recover IFPC safe Taniya Das
@ 2026-04-28  5:05   ` Claude Code Review Bot
  0 siblings, 0 replies; 18+ messages in thread
From: Claude Code Review Bot @ 2026-04-28  5:05 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Author:** Akhil P Oommen

```c
-	if (hang_debug)
-		a8xx_dump(gpu);
...
-	/* Halt SQE first */
-	gpu_write(gpu, REG_A8XX_CP_SQE_CNTL, 3);
+	if (adreno_gpu->funcs->gx_is_on(adreno_gpu)) {
+		/*
+		 * Sometimes crashstate capture is skipped, so SQE should be
+		 * halted here again
+		 */
+		gpu_write(gpu, REG_A8XX_CP_SQE_CNTL, 3);
+
+		if (hang_debug)
+			a8xx_dump(gpu);
+	}
```

This guards GX-domain MMIO accesses behind a `gx_is_on()` check, matching what `a6xx_recover()` already does. This is important because if GX has already collapsed via IFPC, accessing GX MMIO would be invalid.

Note the SQE halt and dump are now skipped when GX is off, which means we lose debug information in that case. The comment acknowledges this ("Sometimes crashstate capture is skipped"). This is an acceptable tradeoff since the alternative is a bus fault.

**Question for the author:** In `a6xx_recover()`, `adreno_dump_info()` is also guarded by the `gx_is_on()` check. Here it remains unguarded. Does `adreno_dump_info()` also access GX-domain MMIO on A8xx, or is it safe to call unconditionally?

No blocking issues.

---

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Claude review: drm/msm/a6xx: Limit GXPD votes to recovery in A8x
  2026-04-27  6:39 ` [PATCH v2 6/6] drm/msm/a6xx: Limit GXPD votes to recovery in A8x Taniya Das
  2026-04-27 13:17   ` Konrad Dybcio
@ 2026-04-28  5:05   ` Claude Code Review Bot
  1 sibling, 0 replies; 18+ messages in thread
From: Claude Code Review Bot @ 2026-04-28  5:05 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Author:** Akhil P Oommen

This is the largest and most complex patch. It introduces `a6xx_gmu_gxpd_get()` and `a6xx_gmu_gxpd_put()` helpers that behave differently for A8x vs older generations.

**`a6xx_gmu_gxpd_get()`:**
```c
+	if (adreno_gpu->info->family >= ADRENO_8XX_GEN1)
+		return 0;
+	return pm_runtime_get_sync(gmu->gxpd);
```

For A8x, this is a no-op. For older gens, it does the existing `pm_runtime_get_sync()`.

**`a6xx_gmu_gxpd_put()`:**
```c
+	if (adreno_gpu->info->family < ADRENO_8XX_GEN1)
+		return pm_runtime_put_sync(gmu->gxpd);
+
+	if (adreno_gpu->funcs->gx_is_on(adreno_gpu)) {
+		pm_runtime_get_sync(gmu->gxpd);
+		dev_pm_genpd_synced_poweroff(gmu->gxpd);
+		pm_runtime_put_sync(gmu->gxpd);
+	}
```

For A8x during the "put" path, if GX is still on, it does a get/synced_poweroff/put sequence to force-collapse the GDSC.

**Issue 1 -- Asymmetric get/put for A8x:** On A8x, `gxpd_get()` is a no-op but `gxpd_put()` may do `pm_runtime_get_sync() + pm_runtime_put_sync()`. This is fine from a refcount perspective since the get/put pair is balanced within `gxpd_put()` itself, but the naming is misleading. The function isn't really a "put" for A8x -- it's "force-collapse GX if it's still on". Consider a comment or renaming.

**Issue 2 -- Error path in `a6xx_gmu_resume()`:** The error path at `rpm_put:` now calls:
```c
+	a6xx_gmu_gxpd_put(gmu);
```
For A8x, if GX happens to be on during this error path, `gxpd_put()` will do a `pm_runtime_get_sync()` + `dev_pm_genpd_synced_poweroff()` + `pm_runtime_put_sync()`. This seems overly aggressive for a probe/resume error path. In the original code, this error path called `pm_runtime_put(gmu->gxpd)` which just dropped the refcount obtained earlier. Since `gxpd_get()` is now a no-op on A8x, the error path should also be a no-op -- the force-collapse logic is only appropriate for the `a6xx_gmu_stop()` shutdown path. This could cause unexpected behavior on the error path.

**Issue 3 -- Return value of `a6xx_gmu_gxpd_get()`:** On pre-A8x, `pm_runtime_get_sync()` can return a positive value on success or a negative error. The existing code at the call site in `a6xx_gmu_resume()` doesn't check the return value (it didn't before either), so this is a pre-existing issue, not introduced by this patch.

**Issue 4 -- Removed blank line:** There's a removed blank line between the end of `gdsc_gx_do_nothing_enable` export and the new functions:
```c
 }
 EXPORT_SYMBOL_GPL(gdsc_gx_do_nothing_enable);
+
+static int a6xx_gmu_gxpd_get(...)
```
Wait, that's in gdsc.c (patch 1). In patch 6, there's also a stray blank line removal:
```c
-
 
 int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
```
This looks like an extra blank line was removed, which is fine.

**Issue 5 -- Stop path change:** In `a6xx_gmu_stop()`, the original code had:
```c
	if (!IS_ERR_OR_NULL(gmu->gxpd))
		pm_runtime_put_sync(gmu->gxpd);
```
The new `a6xx_gmu_gxpd_put()` already checks `IS_ERR_OR_NULL(gmu->gxpd)`, so this is functionally equivalent for pre-A8x. For A8x, the stop path now does the force-collapse dance, which is the intended behavior during recovery (since `a6xx_gmu_stop()` is called from the recovery path when `gmu->hung` is true).

Overall the design intent is sound, but the error-path behavior in resume deserves closer attention to ensure `gxpd_put()` on A8x doesn't do the force-collapse when it shouldn't.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2026-04-28  5:05 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-27  6:38 [PATCH v2 0/6] qcom: Refactor GPU GX GDSC handling and IFPC behavior on A8x GPUs Taniya Das
2026-04-27  6:38 ` [PATCH v2 1/6] clk: qcom: gdsc: Add custom disable callback for GX GDSC Taniya Das
2026-04-27 13:13   ` Konrad Dybcio
2026-04-28  5:05   ` Claude review: " Claude Code Review Bot
2026-04-27  6:38 ` [PATCH v2 2/6] clk: qcom: gxclkctl: Use custom disable callback for gx_gdsc Taniya Das
2026-04-28  5:05   ` Claude review: " Claude Code Review Bot
2026-04-27  6:38 ` [PATCH v2 3/6] clk: qcom: common: ensure runtime PM suspend completes on probe Taniya Das
2026-04-27 13:17   ` Konrad Dybcio
2026-04-28  5:05   ` Claude review: " Claude Code Review Bot
2026-04-27  6:38 ` [PATCH v2 4/6] clk: qcom: gxclkctl: Remove GX/GMxC rail votes to align with IFPC Taniya Das
2026-04-27 13:14   ` Konrad Dybcio
2026-04-28  5:05   ` Claude review: " Claude Code Review Bot
2026-04-27  6:38 ` [PATCH v2 5/6] drm/msm/a8xx: Make a8xx_recover IFPC safe Taniya Das
2026-04-28  5:05   ` Claude review: " Claude Code Review Bot
2026-04-27  6:39 ` [PATCH v2 6/6] drm/msm/a6xx: Limit GXPD votes to recovery in A8x Taniya Das
2026-04-27 13:17   ` Konrad Dybcio
2026-04-28  5:05   ` Claude review: " Claude Code Review Bot
2026-04-28  5:05 ` Claude review: qcom: Refactor GPU GX GDSC handling and IFPC behavior on A8x GPUs Claude Code Review Bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox