From patchwork Tue Mar 22 15:08:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 8643641 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C3589C0553 for ; Tue, 22 Mar 2016 15:10:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E68352037C for ; Tue, 22 Mar 2016 15:10:28 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B1C68202FE for ; Tue, 22 Mar 2016 15:10:24 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aiNvG-0002IB-9w; Tue, 22 Mar 2016 15:08:42 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aiNvC-0002Dc-5f; Tue, 22 Mar 2016 15:08:39 +0000 Received: by mail-wm0-x244.google.com with SMTP id u125so4373154wmg.0; Tue, 22 Mar 2016 08:08:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=if621pHzzV1ibMpSu/Il6JVM0jTKrSmcaz0DuLTcPPU=; b=SeAcBF19gvBq+lh0AJ0IQsGq6x1vBMPrD3rCPeH2/6ybure1v4BKB/gnIJS2dKJ09k MgRA2/WWKI+lGVe+/qogjIM/dtS1sV+RYmQ6OP8/eZDoolEFTWF0wb8JLjZL1mh5YmuJ UgeLKlreal+pfO05/2DNdIGehesMdv5NEGmqpC6w7qw46di38e+yI1n7AttzxABykIUu JmxECY+2GuiNXt5DDC7oVrM51Zx9oNa0ROeSLZllMqyzzYbkMQP/o7LtNTfVu+E81d9V Qad3FxJAtHxXrFCM/VsqTfsbGgtW3TyS4Vg/RS5yjJmnNk3VcqonPbKfPq37d9zvIgr5 SBiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=if621pHzzV1ibMpSu/Il6JVM0jTKrSmcaz0DuLTcPPU=; b=cjkPIbhd2xhIK9sEW5yBINULLlqU7D1Ys3g4qky83Z9WWJryeE6gxhRt2bbYc3nlKU OYyO/BZno/ICaETnqggL0rlOyvO/nPldjwCc6W0un5K6M19mX0ui3Mu4qBqqL17Xq+NB WQTW1/POoEFbHNqSSWptAUpO7LNaOIyTiU0edDm6faaUAlHdRGsD0SWCJwA6V2EPY2nn Kqicmyx/GW0ksqzZUW2paJBO9nmg3mXPnVzbgX4AlVQe1tyi3pqcpFF4oS9/881UuxEY lwflyKRwmmFmZmAahN8M9JHpClkrNbF9f+asW7pPmRwSPVaa/eYDjIbr2nYVHbIp9ElK 6/Jg== X-Gm-Message-State: AD7BkJLPeAbav9Z4UWmUQZYvMpYdwSnIcn7XlYGVxZmGD+TwU9T97wPc3/wpQg0L1bv8WA== X-Received: by 10.28.88.81 with SMTP id m78mr21470471wmb.58.1458659294532; Tue, 22 Mar 2016 08:08:14 -0700 (PDT) Received: from cizrna.lan ([109.72.12.28]) by smtp.gmail.com with ESMTPSA id t7sm30728473wjf.39.2016.03.22.08.08.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Mar 2016 08:08:13 -0700 (PDT) From: Tomeu Vizoso To: linux-kernel@vger.kernel.org Subject: [PATCH v2] drm/rockchip: vop: Disable planes when disabling CRTC Date: Tue, 22 Mar 2016 16:08:04 +0100 Message-Id: <1458659284-14039-1-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.5.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160322_080838_454223_69A77E7F X-CRM114-Status: GOOD ( 11.88 ) X-Spam-Score: -2.4 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , Tomeu Vizoso , David Airlie , dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Mark Yao MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When a VOP is re-enabled, it will start scanning right away the framebuffers that were configured from the last time, even if those have been destroyed already. To prevent the VOP from trying to access freed memory, disable all its windows when the CRTC is being disabled, then each window will get a valid framebuffer address before it's enabled again. Signed-off-by: Tomeu Vizoso Link: http://lkml.kernel.org/g/CAAObsKAv+05ih5U+=4kic_NsjGMhfxYheHR8xXXmacZs+p5SHw@mail.gmail.com --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 5e57f5b2e4b0..e2118e62345b 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -499,10 +499,25 @@ err_disable_hclk: static void vop_crtc_disable(struct drm_crtc *crtc) { struct vop *vop = to_vop(crtc); + int i; if (!vop->is_enabled) return; + /* + * We need to make sure that all windows are disabled before we + * disable that crtc. Otherwise we might try to scan from a destroyed + * buffer later. + */ + for (i = 0; i < vop->data->win_size; i++) { + struct vop_win *vop_win = &vop->win[i]; + const struct vop_win_data *win = vop_win->data; + + spin_lock(&vop->reg_lock); + VOP_WIN_SET(vop, win, enable, 0); + spin_unlock(&vop->reg_lock); + } + drm_crtc_vblank_off(crtc); /*