| Message ID | 20260721-scdc-link-health-v7-5-92df1b6ad5fc@collabora.com (mailing list archive) |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-sunxi+bounces-24563-sunxi=pue.re@lists.linux.dev> X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mxe881.netcup.net (Postfix) with ESMTPS id 060D41C2B7D for <noreply@patchwork.local>; Tue, 21 Jul 2026 11:10:18 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=collabora.com; spf=pass (sender IP is 172.234.253.10) smtp.mailfrom=linux-sunxi+bounces-24563-noreply=patchwork.local@lists.linux.dev smtp.helo=sea.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.234.253.10 as permitted sender) client-ip=172.234.253.10; envelope-from=linux-sunxi+bounces-24563-noreply=patchwork.local@lists.linux.dev; helo=sea.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sea.lore.kernel.org (Postfix) with ESMTP id F2CAB3131FCC for <noreply@patchwork.local>; Tue, 21 Jul 2026 09:02:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8AC3E3C1998; Tue, 21 Jul 2026 09:02:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b="QvjU3XmR" X-Original-To: linux-sunxi@lists.linux.dev Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3CB363C1402 for <linux-sunxi@lists.linux.dev>; Tue, 21 Jul 2026 09:02:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784624534; cv=pass; b=Kl+mabq31Z+cS62403D8ndlss7bx7YfbMRZe4Dt+T1c2aBOqM+L+ym1cGBEqqcpAPyU71rSkXA/HNOksllFWBc0Wgncu8tAvmMcnme4wLO/3rv5kY0Syn4Qys8Y3cL9kGm1JzHrmJueHAGBjQLnx+NbcDm2o/6513Ef9LORYoFI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784624534; c=relaxed/simple; bh=a6FeZr0whiDNNuo2I2TDGaWswjrPZmbEu/jGNWaPKvg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rUDKxXqaGTaFGltybL3fxiWT0dl6hlAZXrin5wPZjGizOBm5b6IG5q970AMzacxV3Ih/MpAncphL1lxUneSO0LqfWzJJVXPZbLahy2+a1BUNCrDqZDMkXhICD2+ZMr5blDcXeoYbs7z6Xmd94aLuao8eigdQqTZlP+faQZhaET8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b=QvjU3XmR; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com ARC-Seal: i=1; a=rsa-sha256; t=1784624390; cv=none; d=zohomail.com; s=zohoarc; b=AlU7C9LdltHDScoWwHC3X29nceXJykOp1oOepH0s87+6lXv7feVxAaEktUUhrDFRt7C5qu0RRqzCeGtqTPxCUbv3TXYmL5I5KG36hpUeOe2XIRpcvSAg6oyfYLZibKWUAd1xsPjD3CnWlSme5wqSgEgvJ5hIKurezdaYwXtA+qo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784624390; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=zBRro5DpsPG3sefzb4EIOocwUtzmV8Fv8o5jqwZE2+k=; b=J856QT2c4kybeeFOHMQ1OX4V56MkFHJ4m5rtBe0RiP1LkQTXFcMxsH3mHrUK16Ui80aUztUMsvo/ysnreLqJPA7iLyMHfB+Nd37tn6W0SgttUBWCtWTAQ2C22GwXva8c1W9Ygr+mMEWCnRgLmFEyWaTTK9KWpTSMFZK1xAdDcRg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=nicolas.frattaroli@collabora.com; dmarc=pass header.from=<nicolas.frattaroli@collabora.com> DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1784624390; s=zohomail; d=collabora.com; i=nicolas.frattaroli@collabora.com; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=zBRro5DpsPG3sefzb4EIOocwUtzmV8Fv8o5jqwZE2+k=; b=QvjU3XmREttb3ymnkVCFdjT06w+BihipttIUINDEtaHrXThKIn8CXwj7kvaDH4DO FExngn5ztIsoCl/7e/qxNP6tNZts7ZJOvuuWW8+2Uc+nIxFAf0wbGjRjQnom2hpwaJI /Ww26Loy6BIbBzd+co6Fny4NNCQK54UAVevvujoA= Received: by mx.zohomail.com with SMTPS id 1784624389622433.39379483803657; Tue, 21 Jul 2026 01:59:49 -0700 (PDT) From: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Date: Tue, 21 Jul 2026 10:59:01 +0200 Subject: [PATCH v7 5/5] drm/display: hdmi-state-helper: Init SCDC debugfs for HDMI Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: <linux-sunxi.lists.linux.dev> List-Subscribe: <mailto:linux-sunxi+subscribe@lists.linux.dev> List-Unsubscribe: <mailto:linux-sunxi+unsubscribe@lists.linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260721-scdc-link-health-v7-5-92df1b6ad5fc@collabora.com> References: <20260721-scdc-link-health-v7-0-92df1b6ad5fc@collabora.com> In-Reply-To: <20260721-scdc-link-health-v7-0-92df1b6ad5fc@collabora.com> To: Jani Nikula <jani.nikula@linux.intel.com>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>, Andrzej Hajda <andrzej.hajda@intel.com>, Neil Armstrong <neil.armstrong@linaro.org>, Robert Foss <rfoss@kernel.org>, Laurent Pinchart <Laurent.pinchart@ideasonboard.com>, Jonas Karlman <jonas@kwiboo.se>, Jernej Skrabec <jernej.skrabec@gmail.com>, Luca Ceresoli <luca.ceresoli@bootlin.com>, Daniel Stone <daniel@fooishbar.org>, Hans Verkuil <hverkuil+cisco@kernel.org>, Chen-Yu Tsai <wens@kernel.org>, Samuel Holland <samuel@sholland.org>, Dave Stevenson <dave.stevenson@raspberrypi.com>, =?utf-8?q?Ma=C3=ADra_Canal?= <mcanal@igalia.com>, Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com> Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel@collabora.com, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Nicolas Frattaroli <nicolas.frattaroli@collabora.com> X-Mailer: b4 0.15.2 X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= |
| Series |
Add SCDC information to connector debugfs
|
|
Commit Message
Nicolas Frattaroli
July 21, 2026, 8:59 a.m. UTC
Initialise the SCDC debugfs file for connectors that call the HDMI state
helper's debugfs_init helper. This makes all connectors that use the
helper expose the scdc_status file in their connector debugfs.
Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
---
drivers/gpu/drm/display/drm_hdmi_state_helper.c | 2 ++
1 file changed, 2 insertions(+)
Comments
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [High] Reading the `scdc_status` debugfs file causes a kernel panic if the HDMI connector lacks an I2C DDC adapter (`connector->ddc == NULL`). - [Medium] Concurrent reads of the `scdc_status` debugfs file cause a data race on the shared per-connector `priv->state` buffer. - [Low] SCDC debugfs initialization is incorrectly skipped if the creation of the `infoframes` debugfs directory fails. -- --- Patch [5]: [PATCH v7 5/5] drm/display: hdmi-state-helper: Init SCDC debugfs for HDMI --- commit 4d2f5fcf6dba954346bc26d1af8d8e70d0cf5de0 Author: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> drm/display: hdmi-state-helper: Init SCDC debugfs for HDMI Initialise the SCDC debugfs file for connectors that call the HDMI state helper's debugfs_init helper. This makes all connectors that use the helper expose the scdc_status file in their connector debugfs. > diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c > index 8d5ee10ceb874..709524b40c26f 100644 > --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c > +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c [ ... ] > @@ -1116,6 +1117,7 @@ void drm_hdmi_connector_debugfs_init(struct drm_connector *connector, > return; [Severity: Low] Is it intended that drm_scdc_debugfs_init() is skipped if the infoframes directory creation fails? Right above this line, the code checks: dir = debugfs_create_dir("infoframes", root); if (IS_ERR(dir)) return; If debugfs_create_dir() fails, the early return skips the independent drm_scdc_debugfs_init() call entirely. > > create_hdmi_infoframe_files(connector, dir); > + drm_scdc_debugfs_init(connector, root); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [Severity: High] Does exposing this to all HDMI connectors cause a regression with a NULL pointer dereference? If an HDMI connector lacks an I2C adapter (connector->ddc is NULL) but indicates SCDC support, reading the newly exposed scdc_status debugfs file leads to a panic: drivers/gpu/drm/display/drm_scdc_helper.c:scdc_status_show() { if (scdc->supported) { ret = drm_scdc_read_state(connector, st); ... } drivers/gpu/drm/display/drm_scdc_helper.c:drm_scdc_read_state() { ddc = connector->ddc; if (!scdc->supported) return -EOPNOTSUPP; /* Read in 128-byte chunks, to work around DP<->HDMI converters with issues. */ ret = drm_scdc_read(ddc, 0, buf, 128); ... } drm_scdc_read() unconditionally passes the NULL pointer to i2c_transfer(), causing a panic. [Severity: Medium] Could concurrent reads of the scdc_status debugfs file cause a regression due to a data race? drm_scdc_debugfs_init() allocates a single, shared struct scdc_debugfs_priv per connector: drivers/gpu/drm/display/drm_scdc_helper.c:drm_scdc_debugfs_init() { priv = drmm_kzalloc(connector->dev, sizeof(*priv), GFP_KERNEL); ... } When multiple processes concurrently read the debugfs file, they extract this shared pointer: drivers/gpu/drm/display/drm_scdc_helper.c:scdc_status_show() { struct scdc_debugfs_priv *priv = m->private; struct drm_scdc_state *st = &priv->state; ... } Since there is no locking across the sequential I2C reads and data parsing in drm_scdc_read_state(), concurrent threads could overwrite priv->state simultaneously. > } > EXPORT_SYMBOL(drm_hdmi_connector_debugfs_init);
On Tue, 21 Jul 2026 10:59:01 +0200, Nicolas Frattaroli wrote: > Initialise the SCDC debugfs file for connectors that call the HDMI state > helper's debugfs_init helper. This makes all connectors that use the > helper expose the scdc_status file in their connector debugfs. > > Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> > > [ ... ] Acked-by: Maxime Ripard <mripard@kernel.org> Thanks! Maxime
diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c index 8d5ee10ceb87..709524b40c26 100644 --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c @@ -13,6 +13,7 @@ #include <drm/display/drm_hdmi_cec_helper.h> #include <drm/display/drm_hdmi_helper.h> #include <drm/display/drm_hdmi_state_helper.h> +#include <drm/display/drm_scdc_helper.h> /** * DOC: hdmi helpers @@ -1116,6 +1117,7 @@ void drm_hdmi_connector_debugfs_init(struct drm_connector *connector, return; create_hdmi_infoframe_files(connector, dir); + drm_scdc_debugfs_init(connector, root); } EXPORT_SYMBOL(drm_hdmi_connector_debugfs_init);