All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime@cerno.tech>
To: dri-devel@lists.freedesktop.org,
	Daniel Vetter <daniel.vetter@intel.com>,
	David Airlie <airlied@linux.ie>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Maxime Ripard <maxime@cerno.tech>
Cc: linux-kernel@vger.kernel.org,
	Dave Stevenson <dave.stevenson@raspberrypi.com>,
	Phil Elwell <phil@raspberrypi.com>,
	Tim Gover <tim.gover@raspberrypi.com>,
	Dom Cobley <dom@raspberrypi.com>,
	Boris Brezillon <bbrezillon@kernel.org>,
	linux-rpi-kernel@lists.infradead.org,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	bcm-kernel-feedback-list@broadcom.com,
	Emma Anholt <emma@anholt.net>,
	Nicolas Saenz Julienne <nsaenz@kernel.org>,
	Maxime Ripard <mripard@kernel.org>
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	[thread overview]
Message-ID: <20210819135931.895976-7-maxime@cerno.tech> (raw)
In-Reply-To: <20210819135931.895976-1-maxime@cerno.tech>

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 <dave.stevenson@raspberrypi.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 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 <linux/pm_runtime.h>
+
 #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


  parent reply	other threads:[~2021-08-19 14:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19 13:59 [PATCH v3 0/6] drm/vc4: hdmi: Fix CEC access while disabled Maxime Ripard
2021-08-19 13:59 ` [PATCH v3 1/6] drm/vc4: select PM Maxime Ripard
2021-09-10 13:40   ` Dave Stevenson
2021-09-10 13:40     ` Dave Stevenson
2021-09-19 16:40   ` [PATCH v3 1/6] drm/vc4: select PM (openrisc) Randy Dunlap
2021-09-19 16:40     ` [OpenRISC] " Randy Dunlap
2021-09-22  8:41     ` Maxime Ripard
2021-09-22  8:41       ` [OpenRISC] " Maxime Ripard
2021-09-22 15:49       ` Nathan Chancellor
2021-09-22 15:49         ` [OpenRISC] " Nathan Chancellor
2021-09-23 14:52         ` Maxime Ripard
2021-09-23 14:52           ` [OpenRISC] " Maxime Ripard
2021-09-23 14:55           ` Nathan Chancellor
2021-09-23 14:55             ` [OpenRISC] " Nathan Chancellor
2021-09-23 15:58             ` Maxime Ripard
2021-09-23 15:58               ` [OpenRISC] " Maxime Ripard
2021-08-19 13:59 ` [PATCH v3 2/6] drm/vc4: hdmi: Make sure the controller is powered up during bind Maxime Ripard
2021-08-19 13:59 ` [PATCH v3 3/6] drm/vc4: hdmi: Rework the pre_crtc_configure error handling Maxime Ripard
2021-08-19 13:59 ` [PATCH v3 4/6] drm/vc4: hdmi: Split the CEC disable / enable functions in two Maxime Ripard
2021-08-19 13:59 ` [PATCH v3 5/6] drm/vc4: hdmi: Make sure the device is powered with CEC Maxime Ripard
2021-08-19 13:59 ` Maxime Ripard [this message]
2021-09-14  7:55 ` [PATCH v3 0/6] drm/vc4: hdmi: Fix CEC access while disabled Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210819135931.895976-7-maxime@cerno.tech \
    --to=maxime@cerno.tech \
    --cc=airlied@linux.ie \
    --cc=bbrezillon@kernel.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=daniel.vetter@intel.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=dom@raspberrypi.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emma@anholt.net \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=nsaenz@kernel.org \
    --cc=phil@raspberrypi.com \
    --cc=tim.gover@raspberrypi.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.