Skip to contentSkip to conversation

drm/rockchip: try to fix vblank hang resulting from iommu irq change

PATCH Superseded Heiko Stuebner 4 participants 8 messages Jun 12, 2018 – Jun 18, 2018 1 message not in the archive

Subsystems (5)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Heiko Stuebner

author maintainer
#0 lore raw

v3 cover drm/rockchip: try to fix vblank hang resulting from iommu irq change

This still tries to address the hang seen by Ezequiel Garcia on rk3288.

As Tomasz noted, trying to count enablement can run into concurrency issues, so instead we'll just check if the vop is runtime-enabled to see if it could be the source of the irq and then just do our own clk_enable in the isr to bridge the possible gap between pm_runtime_enable and clk_enable in the core vop_enable() function.

Display tested to still work on rk3328 and rk3399, but as I don't see the hang from Ezequiel I hope that this fixes it.

changes in v2:
- adapt approach ... don't try to count usage ourself, because of possible concurrency issues with vop enable/disable
changes in v3:
- fix comment in patch2
- add stable+fixes tags

Heiko Stuebner (1):
drm/rockchip: vop: split out core clock enablement into separate
functions

Sandy Huang (1):
drm/rockchip: vop: fix irq disabled after vop driver probed

 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 72 ++++++++++++++-------
 1 file changed, 50 insertions(+), 22 deletions(-)
Signature · 6 lines
2.17.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author maintainer
#1 lore raw

PATCH v3 1/2 drm/rockchip: vop: split out core clock enablement into separate functions

Judging from the iommu code, both the hclk and aclk are necessary for register access. Split them off into separate functions from the regular vop enablement, so that we can use them elsewhere as well.

Fixes d0b912bd4c23 ("iommu/rockchip: Request irqs in rk_iommu_probe()")
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 44 +++++++++++++++------
 1 file changed, 31 insertions(+), 13 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +31 -13
index 2121345a61af..9a1f272e41c7 100644
@@ -486,6 +486,31 @@ static void vop_line_flag_irq_disable(struct vop *vop)
 	spin_unlock_irqrestore(&vop->irq_lock, flags);
 }
 
+static int vop_core_clks_enable(struct vop *vop)
+{
+	int ret;
+
+	ret = clk_enable(vop->hclk);
+	if (ret < 0)
+		return ret;
+
+	ret = clk_enable(vop->aclk);
+	if (ret < 0)
+		goto err_disable_hclk;
+
+	return 0;
+
+err_disable_hclk:
+	clk_disable(vop->hclk);
+	return ret;
+}
+
+static void vop_core_clks_disable(struct vop *vop)
+{
+	clk_disable(vop->aclk);
+	clk_disable(vop->hclk);
+}
+
 static int vop_enable(struct drm_crtc *crtc)
 {
 	struct vop *vop = to_vop(crtc);
@@ -497,17 +522,13 @@ static int vop_enable(struct drm_crtc *crtc)
 		return ret;
 	}
 
-	ret = clk_enable(vop->hclk);
+	ret = vop_core_clks_enable(vop);
 	if (WARN_ON(ret < 0))
 		goto err_put_pm_runtime;
 
 	ret = clk_enable(vop->dclk);
 	if (WARN_ON(ret < 0))
