From patchwork Tue Jun 12 12:15:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Heiko_St=C3=BCbner?= X-Patchwork-Id: 10460123 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DDAC8602A0 for ; Tue, 12 Jun 2018 12:16:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8B4128717 for ; Tue, 12 Jun 2018 12:16:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD68B2872E; Tue, 12 Jun 2018 12:16:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4A07E28717 for ; Tue, 12 Jun 2018 12:16:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=KyV67BTZIlarWtqzSoJLiq0Td6MVHn403v1g2gYrbZw=; b=D2vTfvbSUveZWpKGihpS2nyWpK sYeJfzlQ+XmlPQZJ5J096+WZOMWqQ0RbyTnuROmMDyiWctqaSD89PWUVJglM6yf0Z3aQqcDK+TIAv elqiqfUEqfS5i14Ym75qEdwHAuMwFa8yVfASIkDG2PY+MWRKCgSFH61DY7j+MedX6HXr7MiXs2p19 qtpms+sCT8TXelPedEwSOoNUCbOIGwAu02Tz7nDT1XQ88JP8oF69HD9qR2PWbdvaHYDr+7E6P36mp qWSlJGJQJ7gWok/sM93kOrOijSmGv63plp6aMiXCZLA7hgMzIfzhuDV0hZRpog9TeX/WcxxMEvO8H LDNfxoKw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fSiDb-0004u5-Jr; Tue, 12 Jun 2018 12:16:11 +0000 Received: from gloria.sntech.de ([95.129.55.99]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fSiDV-0004nN-0k for linux-rockchip@lists.infradead.org; Tue, 12 Jun 2018 12:16:08 +0000 Received: from wd0830.dip.tu-dresden.de ([141.76.111.62] helo=phil.dip.tu-dresden.de) by gloria.sntech.de with esmtpsa (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1fSiDF-0000De-Ju; Tue, 12 Jun 2018 14:15:49 +0200 From: Heiko Stuebner To: dri-devel@lists.freedesktop.org Subject: [PATCH v3 2/2] drm/rockchip: vop: fix irq disabled after vop driver probed Date: Tue, 12 Jun 2018 14:15:37 +0200 Message-Id: <20180612121537.31223-3-heiko@sntech.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180612121537.31223-1-heiko@sntech.de> References: <20180612121537.31223-1-heiko@sntech.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180612_051605_269014_F25E16E0 X-CRM114-Status: GOOD ( 20.54 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , marc.zyngier@arm.com, robin.murphy@arm.com, jeffy.chen@rock-chips.com, hjc@rock-chips.com, stable@vger.kernel.org, tfiga@chromium.org, linux-rockchip@lists.infradead.org, enric.balletbo@collabora.co.uk, tomeu.vizoso@collabora.co.uk, ezequiel@collabora.com MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sandy Huang 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()") Cc: stable@vger.kernel.org Signed-off-by: Sandy Huang Signed-off-by: Heiko Stuebner Tested-by: Ezequiel Garcia Reviewed-by: Tomasz Figa --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 28 ++++++++++++++------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 9a1f272e41c7..ae8a69793aed 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -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: