Received: by 10.192.165.148 with SMTP id m20csp2482042imm; Sun, 22 Apr 2018 07:59:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx48xSIQCwAYxvjPg2DezxxrTmCU70mYorjfP5uXn28f2hF/0MVos7yW+R9B3EZizI6yb/Aba X-Received: by 10.98.137.218 with SMTP id n87mr16891943pfk.48.1524409141880; Sun, 22 Apr 2018 07:59:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524409141; cv=none; d=google.com; s=arc-20160816; b=sl5SVtzRmxqXosVM/sz+2AzxTOexlIvQphifpga8V07Ed5PwbTHe9k0VLBn2sKLpSs QfYLrdtzWSgXbpkY0VTfaszbrG5PsfuIrjKGs8KlmODJt8ByeaumWpwiRDVCartPJCUc zEBhuMz7I4bLDUDC03JoXzBSKqGFsWiPf66B0Gtis9qujlPqedcC1LQshJWhG+uWB/Zf rGFG73VfhpWJpALRJH9bkzoPWhVrteejm041xJHXhbncK91VJ9ymXtMM0Gvm/4YCSqaY 1vJOff/RE0xwSbV4bfjM8ToqcvuEFeQ5OR1ok3rXvGOhJHMG1eZObXLxzGV1kmiBMw11 8pkQ== 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=qIs3j+CF5P3e+m3AgUjQzhuPUDEc/RCksAvRwdh62as=; b=jIv2DYVyozKKyXkjNbVCJySoPQeNewqn0eCkKI6DpxAy5TUQ0vdqUkMR8E7wv4Sso8 ce0rx57/XY/eayWzFHHlLdf6Flvspu1RBd159sQWS8WfkSKVI/vZfp1eLvd6Ayg/C0kd v7SBkFQuaWmX4ba3npIffu9vnR4+enBAHKOCD+lXGQcqwxuPBvYQMX2L8wKX4XQHuG95 xXGo9SJqVRBZnu+5Udk3bBXNQrIHYuS7wNCFm0CKmmbZq29TSQpzMU3v9f0XGA0wyAvq PGEkMWjaWS5VJUYf0vAf/Fuh2NpdNrTYQ0fUmQfubyjgK7puk6KD7W7RUee80haoh8wy rI3w== 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 k2si8306558pgn.599.2018.04.22.07.58.47; Sun, 22 Apr 2018 07:59:01 -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 S1757231AbeDVO4l (ORCPT + 99 others); Sun, 22 Apr 2018 10:56:41 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:55944 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756700AbeDVONu (ORCPT ); Sun, 22 Apr 2018 10:13:50 -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 977A1CE9; Sun, 22 Apr 2018 14:13:49 +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.9 69/95] drm/rockchip: Clear all interrupts before requesting the IRQ Date: Sun, 22 Apr 2018 15:53:38 +0200 Message-Id: <20180422135213.252429672@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135210.432103639@linuxfoundation.org> References: <20180422135210.432103639@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.9-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 @@ -1386,6 +1386,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); for (i = 0; i < vop_data->table_size; i++) @@ -1541,17 +1544,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); @@ -1561,13 +1556,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; }