-		goto err_disable_hclk;
-
-	ret = clk_enable(vop->aclk);
-	if (WARN_ON(ret < 0))
-		goto err_disable_dclk;
+		goto err_disable_core;
 
 	/*
 	 * Slave iommu shares power, irq and clock with vop.  It was associated
@@ -519,7 +540,7 @@ static int vop_enable(struct drm_crtc *crtc)
 	if (ret) {
 		DRM_DEV_ERROR(vop->dev,
 			      "failed to attach dma mapping, %d\n", ret);
-		goto err_disable_aclk;
+		goto err_disable_dclk;
 	}
 
 	spin_lock(&vop->reg_lock);
@@ -558,12 +579,10 @@ static int vop_enable(struct drm_crtc *crtc)
 
 	return 0;
 
-err_disable_aclk:
-	clk_disable(vop->aclk);
 err_disable_dclk:
 	clk_disable(vop->dclk);
-err_disable_hclk:
-	clk_disable(vop->hclk);
+err_disable_core:
+	vop_core_clks_disable(vop);
 err_put_pm_runtime:
 	pm_runtime_put_sync(vop->dev);
 	return ret;
@@ -609,8 +628,7 @@ static void vop_crtc_atomic_disable(struct drm_crtc *crtc,
 	rockchip_drm_dma_detach_device(vop->drm_dev, vop->dev);
 
 	clk_disable(vop->dclk);
-	clk_disable(vop->aclk);
-	clk_disable(vop->hclk);
+	vop_core_clks_disable(vop);
 	pm_runtime_put(vop->dev);
 	mutex_unlock(&vop->vop_lock);
 
Signature · 6 lines
2.17.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author maintainer
#2 lore raw

PATCH v3 2/2 drm/rockchip: vop: fix irq disabled after vop driver probed

In reply to Heiko Stuebner

From: Sandy Huang <[email protected]>

The vop irq is shared between vop and iommu and irq probing in the iommu driver moved to the probe function recently. This can in some cases lead to a stall if the irq is triggered while the vop driver still has it disabled, but the vop irq handler gets called.

But there is no real need to disable the irq, as the vop can simply also track its enabled state and ignore irqs in that case. For this we can simply check the power-domain state of the vop, similar to how the iommu driver does it.

So remove the enable/disable handling and add appropriate condition to the irq handler.

changes in v2:
- move to just check the power-domain state
- add clock handling
changes in v3:
- clarify comment to speak of runtime-pm not power-domain

Fixes d0b912bd4c23 ("iommu/rockchip: Request irqs in rk_iommu_probe()")
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 28 ++++++++++++++-------
 1 file changed, 19 insertions(+), 9 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +19 -9
index 9a1f272e41c7..ae8a69793aed 100644
@@ -573,8 +573,6 @@ static int vop_enable(struct drm_crtc *crtc)
 
 	spin_unlock(&vop->reg_lock);
 
-	enable_irq(vop->irq);
-
 	drm_crtc_vblank_on(crtc);
 
 	return 0;
@@ -618,8 +616,6 @@ static void vop_crtc_atomic_disable(struct drm_crtc *crtc,
 
 	vop_dsp_hold_valid_irq_disable(vop);
 
-	disable_irq(vop->irq);
-
 	vop->is_enabled = false;
 
 	/*
@@ -1195,6 +1191,16 @@ static irqreturn_t vop_isr(int irq, void *data)
 	uint32_t active_irqs;
 	int ret = IRQ_NONE;
 
+	/*
+	 * The irq is shared with the iommu. If the runtime-pm state of the
+	 * vop-device is disabled the irq has to be targetted at the iommu.
+	 */
+	if (!pm_runtime_get_if_in_use(vop->dev))
+		return IRQ_NONE;
+
+	if (WARN_ON(vop_core_clks_enable(vop)))
+		goto out;
+
 	/*
 	 * interrupt register has interrupt status, enable and clear bits, we
 	 * must hold irq_lock to avoid a race with enable/disable_vblank().
@@ -1209,8 +1215,11 @@ static irqreturn_t vop_isr(int irq, void *data)
 	spin_unlock(&vop->irq_lock);
 
 	/* This is expected for vop iommu irqs, since the irq is shared */
-	if (!active_irqs)
-		return IRQ_NONE;
+	if (!active_irqs) {
+		ret = IRQ_NONE;
+		vop_core_clks_disable(vop);
+		goto out;
+	}
 
 	if (active_irqs & DSP_HOLD_VALID_INTR) {
 		complete(&vop->dsp_hold_completion);
@@ -1236,6 +1245,10 @@ static irqreturn_t vop_isr(int irq, void *data)
 		DRM_DEV_ERROR(vop->dev, "Unknown VOP IRQs: %#02x\n",
 			      active_irqs);
 
+	vop_core_clks_disable(vop);
+
+out:
+	pm_runtime_put(vop->dev);
 	return ret;
 }
 
@@ -1614,9 +1627,6 @@ static int vop_bind(struct device *dev, struct device *master, void *data)
 	if (ret)
 		goto err_disable_pm_runtime;
 
-	/* IRQ is initially disabled; it gets enabled in power_on */
-	disable_irq(vop->irq);
-
 	return 0;
 
 err_disable_pm_runtime:
Signature · 6 lines
2.17.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

Re: [PATCH v3 2/2] drm/rockchip: vop: fix irq disabled after vop driver probed

Hi Heiko,

Quoted 55 lines · Heiko Stuebner

From: Sandy Huang <[email protected]>

