From patchwork Tue Jun 6 15:17:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 103167 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp1475722qgd; Tue, 6 Jun 2017 08:17:25 -0700 (PDT) X-Received: by 10.84.209.228 with SMTP id y91mr21863269plh.210.1496762245694; Tue, 06 Jun 2017 08:17:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496762245; cv=none; d=google.com; s=arc-20160816; b=tYh2RpbyOCtSCwdyr7sLFe2QYxg6saFba1uo78MzEGV0iZqOSqmvdC0Pakyy9Gljhk jYA9Y7GTBPbd1dcQ/hZ9RYK1POdknYM8dJJHUdoys9eEPtt9SprnKVrLNW+2pyKoj1cP p5duiS9W93MSRHTU/LHo2jtp66tnhApu+QipZjSLURXzIdup/0NGC5ikz3liF1lLdu0c k0iUOHaUAxj0QhQrFoAPO7U9668k+Cz94hGUTgtmcNk4mN7wdOhexAtPF24f/+3PqSne sxbcFriNB7qepLLIRq/Si9qLvvtbng+ZDuvGsWPO/1Njy4WA70XSL7Qzro5b8puyKSXs DTiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:message-id:date:subject:to:from:delivered-to :arc-authentication-results; bh=x48aBVn5ZAMV7nq7K2YgevNLyR+JGR0jbur2x+Zbi3Y=; b=FyGhAqUvK5XGxNlqf688opPanAfRPGMbLWFvgGR61wiHjwjQ7ohAwPcweHhyXzEw3x Wqo+bkyd9ZXr9zTCFyAjxmRIgdrwH0WFP8mR1xMBqJ7oGIfxTMv4JAd7uUORAUDEGfv8 rzuV8vXDh7ol8kvIZ7HheDEIGj+qNoyVgqGgKNbxtZeNkeGEFz6iHtdHKhaRB0/yJORs i3JpZzngmmnLPvKnaOd3cNGLbwZ/4VDUGnTNaLv2xFYSqB8FftCcFDceSkHfMZVwp8Io pk1CskVO0P1oiMscNzHZUaZwlV55EBqFKZfnLE1MKpznn2233iKqGwfK5ll5P2jRDNCw DlhA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id 89si10212944pld.33.2017.06.06.08.17.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Jun 2017 08:17:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DB8F76E133; Tue, 6 Jun 2017 15:17:24 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2A5BE6E133 for ; Tue, 6 Jun 2017 15:17:23 +0000 (UTC) Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.9]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id v56FHL0A019913; Tue, 6 Jun 2017 16:17:21 +0100 From: Liviu Dudau To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/mali-dp: Check PM status when sharing interrupt lines Date: Tue, 6 Jun 2017 16:17:21 +0100 Message-Id: <20170606151721.31915-1-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.13.0 Cc: Mali DP Maintainers , linux-kernel@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If an instance of Mali DP hardware shares the interrupt line with another hardware (usually another instance of the Mali DP) its interrupt handler can get called when the device is suspended. Check the PM status before making access to the hardware registers to avoid deadlocks. Signed-off-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_hw.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_hw.c b/drivers/gpu/drm/arm/malidp_hw.c index 28360b8542f7..17bca99e8ac8 100644 --- a/drivers/gpu/drm/arm/malidp_hw.c +++ b/drivers/gpu/drm/arm/malidp_hw.c @@ -766,12 +766,17 @@ static irqreturn_t malidp_de_irq(int irq, void *arg) u32 status, mask, dc_status; irqreturn_t ret = IRQ_NONE; - if (!drm->dev_private) - return IRQ_HANDLED; - hwdev = malidp->dev; de = &hwdev->map.de_irq_map; + /* + * if we are suspended it is likely that we were invoked because + * we share an interrupt line with some other driver, don't try + * to read the hardware registers + */ + if (hwdev->pm_suspended) + return IRQ_NONE; + /* first handle the config valid IRQ */ dc_status = malidp_hw_read(hwdev, hwdev->map.dc_base + MALIDP_REG_STATUS); if (dc_status & hwdev->map.dc_irq_map.vsync_irq) { @@ -854,6 +859,14 @@ static irqreturn_t malidp_se_irq(int irq, void *arg) struct malidp_hw_device *hwdev = malidp->dev; u32 status, mask; + /* + * if we are suspended it is likely that we were invoked because + * we share an interrupt line with some other driver, don't try + * to read the hardware registers + */ + if (hwdev->pm_suspended) + return IRQ_NONE; + status = malidp_hw_read(hwdev, hwdev->map.se_base + MALIDP_REG_STATUS); if (!(status & hwdev->map.se_irq_map.irq_mask)) return IRQ_NONE;