| Message ID | 20260731-dw-hdmi-qp-scramb-v10-43-294364b2cf15@collabora.com (mailing list archive) |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-sunxi+bounces-24856-sunxi=pue.re@lists.linux.dev> X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mxe881.netcup.net (Postfix) with ESMTPS id C4A6C1C0256 for <noreply@patchwork.local>; Fri, 31 Jul 2026 19:05:47 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=collabora.com; spf=pass (sender IP is 104.64.211.4) smtp.mailfrom=linux-sunxi+bounces-24856-noreply=patchwork.local@lists.linux.dev smtp.helo=sin.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 104.64.211.4 as permitted sender) client-ip=104.64.211.4; envelope-from=linux-sunxi+bounces-24856-noreply=patchwork.local@lists.linux.dev; helo=sin.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sin.lore.kernel.org (Postfix) with ESMTP id 187843037227 for <noreply@patchwork.local>; Fri, 31 Jul 2026 16:25:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F6D944C4FF; Fri, 31 Jul 2026 16:20:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="NtmcqgNS" X-Original-To: linux-sunxi@lists.linux.dev Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 6DAC0468C03 for <linux-sunxi@lists.linux.dev>; Fri, 31 Jul 2026 16:19:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785514803; cv=none; b=RC8IzaRC/TyAhg0E0ULRtvJIWTiNdYPasVXRbNL3yNbVR8XJGS4JY45yxstyf5QXVfqzviioRu/WppTgYYVqZTO7UHkYw+vIvFv2TXawZFmr9AMvB7gYomgbOmNIcTkbDWHjUvK6qYZK9QSoKXs+J5bK3B+UmTzHBGU1P82Z9hg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785514803; c=relaxed/simple; bh=KwjregJEK1zHltpBaTSfhes6ErUtOgc/LRhZ6h3oFOI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CSbfV7EnaUA2Hz3/5Qel5OCs8i8LgIBk3WSSbgSEEH5tRyBrtpgWgZtU0RWcIQZEpz2tShtGXYNWkYOvWBCeHTAP8dGmsD1N+1pAu3ZBKjffo3OBFbNOQkJNnBaXtMgRyLhbKZkohDe8xAYVwiov4+ha4hL+x9ral31c3FirvtM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=NtmcqgNS; arc=none smtp.client-ip=148.251.105.195 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1785514785; bh=KwjregJEK1zHltpBaTSfhes6ErUtOgc/LRhZ6h3oFOI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=NtmcqgNSXRllEqlJW21sZx46nixZ5YWJzFqDA0DLvVWk07hwsd9sms+ahhduBVtGz QWOadKsy596BtM/7jAO9ZFaIwS94m8HitODlKf8zG0MtYyHt09pvaLfgVGspcBojma qu1u0hi3IpVyBxCS9MlyhhdsoEoR7ZJ0B7FHgBe/5nyHeI/xkUus4mzmAoaHV2GGWD FCzk7tbZXpad4UEyACbzX6bSVBqggvYnKtufy/ePUWMtjPqmuUMtsI4Cit2vucjM9O c4BTVRyyfOMjdE1Pg1LRBc6v7lz9IcCa0SPrbVA/ls5xqIma+YSWxOIvJ51Ex0O8o7 YM9rVA/DRRMIw== Received: from localhost (unknown [100.64.0.241]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange secp256r1 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id 7B05517E092C; Fri, 31 Jul 2026 18:19:45 +0200 (CEST) From: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Date: Fri, 31 Jul 2026 19:19:50 +0300 Subject: [PATCH v10 43/69] drm/vc4: hdmi: Propagate -EDEADLK to the top level 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: <20260731-dw-hdmi-qp-scramb-v10-43-294364b2cf15@collabora.com> References: <20260731-dw-hdmi-qp-scramb-v10-0-294364b2cf15@collabora.com> In-Reply-To: <20260731-dw-hdmi-qp-scramb-v10-0-294364b2cf15@collabora.com> To: 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>, 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>, 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>, Sandy Huang <hjc@rock-chips.com>, =?utf-8?q?Heiko_St=C3=BCbner?= <heiko@sntech.de>, Andy Yan <andy.yan@rock-chips.com>, Algea Cao <algea.cao@rock-chips.com>, Daniel Stone <daniels@collabora.com>, Liu Ying <victor.liu@nxp.com>, Phong LE <ple@baylibre.com> Cc: kernel@collabora.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-rockchip@lists.infradead.org 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 HDMI 2.0 support to DW HDMI QP TX
|
|
Commit Message
Cristian Ciocaltea
July 31, 2026, 4:19 p.m. UTC
drm_connector_helper_funcs.detect_ctx() is expected to propagate
-EDEADLK so that context owners, e.g. drm_helper_probe_detect_ctx(), can
perform the required backoff and retry.
vc4_hdmi_handle_hotplug() instead runs its own retry loop and calls
drm_modeset_backoff() on an acquire context it does not own. This drops
all locks in the context, including connection_mutex held by the core.
Drop the local retry logic and propagate -EDEADLK to the caller instead.
This aligns VC4 with the expected detect_ctx() semantics.
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/gpu/drm/vc4/vc4_hdmi.c | 23 +++++++----------------
1 file changed, 7 insertions(+), 16 deletions(-)
Comments
On Fri, Jul 31, 2026 at 07:19:50PM +0300, Cristian Ciocaltea wrote: > drm_connector_helper_funcs.detect_ctx() is expected to propagate > -EDEADLK so that context owners, e.g. drm_helper_probe_detect_ctx(), can > perform the required backoff and retry. > > vc4_hdmi_handle_hotplug() instead runs its own retry loop and calls > drm_modeset_backoff() on an acquire context it does not own. This drops > all locks in the context, including connection_mutex held by the core. > > Drop the local retry logic and propagate -EDEADLK to the caller instead. > This aligns VC4 with the expected detect_ctx() semantics. > > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> > --- > drivers/gpu/drm/vc4/vc4_hdmi.c | 23 +++++++---------------- > 1 file changed, 7 insertions(+), 16 deletions(-) > > diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c > index ba16e7944cf3..72042fad04c5 100644 > --- a/drivers/gpu/drm/vc4/vc4_hdmi.c > +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c > @@ -344,12 +344,11 @@ static int vc4_hdmi_reset_link(struct drm_connector *connector, > return drm_atomic_helper_reset_crtc(crtc, ctx); > } > > -static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi, > - struct drm_modeset_acquire_ctx *ctx, > - enum drm_connector_status status) > +static int vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi, > + struct drm_modeset_acquire_ctx *ctx, > + enum drm_connector_status status) > { > struct drm_connector *connector = &vc4_hdmi->connector; > - int ret; > > /* > * NOTE: This function should really be called with vc4_hdmi->mutex > @@ -368,17 +367,9 @@ static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi, > drm_atomic_helper_connector_hdmi_hotplug(connector, ctx, status); > > if (status != connector_status_connected) > - return; > + return 0; > > - for (;;) { > - ret = vc4_hdmi_reset_link(connector, ctx); > - if (ret == -EDEADLK) { > - drm_modeset_backoff(ctx); > - continue; > - } > - > - break; > - } > + return vc4_hdmi_reset_link(connector, ctx); > } > > static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector, > @@ -416,10 +407,10 @@ static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector, > status = connector_status_connected; > } > > - vc4_hdmi_handle_hotplug(vc4_hdmi, ctx, status); > + ret = vc4_hdmi_handle_hotplug(vc4_hdmi, ctx, status); > pm_runtime_put(&vc4_hdmi->pdev->dev); > > - return status; > + return ret == -EDEADLK ? ret : status; Don't we mask any error that isn't EDEADLK here? Maxime
On 8/20/26 11:55 AM, Maxime Ripard wrote: > On Fri, Jul 31, 2026 at 07:19:50PM +0300, Cristian Ciocaltea wrote: >> drm_connector_helper_funcs.detect_ctx() is expected to propagate >> -EDEADLK so that context owners, e.g. drm_helper_probe_detect_ctx(), can >> perform the required backoff and retry. >> >> vc4_hdmi_handle_hotplug() instead runs its own retry loop and calls >> drm_modeset_backoff() on an acquire context it does not own. This drops >> all locks in the context, including connection_mutex held by the core. >> >> Drop the local retry logic and propagate -EDEADLK to the caller instead. >> This aligns VC4 with the expected detect_ctx() semantics. >> >> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> >> --- >> drivers/gpu/drm/vc4/vc4_hdmi.c | 23 +++++++---------------- >> 1 file changed, 7 insertions(+), 16 deletions(-) >> >> diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c >> index ba16e7944cf3..72042fad04c5 100644 >> --- a/drivers/gpu/drm/vc4/vc4_hdmi.c >> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c >> @@ -344,12 +344,11 @@ static int vc4_hdmi_reset_link(struct drm_connector *connector, >> return drm_atomic_helper_reset_crtc(crtc, ctx); >> } >> >> -static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi, >> - struct drm_modeset_acquire_ctx *ctx, >> - enum drm_connector_status status) >> +static int vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi, >> + struct drm_modeset_acquire_ctx *ctx, >> + enum drm_connector_status status) >> { >> struct drm_connector *connector = &vc4_hdmi->connector; >> - int ret; >> >> /* >> * NOTE: This function should really be called with vc4_hdmi->mutex >> @@ -368,17 +367,9 @@ static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi, >> drm_atomic_helper_connector_hdmi_hotplug(connector, ctx, status); >> >> if (status != connector_status_connected) >> - return; >> + return 0; >> >> - for (;;) { >> - ret = vc4_hdmi_reset_link(connector, ctx); >> - if (ret == -EDEADLK) { >> - drm_modeset_backoff(ctx); >> - continue; >> - } >> - >> - break; >> - } >> + return vc4_hdmi_reset_link(connector, ctx); >> } >> >> static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector, >> @@ -416,10 +407,10 @@ static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector, >> status = connector_status_connected; >> } >> >> - vc4_hdmi_handle_hotplug(vc4_hdmi, ctx, status); >> + ret = vc4_hdmi_handle_hotplug(vc4_hdmi, ctx, status); >> pm_runtime_put(&vc4_hdmi->pdev->dev); >> >> - return status; >> + return ret == -EDEADLK ? ret : status; > > Don't we mask any error that isn't EDEADLK here? Yes, per .detect_ctx() doc, implementation should return either a drm_connector_status or -EDEADLK. This matches what the probe helpers expect, and prevents ending up with connector_status_unknown, which would be wrong, since the detection was successful: int drm_helper_probe_single_connector_modes() { [...] ret = drm_helper_probe_detect(connector, &ctx, true); if (ret == -EDEADLK) { drm_modeset_backoff(&ctx); goto retry; } else if (WARN(ret < 0, "Invalid return value %i for connector detection\n", ret)) ret = connector_status_unknown; connector->status = ret; [...] } drm_helper_probe_detect_ctx(struct drm_connector *connector, bool force) { [...] ret = drm_modeset_lock(&connector->dev->mode_config.connection_mutex, &ctx); if (!ret) ret = detect_connector_status(connector, &ctx, force); if (ret == -EDEADLK) { drm_modeset_backoff(&ctx); goto retry; } if (WARN_ON(ret < 0)) ret = connector_status_unknown; [...] }
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index ba16e7944cf3..72042fad04c5 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -344,12 +344,11 @@ static int vc4_hdmi_reset_link(struct drm_connector *connector, return drm_atomic_helper_reset_crtc(crtc, ctx); } -static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi, - struct drm_modeset_acquire_ctx *ctx, - enum drm_connector_status status) +static int vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi, + struct drm_modeset_acquire_ctx *ctx, + enum drm_connector_status status) { struct drm_connector *connector = &vc4_hdmi->connector; - int ret; /* * NOTE: This function should really be called with vc4_hdmi->mutex @@ -368,17 +367,9 @@ static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi, drm_atomic_helper_connector_hdmi_hotplug(connector, ctx, status); if (status != connector_status_connected) - return; + return 0; - for (;;) { - ret = vc4_hdmi_reset_link(connector, ctx); - if (ret == -EDEADLK) { - drm_modeset_backoff(ctx); - continue; - } - - break; - } + return vc4_hdmi_reset_link(connector, ctx); } static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector, @@ -416,10 +407,10 @@ static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector, status = connector_status_connected; } - vc4_hdmi_handle_hotplug(vc4_hdmi, ctx, status); + ret = vc4_hdmi_handle_hotplug(vc4_hdmi, ctx, status); pm_runtime_put(&vc4_hdmi->pdev->dev); - return status; + return ret == -EDEADLK ? ret : status; } static int vc4_hdmi_connector_get_modes(struct drm_connector *connector)