The vop irq is shared between vop and iommu and irq probing in the iommu driver moved to the probe function recently. This can in some cases lead to a stall if the irq is triggered while the vop driver still has it disabled, but the vop irq handler gets called.

But there is no real need to disable the irq, as the vop can simply also track its enabled state and ignore irqs in that case. For this we can simply check the power-domain state of the vop, similar to how the iommu driver does it.

So remove the enable/disable handling and add appropriate condition to the irq handler.

changes in v2:
- move to just check the power-domain state
- add clock handling
changes in v3:
- clarify comment to speak of runtime-pm not power-domain

Fixes d0b912bd4c23 ("iommu/rockchip: Request irqs in rk_iommu_probe()")
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 28 ++++++++++++++-------
 1 file changed, 19 insertions(+), 9 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +0 -4
index 9a1f272e41c7..ae8a69793aed 100644
@@ -573,8 +573,6 @@ static int vop_enable(struct drm_crtc *crtc)
 
 	spin_unlock(&vop->reg_lock);
 
-	enable_irq(vop->irq);
-
 	drm_crtc_vblank_on(crtc);
 
 	return 0;
@@ -618,8 +616,6 @@ static void vop_crtc_atomic_disable(struct drm_crtc *crtc,
 
 	vop_dsp_hold_valid_irq_disable(vop);
 
-	disable_irq(vop->irq);
-
 	vop->is_enabled = false;
 
 	/*
@@ -1195,6 +1191,16 @@ static irqreturn_t vop_isr(int irq, void *data)
 	uint32_t active_irqs;
 	int ret = IRQ_NONE;

drivers/gpu/drm/rockchip/rockchip_drm_vop.c static irqreturn_t vop_isr(int irq, void *data) · line 1202

Quoted 10 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +9 -0
 
+	/*
+	 * The irq is shared with the iommu. If the runtime-pm state of the
+	 * vop-device is disabled the irq has to be targetted at the iommu.
+	 */
+	if (!pm_runtime_get_if_in_use(vop->dev))
+		return IRQ_NONE;
+
+	if (WARN_ON(vop_core_clks_enable(vop)))
+		goto out;

As I mentioned before, a WARN_ON() in an interrupt handler is a good way to make a bad problem even worse, and will give information (full register and stack dump) that is mostly useless to the context at hand. Turning it to a dev_warn_ratelimited() (or DRM_ERROR_RATELIMITED if you want to be DRM compliant) would be a better approach, IMHO.

Quoted 5 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1 -0
+
 	/*
 	 * interrupt register has interrupt status, enable and clear bits, we
 	 * must hold irq_lock to avoid a race with enable/disable_vblank().

drivers/gpu/drm/rockchip/rockchip_drm_vop.c static irqreturn_t vop_isr(int irq, void *data) · line 1222

Quoted 10 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +5 -2
@@ -1209,8 +1215,11 @@ static irqreturn_t vop_isr(int irq, void *data)
 	spin_unlock(&vop->irq_lock);
 
 	/* This is expected for vop iommu irqs, since the irq is shared */
-	if (!active_irqs)
-		return IRQ_NONE;
+	if (!active_irqs) {
+		ret = IRQ_NONE;
+		vop_core_clks_disable(vop);
+		goto out;
+	}

A couple of nits: ret is already set to IRQ_NONE at this stage, and you could simply rewrite it as:

	if (!active_irq)
		goto out_disable;

drivers/gpu/drm/rockchip/rockchip_drm_vop.c static irqreturn_t vop_isr(int irq, void *data) · line 1247

Quoted 7 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +0 -0
 	if (active_irqs & DSP_HOLD_VALID_INTR) {
 		complete(&vop->dsp_hold_completion);
@@ -1236,6 +1245,10 @@ static irqreturn_t vop_isr(int irq, void *data)
 		DRM_DEV_ERROR(vop->dev, "Unknown VOP IRQs: %#02x\n",
 			      active_irqs);
 

with the "out_disable" label placed here.

Quoted 9 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +4 -0
+	vop_core_clks_disable(vop);
+
+out:
+	pm_runtime_put(vop->dev);
 	return ret;
 }
 

drivers/gpu/drm/rockchip/rockchip_drm_vop.c static int vop_bind(struct device *dev, struct device *master, void *data) · line 1632

Quoted 9 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +0 -3
@@ -1614,9 +1627,6 @@ static int vop_bind(struct device *dev, struct device *master, void *data)
 	if (ret)
 		goto err_disable_pm_runtime;
 
-	/* IRQ is initially disabled; it gets enabled in power_on */
-	disable_irq(vop->irq);
-
 	return 0;
 
 err_disable_pm_runtime:

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
author maintainer
#4 lore raw

Re: [PATCH v3 2/2] drm/rockchip: vop: fix irq disabled after vop driver probed

Am Dienstag, 12. Juni 2018, 14:39:03 CEST schrieb Marc Zyngier:

Quoted 59 lines

Hi Heiko,

Quoted 56 lines · Heiko Stuebner

From: Sandy Huang <[email protected]>

The vop irq is shared between vop and iommu and irq probing in the iommu driver moved to the probe function recently. This can in some cases lead to a stall if the irq is triggered while the vop driver still has it disabled, but the vop irq handler gets called.

But there is no real need to disable the irq, as the vop can simply also track its enabled state and ignore irqs in that case. For this we can simply check the power-domain state of the vop, similar to how the iommu driver does it.

So remove the enable/disable handling and add appropriate condition to the irq handler.

changes in v2:
- move to just check the power-domain state
- add clock handling
changes in v3:
- clarify comment to speak of runtime-pm not power-domain

Fixes d0b912bd4c23 ("iommu/rockchip: Request irqs in rk_iommu_probe()")
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 28 ++++++++++++++-------
 1 file changed, 19 insertions(+), 9 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +0 -4
index 9a1f272e41c7..ae8a69793aed 100644
@@ -573,8 +573,6 @@ static int vop_enable(struct drm_crtc *crtc)
 
 	spin_unlock(&vop->reg_lock);
 
-	enable_irq(vop->irq);
-
 	drm_crtc_vblank_on(crtc);
 
 	return 0;
@@ -618,8 +616,6 @@ static void vop_crtc_atomic_disable(struct drm_crtc *crtc,
 
 	vop_dsp_hold_valid_irq_disable(vop);
 
-	disable_irq(vop->irq);
-
 	vop->is_enabled = false;
 
 	/*
@@ -1195,6 +1191,16 @@ static irqreturn_t vop_isr(int irq, void *data)
 	uint32_t active_irqs;
 	int ret = IRQ_NONE;
 
Quoted 15 lines

drivers/gpu/drm/rockchip/rockchip_drm_vop.c static irqreturn_t vop_isr(int irq, void *data) · line 1202

Quoted 9 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +9 -0
+	/*
+	 * The irq is shared with the iommu. If the runtime-pm state of the
+	 * vop-device is disabled the irq has to be targetted at the iommu.
+	 */
+	if (!pm_runtime_get_if_in_use(vop->dev))
+		return IRQ_NONE;
+
+	if (WARN_ON(vop_core_clks_enable(vop)))
+		goto out;

As I mentioned before, a WARN_ON() in an interrupt handler is a good way to make a bad problem even worse, and will give information (full register and stack dump) that is mostly useless to the context at hand. Turning it to a dev_warn_ratelimited() (or DRM_ERROR_RATELIMITED if you want to be DRM compliant) would be a better approach, IMHO.

Gah, sorry that I forgot to address your comment from v2 and thanks for the reminder.

Quoted 19 lines
Quoted 5 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1 -0
+
 	/*
 	 * interrupt register has interrupt status, enable and clear bits, we
 	 * must hold irq_lock to avoid a race with enable/disable_vblank().

drivers/gpu/drm/rockchip/rockchip_drm_vop.c static irqreturn_t vop_isr(int irq, void *data) · line 1222

Quoted 10 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +5 -2
@@ -1209,8 +1215,11 @@ static irqreturn_t vop_isr(int irq, void *data)
 	spin_unlock(&vop->irq_lock);
 
 	/* This is expected for vop iommu irqs, since the irq is shared */
-	if (!active_irqs)
-		return IRQ_NONE;
+	if (!active_irqs) {
+		ret = IRQ_NONE;
+		vop_core_clks_disable(vop);
+		goto out;
+	}

A couple of nits: ret is already set to IRQ_NONE at this stage, and you could simply rewrite it as:

Quoted 2 lines
	if (!active_irq)
		goto out_disable;

That's only one nit :-P ... but will change the patch accordingly.

Heiko

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 20180612121537.31223-3-heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org

#6 lore raw

Re: [PATCH v3 2/2] drm/rockchip: vop: fix irq disabled after vop driver probed

Hi Heiko,

Quoted 6 lines · Heiko Stuebner

From: Sandy Huang <[email protected]>

The vop irq is shared between vop and iommu and irq probing in the iommu driver moved to the probe function recently. This can in some cases lead to a stall if the irq is triggered while the vop driver still has it disabled, but the vop irq handler gets called.

hmmm, i think this patch actually fixes another stall case by removing the unpaired disable_irq() in vop_bind().

if we do disable_irq() in vop_bind() without enable it again in vop_unbind(), the irq_shutdown() called after vop_unbind()(when releasing devres) will confuse the irq depth, so the irq will stay disabled and could never be enabled again.

Quoted 99 lines

But there is no real need to disable the irq, as the vop can simply also track its enabled state and ignore irqs in that case. For this we can simply check the power-domain state of the vop, similar to how the iommu driver does it.

So remove the enable/disable handling and add appropriate condition to the irq handler.

changes in v2:
- move to just check the power-domain state
- add clock handling
changes in v3:
- clarify comment to speak of runtime-pm not power-domain

Fixes d0b912bd4c23 ("iommu/rockchip: Request irqs in rk_iommu_probe()")
---
  drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 28 ++++++++++++++-------
  1 file changed, 19 insertions(+), 9 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +19 -9
index 9a1f272e41c7..ae8a69793aed 100644
@@ -573,8 +573,6 @@ static int vop_enable(struct drm_crtc *crtc)
 
  	spin_unlock(&vop->reg_lock);
 
-	enable_irq(vop->irq);
-
  	drm_crtc_vblank_on(crtc);
 
  	return 0;
@@ -618,8 +616,6 @@ static void vop_crtc_atomic_disable(struct drm_crtc *crtc,
 
  	vop_dsp_hold_valid_irq_disable(vop);
 
-	disable_irq(vop->irq);
-
  	vop->is_enabled = false;
 
  	/*
@@ -1195,6 +1191,16 @@ static irqreturn_t vop_isr(int irq, void *data)
  	uint32_t active_irqs;
  	int ret = IRQ_NONE;
 
+	/*
+	 * The irq is shared with the iommu. If the runtime-pm state of the
+	 * vop-device is disabled the irq has to be targetted at the iommu.
+	 */
+	if (!pm_runtime_get_if_in_use(vop->dev))
+		return IRQ_NONE;
+
+	if (WARN_ON(vop_core_clks_enable(vop)))
+		goto out;
+
  	/*
  	 * interrupt register has interrupt status, enable and clear bits, we
  	 * must hold irq_lock to avoid a race with enable/disable_vblank().
@@ -1209,8 +1215,11 @@ static irqreturn_t vop_isr(int irq, void *data)
  	spin_unlock(&vop->irq_lock);
 
  	/* This is expected for vop iommu irqs, since the irq is shared */
-	if (!active_irqs)
-		return IRQ_NONE;
+	if (!active_irqs) {
+		ret = IRQ_NONE;
+		vop_core_clks_disable(vop);
+		goto out;
+	}
 
  	if (active_irqs & DSP_HOLD_VALID_INTR) {
  		complete(&vop->dsp_hold_completion);
@@ -1236,6 +1245,10 @@ static irqreturn_t vop_isr(int irq, void *data)
  		DRM_DEV_ERROR(vop->dev, "Unknown VOP IRQs: %#02x\n",
  			      active_irqs);
 
+	vop_core_clks_disable(vop);
+
+out:
+	pm_runtime_put(vop->dev);
  	return ret;
  }
 
@@ -1614,9 +1627,6 @@ static int vop_bind(struct device *dev, struct device *master, void *data)
  	if (ret)
  		goto err_disable_pm_runtime;
 
-	/* IRQ is initially disabled; it gets enabled in power_on */
-	disable_irq(vop->irq);
-
  	return 0;
 
  err_disable_pm_runtime:
Reviewed-by on v3 2/2
#7 lore raw

Re: [PATCH v3 2/2] drm/rockchip: vop: fix irq disabled after vop driver probed

In reply to Heiko Stuebner

Hi Heiko,

Quoted 21 lines · Heiko Stuebner

From: Sandy Huang <[email protected]>

The vop irq is shared between vop and iommu and irq probing in the iommu driver moved to the probe function recently. This can in some cases lead to a stall if the irq is triggered while the vop driver still has it disabled, but the vop irq handler gets called.

But there is no real need to disable the irq, as the vop can simply also track its enabled state and ignore irqs in that case. For this we can simply check the power-domain state of the vop, similar to how the iommu driver does it.

So remove the enable/disable handling and add appropriate condition to the irq handler.

changes in v2:
- move to just check the power-domain state
- add clock handling
changes in v3:
- clarify comment to speak of runtime-pm not power-domain

[snip]

drivers/gpu/drm/rockchip/rockchip_drm_vop.c static irqreturn_t vop_isr(int irq, void *data) · line 1220

Quoted 9 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +3 -2
@@ -1209,8 +1215,11 @@ static irqreturn_t vop_isr(int irq, void *data)
        spin_unlock(&vop->irq_lock);
 
        /* This is expected for vop iommu irqs, since the irq is shared */
-       if (!active_irqs)
-               return IRQ_NONE;
+       if (!active_irqs) {
+               ret = IRQ_NONE;
+               vop_core_clks_disable(vop);

nit: If we're adding "out:", couldn't we also add "out_clks:" and move the call to vop_core_clks_disable() there?

Quoted 6 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +2 -0
+               goto out;
+       }
 
        if (active_irqs & DSP_HOLD_VALID_INTR) {
                complete(&vop->dsp_hold_completion);

drivers/gpu/drm/rockchip/rockchip_drm_vop.c static irqreturn_t vop_isr(int irq, void *data) · line 1253

Quoted 9 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +4 -0
@@ -1236,6 +1245,10 @@ static irqreturn_t vop_isr(int irq, void *data)
                DRM_DEV_ERROR(vop->dev, "Unknown VOP IRQs: %#02x\n",
                              active_irqs);
 
+       vop_core_clks_disable(vop);
+
+out:
+       pm_runtime_put(vop->dev);
        return ret;
 }

Other than that:

Best regards,
Tomasz
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#8 lore raw

Re: [PATCH v3 2/2] drm/rockchip: vop: fix irq disabled after vop driver probed

Am Montag, 18. Juni 2018, 10:44:58 CEST schrieb Tomasz Figa:

Quoted 56 lines

Hi Heiko,

Quoted 21 lines · Heiko Stuebner

From: Sandy Huang <[email protected]>

The vop irq is shared between vop and iommu and irq probing in the iommu driver moved to the probe function recently. This can in some cases lead to a stall if the irq is triggered while the vop driver still has it disabled, but the vop irq handler gets called.

But there is no real need to disable the irq, as the vop can simply also track its enabled state and ignore irqs in that case. For this we can simply check the power-domain state of the vop, similar to how the iommu driver does it.

So remove the enable/disable handling and add appropriate condition to the irq handler.

changes in v2:
- move to just check the power-domain state
- add clock handling
changes in v3:
- clarify comment to speak of runtime-pm not power-domain

[snip]

drivers/gpu/drm/rockchip/rockchip_drm_vop.c static irqreturn_t vop_isr(int irq, void *data) · line 1220

Quoted 9 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +3 -2
@@ -1209,8 +1215,11 @@ static irqreturn_t vop_isr(int irq, void *data)
        spin_unlock(&vop->irq_lock);
 
        /* This is expected for vop iommu irqs, since the irq is shared */
-       if (!active_irqs)
-               return IRQ_NONE;
+       if (!active_irqs) {
+               ret = IRQ_NONE;
+               vop_core_clks_disable(vop);

nit: If we're adding "out:", couldn't we also add "out_clks:" and move the call to vop_core_clks_disable() there?

Quoted 6 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +2 -0
+               goto out;
+       }
 
        if (active_irqs & DSP_HOLD_VALID_INTR) {
                complete(&vop->dsp_hold_completion);

drivers/gpu/drm/rockchip/rockchip_drm_vop.c static irqreturn_t vop_isr(int irq, void *data) · line 1253

Quoted 9 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +4 -0
@@ -1236,6 +1245,10 @@ static irqreturn_t vop_isr(int irq, void *data)
                DRM_DEV_ERROR(vop->dev, "Unknown VOP IRQs: %#02x\n",
                              active_irqs);
 
+       vop_core_clks_disable(vop);
+
+out:
+       pm_runtime_put(vop->dev);
        return ret;
 }

Other than that:

Quoted 1 line

That's similar to what Marc suggested and thus already part of v4 posted last tuesday, so I'll just carry over your Reviewed-by.

Could you possibly also give patch1 a nod of approval? So I can honor the strong suggestion in the drm-misc documentation? ;-)

Thanks
Heiko

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel