Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp602064pxb; Thu, 19 Aug 2021 07:06:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8+NitTSU3xhFsqUeBGwATKmDRhj1FtgnGISQeTUFj4al9xLNRKJpnD0sOlLKv7sMTwDxv X-Received: by 2002:a05:6402:10d9:: with SMTP id p25mr16361634edu.51.1629381962952; Thu, 19 Aug 2021 07:06:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629381962; cv=none; d=google.com; s=arc-20160816; b=sPVEHz8cN4l5pN9ogebJPgI8WDxfmGlEjypB0VoixHktJPlsupxP5Nn3spHNaYKqoh A3dIe2w7twG/ioH5ieADgp+KZynEcE6DQA/pFiT75iUa4yNqPVE082L94p73HoTuPPTn 8aM9LwX0yzvRV21fgAw/TbZ4E4KvRyF16RUiuscLQDQAQQ6ublQK5Wfo/GvaPMyBgHne dTu9FL6qOfdESazMyxX6JNCjCU4avbe+z5q5resig9+uRac+D8oDv+//YlXgqaCczlX2 F6qkBv4tjUxm4DHJOe8gGGarbrdOYndV0B50cs9j+G7ImZ4LOEY3oCiEJs8ygv0JJB9J XzOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=N3jSN24OkJ7Dh/8CWHl9T0L42ugnuJaEB9P5An/GD+g=; b=V4T67MqOZfgEC+BTn3sK+pGmybT+3UDPFb6v6ssDS2OKmbpnFVr4eNQ7OU3sJ2L8zC aEnsi+kTA5d6C/EPPwQBIQigXlnIuWh99uVs++ZYfGDfeUhuGnr8EA4Jftol5DirrYas vRNcvhLPtwQwyUzzdU81E5bJgnA9oWyWFY3olYeKAQVZRJ9hvFST4v1bc25jSl2925Oq ijh+BidPXIsUIE2wWJGta4SW/88sBWtCbTdZMp8hL2XUImcwusSa1pSg56CZMbTIXWY8 Gf3wKQwFlgz4N9q1dYv5OJBVjFaP3JxuYHI1RouG/EH8+8Kflez2mOcM/GOrxq+O0LC+ 5tgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=ePvi3Mnh; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=QfByrOPv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r12si3234104edw.80.2021.08.19.07.05.22; Thu, 19 Aug 2021 07:06:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=ePvi3Mnh; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=QfByrOPv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240455AbhHSOAt (ORCPT + 99 others); Thu, 19 Aug 2021 10:00:49 -0400 Received: from wnew3-smtp.messagingengine.com ([64.147.123.17]:42685 "EHLO wnew3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240466AbhHSOAl (ORCPT ); Thu, 19 Aug 2021 10:00:41 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.west.internal (Postfix) with ESMTP id 40B5C2B00973; Thu, 19 Aug 2021 10:00:04 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 19 Aug 2021 10:00:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=N3jSN24OkJ7Dh /8CWHl9T0L42ugnuJaEB9P5An/GD+g=; b=ePvi3Mnh3YLXbZZIsBDANoJ4LPuL5 BrU2VEQO5uFxEvPuwgp7+nB843ZngA/6PmVWUJuGsI8bVLnBlwTGUglWifYytP8r jmh2e6xFbOp4Qpe7nt+MUmQLQo8YGox1A9oDZY+j6eO6byttcSRBDfy0TJ4a3eKY Uyt1DvW4Ye5ku9f+9VPosiSoAeF579A++LVPpqjNtYDwgmgkqZe6U9RwZAo+5frU SN842X6zO98gFQKDIqopA6kcWHv/qeB3zvpx9BV5nc+vccHG4cZ39aNrBYkDZY1c jpmAcx3RHykJ+w9iRggJLTwwpJKKMuO6OYlroNTdBnAbRsQ72/KtGtF3w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=N3jSN24OkJ7Dh/8CWHl9T0L42ugnuJaEB9P5An/GD+g=; b=QfByrOPv wIO7bt41iSdpU4PMJ/8JfsjLGcTz2484pwMs76C4JCPCrgldag5S3EAIlYV5ka+/ BrzHPMS8Dpa9AsJCdBKSmucUV2R7Cwr440BzwRxxaecwpGmr+J76TuZC4xWVrrt5 ljKsWD2Xo5yDGV+AkNT+FOiaiSKABtgRexNP1dmzwqtbOjFs/gfhnRupAN/o8vyB 7Q5Teaq5ELHQeInVpqPYVl61ZGWYLcUV9SNsbIdcXRUubdHOrk0QoEkEe5fhsSZV q4AQxwS0/THR+3h37EhPo03GiGPUYyRaEwtd1c4kySyJFPpykogs3ZAUGC+Bxmya y46ao/bQP5ifEg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrleejgdeilecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 19 Aug 2021 10:00:02 -0400 (EDT) From: Maxime Ripard To: dri-devel@lists.freedesktop.org, Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard Cc: linux-kernel@vger.kernel.org, Dave Stevenson , Phil Elwell , Tim Gover , Dom Cobley , Boris Brezillon , linux-rpi-kernel@lists.infradead.org, Hans Verkuil , bcm-kernel-feedback-list@broadcom.com, Emma Anholt , Nicolas Saenz Julienne , Maxime Ripard Subject: [PATCH v3 6/6] drm/vc4: hdmi: Warn if we access the controller while disabled Date: Thu, 19 Aug 2021 15:59:31 +0200 Message-Id: <20210819135931.895976-7-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210819135931.895976-1-maxime@cerno.tech> References: <20210819135931.895976-1-maxime@cerno.tech> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We've had many silent hangs where the kernel would look like it just stalled due to the access to one of the HDMI registers while the controller was disabled. Add a warning if we're about to do that so that it's at least not silent anymore. Reviewed-by: Dave Stevenson Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hdmi_regs.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi_regs.h b/drivers/gpu/drm/vc4/vc4_hdmi_regs.h index 19d2fdc446bc..99dde6e06a37 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi_regs.h +++ b/drivers/gpu/drm/vc4/vc4_hdmi_regs.h @@ -1,6 +1,8 @@ #ifndef _VC4_HDMI_REGS_H_ #define _VC4_HDMI_REGS_H_ +#include + #include "vc4_hdmi.h" #define VC4_HDMI_PACKET_STRIDE 0x24 @@ -412,6 +414,8 @@ static inline u32 vc4_hdmi_read(struct vc4_hdmi *hdmi, const struct vc4_hdmi_variant *variant = hdmi->variant; void __iomem *base; + WARN_ON(!pm_runtime_active(&hdmi->pdev->dev)); + if (reg >= variant->num_registers) { dev_warn(&hdmi->pdev->dev, "Invalid register ID %u\n", reg); @@ -438,6 +442,8 @@ static inline void vc4_hdmi_write(struct vc4_hdmi *hdmi, const struct vc4_hdmi_variant *variant = hdmi->variant; void __iomem *base; + WARN_ON(!pm_runtime_active(&hdmi->pdev->dev)); + if (reg >= variant->num_registers) { dev_warn(&hdmi->pdev->dev, "Invalid register ID %u\n", reg); -- 2.31.1