From nobody Sat Feb 7 13:41:15 2026 Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [95.215.58.174]) (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 CA1F6330D3B for ; Tue, 6 Jan 2026 17:02:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767718947; cv=none; b=g3q3q1nxO7AUwFHFalRlZ/G/MtG/0DB2NV/PV+uUzN8CDcmB+U4vWnCAqgl3AUPyUSzoEm9wzxcq8sdetQ86q/teB8QFkMn7JnN/6NtcWi5cH8JHRhuVoZIEsMRTXlhNbv+ASJXnrRFoLVO4hgSKu69+Q2/tjdzhQAMdleNkHmk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767718947; c=relaxed/simple; bh=mxWhh1FCkJo5UGiIEo9esESyzNkTFWOhTirRuYiMSUI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RFeXBO+bMacyW6fXXnlitVvPP6VPh2JQPz46g56OrGl8Jv5/j+SrxEg/wNgJLv7wb8gSIH9MXHhuzDPXbsw89FcyYVTpsCR6RowCesNMadjNzT34rGMpteTps5BzugOtHjsDGAKTp4e6Fz2IeU3+4O9oyYfNByx4NOJv9lvG0N8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=fj6fdhXa; arc=none smtp.client-ip=95.215.58.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="fj6fdhXa" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1767718944; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OiEhZggfL5Xg3vG4VJq5+2MUKP+PyMAkCqc8zsFcA0Q=; b=fj6fdhXaBls4OvMR32hJmCUt7tuEb6KdeIF+vrmCfOc+awY0Hid9t/P1AhfvzSbq0q0dA8 VxEtRGDncoo/OChHVi7WEvV9y55XLDbJ/gMbbeijCDjk4X+bqxRmsjMqtoKwrJQrvO98hx MoyOKxe3ZtOg/PDAPUwLulCfPk6HibM= From: Sean Anderson To: Laurent Pinchart , Tomi Valkeinen , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org Cc: David Airlie , Michal Simek , Simona Vetter , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH v3 1/3] drm: zynqmp_dp: Update connector state before AUX transfers Date: Tue, 6 Jan 2026 12:01:34 -0500 Message-Id: <20260106170136.501044-2-sean.anderson@linux.dev> In-Reply-To: <20260106170136.501044-1-sean.anderson@linux.dev> References: <20260106170136.501044-1-sean.anderson@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" We still want to retry AUX transfers even when the connector is first plugged in. Update the connector state before reading the DPDC to ensure the AUX bus sees the most-recent state. Fixes: d76271d22694 ("drm: xlnx: DRM/KMS driver for Xilinx ZynqMP DisplayPo= rt Subsystem") Signed-off-by: Sean Anderson --- (no changes since v1) drivers/gpu/drm/xlnx/zynqmp_dp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp= _dp.c index 34ddbf98e81d..f39c78b08e6a 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c @@ -1697,6 +1697,7 @@ static enum drm_connector_status __zynqmp_dp_bridge_d= etect(struct zynqmp_dp *dp) } =20 if (state & ZYNQMP_DP_INTERRUPT_SIGNAL_STATE_HPD) { + dp->status =3D connector_status_connected; ret =3D drm_dp_dpcd_read(&dp->aux, 0x0, dp->dpcd, sizeof(dp->dpcd)); if (ret < 0) { @@ -1711,7 +1712,6 @@ static enum drm_connector_status __zynqmp_dp_bridge_d= etect(struct zynqmp_dp *dp) drm_dp_max_lane_count(dp->dpcd), dp->num_lanes); =20 - dp->status =3D connector_status_connected; return connector_status_connected; } =20 --=20 2.35.1.1320.gc452695387.dirty From nobody Sat Feb 7 13:41:15 2026 Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [95.215.58.174]) (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 B9E143385A3 for ; Tue, 6 Jan 2026 17:02:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767718949; cv=none; b=gtWoAd/Y1472ZLliwqeeHxNz5/WgMND/Srx3rEnEEkQVnzE/RDhvti7pn/IGJpTOxvSuXNpSOXSm62+XAwVR+V1g59b7tpN+4YnrB6KKHlnCJX51B18heS+HNEn+VfC03Dz8CnHbf6vb6kHoeT7rFndX2/zfKRrYI4xjriaPVRg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767718949; c=relaxed/simple; bh=EPY6CKbSqt+H5S8GBFOMhYVfy8sPeNqL7S9hMry67YA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bhntU7D8DlkAJK+QtU9mmKaPAW2lhnpSScFZuR9SlogzBTbhuobEji9nWwmsQ+bT67Rlyd1cdywajMQuzUKJ/jbmDoqIUdiRAuv5fbLa2LioCvLNwmaj3Ex1tk7EVGNpeUAWabTvx80tVhuqbESovuVnMoN61+rqIVAa2mEu/DU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=w7LwEy50; arc=none smtp.client-ip=95.215.58.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="w7LwEy50" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1767718946; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TqzdzzYSnHYqd7lgLdiNXL8RderpADhP5hUHZURlmAE=; b=w7LwEy50CG4d2rzgHh8MXAXS93w19v6C6ZdjF6NUmSRRQhAqC/V2umFn5Fu3/87a8ksfnm ITJ8KG4jiOECT76LBzLNtpOOOUhCq0OE0NsxdV0d+vVDkd8nOCSvJZRWGqN0eZWOVwpHXm uwmrrsmQbbB2nhOQqpeYMECZazyORew= From: Sean Anderson To: Laurent Pinchart , Tomi Valkeinen , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org Cc: David Airlie , Michal Simek , Simona Vetter , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH v3 2/3] drm: zynqmp_dp: Use smp_load/store for status Date: Tue, 6 Jan 2026 12:01:35 -0500 Message-Id: <20260106170136.501044-3-sean.anderson@linux.dev> In-Reply-To: <20260106170136.501044-1-sean.anderson@linux.dev> References: <20260106170136.501044-1-sean.anderson@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" dp->status is read asynchronously by the AUX bus. Therefore, all reads outside of dp->lock must be atomic. Similarly, writes must be atomic as well. Reads with dp->lock held do not need to be atomic. Fixes: a7d5eeaa57d7 ("drm: zynqmp_dp: Add locking") Signed-off-by: Sean Anderson --- (no changes since v1) drivers/gpu/drm/xlnx/zynqmp_dp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp= _dp.c index f39c78b08e6a..caf2e0ce3644 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c @@ -1111,7 +1111,7 @@ zynqmp_dp_aux_transfer(struct drm_dp_aux *aux, struct= drm_dp_aux_msg *msg) return msg->size; } =20 - if (dp->status =3D=3D connector_status_disconnected) { + if (READ_ONCE(dp->status) =3D=3D connector_status_disconnected) { dev_dbg(dp->dev, "no connected aux device\n"); if (dp->ignore_aux_errors) goto fake_response; @@ -1697,7 +1697,7 @@ static enum drm_connector_status __zynqmp_dp_bridge_d= etect(struct zynqmp_dp *dp) } =20 if (state & ZYNQMP_DP_INTERRUPT_SIGNAL_STATE_HPD) { - dp->status =3D connector_status_connected; + WRITE_ONCE(dp->status, connector_status_connected); ret =3D drm_dp_dpcd_read(&dp->aux, 0x0, dp->dpcd, sizeof(dp->dpcd)); if (ret < 0) { @@ -1716,7 +1716,7 @@ static enum drm_connector_status __zynqmp_dp_bridge_d= etect(struct zynqmp_dp *dp) } =20 disconnected: - dp->status =3D connector_status_disconnected; + WRITE_ONCE(dp->status, connector_status_disconnected); return connector_status_disconnected; } =20 --=20 2.35.1.1320.gc452695387.dirty From nobody Sat Feb 7 13:41:15 2026 Received: from out-182.mta1.migadu.com (out-182.mta1.migadu.com [95.215.58.182]) (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 19B4C33A008 for ; Tue, 6 Jan 2026 17:02:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767718951; cv=none; b=lBYmrx2jmJ2eAQQ6MSxMD+Td8SfPC8KJ9IGlNxJ5hvpXR/mQa/qGtLKl32MD2KOIXUpggBK5Pmbcf+bNvMlCggHolxCiIIekTuCYkmiWf/9VuHcaTmoL0IM3KMOk2uLEqp/H5YKEnfhurGz5qyNSF8BIxrbgT3L9a273xEpgunI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767718951; c=relaxed/simple; bh=I3KNYxT+fXdhIqzKLtsjIt8o8F1mB/+g/X3g5/chlAw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rEelzHstRYdVRi8739EzFjNTpIpQG0u8d7RD3Un7Gd2jeosNPKQS80z3lnldv2PtxiO02lCazVkji1vRYVHA/LXmEwyErvooSU3S72DEFDTbIf3DsXcIhIGaZfPyP/lMjxF7NhULw8ViYrR6ZITOWX/BGPq60c57FwNRkNzTjzc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=o35fJd3z; arc=none smtp.client-ip=95.215.58.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="o35fJd3z" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1767718948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=946vhw3zYbTSZObcCUOe4GKWrWXeYCq7idjeOFNDEeY=; b=o35fJd3zIcYk31Cd2zMQUz6uySvXFmA91qZ5gqowY7rbrPgSwiJdqGEolZlI4dKkAxmK6j Xpho1j0GvMOuKOGzrveF0lRfGboFfmlKAYbEOClmCnishJKwFx1sKy3d7AHqoQMgpPh0ww +0kbpYOLWxtoFCbQSAVAq5Ic2rezZk4= From: Sean Anderson To: Laurent Pinchart , Tomi Valkeinen , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org Cc: David Airlie , Michal Simek , Simona Vetter , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH v3 3/3] drm: zynqmp_dp: Retrain link after HPD if necessary Date: Tue, 6 Jan 2026 12:01:36 -0500 Message-Id: <20260106170136.501044-4-sean.anderson@linux.dev> In-Reply-To: <20260106170136.501044-1-sean.anderson@linux.dev> References: <20260106170136.501044-1-sean.anderson@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Section 5.1.4 of the v1.2 DisplayPort standard says > The Source device shall respond to Hot Plug event/Hot Re-plug event by > first reading DPCD Link/Sink Device Status registers at DPCD 00200h > through 00205h.... If the link is unstable or lost, the Source device > then reads the DPCD Receiver Capabilities registers at DPCD 00000h > through 0000Fh to determine the appropriate information needed to > train the link. The Source device shall then initiate link training. However, zynqmp_dp_hpd_work_func does not check the link status. This may prevent the sink from detecting the source if, for example, the user disconnects the cable and then reconnects it. I encountered this problem when testing a mini DP connector (although I had no problem when using a full-size connector with the existing driver). Follow the spec by checking the link status after a HPD event and retraining if necessary. Simplify the condition a bit since drm_dp_channel_eq_ok checks a superset of drm_dp_clock_recovery_ok. Fixes: d76271d22694 ("drm: xlnx: DRM/KMS driver for Xilinx ZynqMP DisplayPo= rt Subsystem") Signed-off-by: Sean Anderson --- Changes in v3: - Simplify HPD retrain condition Changes in v2: - needs_retain -> needs_retrain - Actually retrain the loop (accidentally removed while rebasing) drivers/gpu/drm/xlnx/zynqmp_dp.c | 36 +++++++++++++++++++------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp= _dp.c index caf2e0ce3644..c7b31bb10276 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c @@ -1677,6 +1677,22 @@ static int zynqmp_dp_bridge_atomic_check(struct drm_= bridge *bridge, return 0; } =20 +static bool zynqmp_hpd_needs_retrain(struct zynqmp_dp *dp) +{ + u8 status[DP_LINK_STATUS_SIZE + 2]; + int err; + + err =3D drm_dp_dpcd_read(&dp->aux, DP_SINK_COUNT, status, + DP_LINK_STATUS_SIZE + 2); + if (err < 0) { + dev_dbg_ratelimited(dp->dev, + "could not read sink status: %d\n", err); + return false; + } + + return !drm_dp_channel_eq_ok(&status[2], dp->mode.lane_cnt); +} + static enum drm_connector_status __zynqmp_dp_bridge_detect(struct zynqmp_d= p *dp) { struct zynqmp_dp_link_config *link_config =3D &dp->link_config; @@ -1698,6 +1714,9 @@ static enum drm_connector_status __zynqmp_dp_bridge_d= etect(struct zynqmp_dp *dp) =20 if (state & ZYNQMP_DP_INTERRUPT_SIGNAL_STATE_HPD) { WRITE_ONCE(dp->status, connector_status_connected); + if (!zynqmp_hpd_needs_retrain(dp)) + return connector_status_connected; + ret =3D drm_dp_dpcd_read(&dp->aux, 0x0, dp->dpcd, sizeof(dp->dpcd)); if (ret < 0) { @@ -1712,6 +1731,7 @@ static enum drm_connector_status __zynqmp_dp_bridge_d= etect(struct zynqmp_dp *dp) drm_dp_max_lane_count(dp->dpcd), dp->num_lanes); =20 + zynqmp_dp_train_loop(dp); return connector_status_connected; } =20 @@ -2335,25 +2355,13 @@ static void zynqmp_dp_hpd_irq_work_func(struct work= _struct *work) { struct zynqmp_dp *dp =3D container_of(work, struct zynqmp_dp, hpd_irq_work); - u8 status[DP_LINK_STATUS_SIZE + 2]; - int err; =20 guard(mutex)(&dp->lock); if (dp->ignore_hpd) return; =20 - err =3D drm_dp_dpcd_read(&dp->aux, DP_SINK_COUNT, status, - DP_LINK_STATUS_SIZE + 2); - if (err < 0) { - dev_dbg_ratelimited(dp->dev, - "could not read sink status: %d\n", err); - } else { - if (status[4] & DP_LINK_STATUS_UPDATED || - !drm_dp_clock_recovery_ok(&status[2], dp->mode.lane_cnt) || - !drm_dp_channel_eq_ok(&status[2], dp->mode.lane_cnt)) { - zynqmp_dp_train_loop(dp); - } - } + if (zynqmp_hpd_needs_retrain(dp)) + zynqmp_dp_train_loop(dp); } =20 static irqreturn_t zynqmp_dp_irq_handler(int irq, void *data) --=20 2.35.1.1320.gc452695387.dirty