Received: by 10.192.165.148 with SMTP id m20csp2525059imm; Sun, 22 Apr 2018 08:51:14 -0700 (PDT) X-Google-Smtp-Source: AIpwx48SiyE2zLKmHQfoFs4cJ/cCpkgKHDKOCAxByAb0gNaU1UB+mR6z6Vm3phMweKU4uhUPBQ20 X-Received: by 2002:a17:902:1347:: with SMTP id r7-v6mr13236082ple.62.1524412274586; Sun, 22 Apr 2018 08:51:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524412274; cv=none; d=google.com; s=arc-20160816; b=GDK1i0cXblxUk9ETiTxRiL5sxsKvf/cb8w+LAHCYe9/rI3hqQYVvxlHb00Bw/xvSnm soQO2TC003fyMNVg48n6gzr+Q3syX8b84xojAVv6bnaIiguUXGDqSraVF11ncytE+/M7 kfU5oKuAv2vr1d2FM9Xi5qoIsORLxg6/diaoyMw4c5KRA2be6PjFSoAlnmKW70BSmT85 UK3eq4/e1f7pPqbtntOw54oNExOhCGgKdv+xZ3MdCwL5hRnFQ4nWO5149kZw5jl8Kb/4 DZvhWsYpJJrjto2mCSIJoG5HNSKSC56sGgtJhTXHw0Skmv9VcZ+3T7D+JEwMfATX9ZkZ dK8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=c3SxseKodBxeBRJTg2u3EM2kV1Y0q6CD+uAkMnBF1f4=; b=BDhCdGwhOqESF4bFO6qzHEv4esVASBpZU/bmtxb+ykIT2gglDQ+ACT/O2KGcbOHxQ3 XpAkKJf+8ULJyMzofpokq5RHMCB+s1IQaibORihOyyK0QSKtowIq4M65tXfJS4ZHXPyP rhW8+2yZocFg147tDV3iOSrg9fPHjFTbkA4X3AlOcc5v8xXVXlEF4n7r8v111OZVWmot D/4j2VsAwOG1J2vAN0e5npB4zNHDDogLi1nzFe8ZMEJfZm+Z2JuqgjJwt3RnagZTMfHt 3AZ/2NdfvzG33XHmnEz30jYCjoqRfSJkDqpy7D2Pzs3Nv8cPkbeMxaHd6daV2hULJf3B AUoA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o14si2979367pgf.174.2018.04.22.08.51.00; Sun, 22 Apr 2018 08:51:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754707AbeDVOB2 (ORCPT + 99 others); Sun, 22 Apr 2018 10:01:28 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47934 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754664AbeDVOBW (ORCPT ); Sun, 22 Apr 2018 10:01:22 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 0AEA3C24; Sun, 22 Apr 2018 14:01:21 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Heiko Stuebner Subject: [PATCH 4.16 155/196] drm/rockchip: Clear all interrupts before requesting the IRQ Date: Sun, 22 Apr 2018 15:52:55 +0200 Message-Id: <20180422135112.236961163@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135104.278511750@linuxfoundation.org> References: <20180422135104.278511750@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marc Zyngier commit 5f9e93fed4d45e9a8f84728aff1a8f2ab8922902 upstream. Calling request_irq() followed by disable_irq() is usually a bad idea, specially if the interrupt can be pending, and you're not yet in a position to handle it. This is exactly what happens on my kevin system when rebooting in a second kernel using kexec: Some interrupt is left pending from the previous kernel, and we take it too early, before disable_irq() could do anything. Let's clear the pending interrupts as we initialize the HW, and move the interrupt request after that point. This ensures that we're in a sane state when the interrupt is requested. Cc: stable@vger.kernel.org Signed-off-by: Marc Zyngier [adapted to recent rockchip-drm changes] Signed-off-by: Heiko Stuebner Link: https://patchwork.freedesktop.org/patch/msgid/20180220130120.5254-2-marc.zyngier@arm.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -1414,6 +1414,9 @@ static int vop_initial(struct vop *vop) usleep_range(10, 20); reset_control_deassert(ahb_rst); + VOP_INTR_SET_TYPE(vop, clear, INTR_MASK, 1); + VOP_INTR_SET_TYPE(vop, enable, INTR_MASK, 0); + memcpy(vop->regsbak, vop->regs, vop->len); VOP_REG_SET(vop, misc, global_regdone_en, 1); @@ -1569,17 +1572,9 @@ static int vop_bind(struct device *dev, mutex_init(&vop->vsync_mutex); - ret = devm_request_irq(dev, vop->irq, vop_isr, - IRQF_SHARED, dev_name(dev), vop); - if (ret) - return ret; - - /* IRQ is initially disabled; it gets enabled in power_on */ - disable_irq(vop->irq); - ret = vop_create_crtc(vop); if (ret) - goto err_enable_irq; + return ret; pm_runtime_enable(&pdev->dev); @@ -1590,13 +1585,19 @@ static int vop_bind(struct device *dev, goto err_disable_pm_runtime; } + ret = devm_request_irq(dev, vop->irq, vop_isr, + IRQF_SHARED, dev_name(dev), vop); + 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: pm_runtime_disable(&pdev->dev); vop_destroy_crtc(vop); -err_enable_irq: - enable_irq(vop->irq); /* To balance out the disable_irq above */ return ret; }