All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/amd/display: Route connector DDC over AUX for native DP sinks
@ 2026-11-03 14:18 Mario Limonciello
  2026-11-03 14:36 ` sashiko-bot
  2026-11-15  8:20 ` Wayne Lin
  0 siblings, 2 replies; 9+ messages in thread
From: Mario Limonciello @ 2026-11-03 14:18 UTC (permalink / raw)
  To: Harry Wentland, Leo Li, Alex Deucher
  Cc: Richard Hughes, amd-gfx, dri-devel, simonit.orig,
	Mario Limonciello

On DisplayPort and eDP connectors DDC is tunneled over the AUX channel,
but the connector's "ddc" adapter ("AMDGPU DM i2c hw bus N") always
drives the physical i2c pins, which don't reach a native DP sink.  The
AUX backed adapter ("AMDGPU DM aux hw bus N") does, so userspace such as
fwupd, which uses the "ddc" sysfs link for DDC/CI, has to work around
this.

Keep a single i2c bus per connector and pick the transport per transfer
based on the detected sink: if the sink is a native DP/eDP/MST sink,
forward the transfer to the AUX adapter, otherwise (DVI/HDMI, including
DP++ with a passive adapter) use the hw i2c engine as before.

Reported-by: simonit.orig@gmail.com
Closes: https://github.com/fwupd/fwupd/pull/11308
Signed-off-by: Mario Limonciello <superm1@kernel.org>
---
Changes in v2:
- Check which i2c bus to use on the fly instead of changing static symlink to
  avoid regressing passive adapters.
- Link to v1: https://patch.msgid.link/20261102-superm1-amdgpu-ddc-v1-1-9c5cb4a4f62d@amd.com
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c  | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
index b498fc5fbb140..678caffa3d120 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
@@ -3373,6 +3373,22 @@ STATIC_IFN_KUNIT int amdgpu_dm_i2c_xfer(struct i2c_adapter *i2c_adap,
 	int i;
 	int result = -EIO;
 
+	if (!i2c->oem) {
+		struct dc_link *link = ddc_service->link;
+		struct amdgpu_dm_connector *aconnector = link->priv;
+
+		/*
+		 * DDC to a native DisplayPort sink is tunneled over the AUX
+		 * channel; the physical i2c pins only reach DVI/HDMI sinks
+		 * (e.g. DP++ with a passive adapter).  Route accordingly so
+		 * the connector's single "ddc" bus works for either sink.
+		 */
+		if (aconnector && link->local_sink &&
+		    dc_is_dp_signal(link->local_sink->sink_signal) &&
+		    aconnector->dm_dp_aux.aux.ddc.algo)
+			return i2c_transfer(&aconnector->dm_dp_aux.aux.ddc, msgs, num);
+	}
+
 	if (!ddc_service->ddc_pin)
 		return result;
 

---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261102-superm1-amdgpu-ddc-63f0eb10c022

Best regards,
--  
Mario Limonciello <superm1@kernel.org>


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] drm/amd/display: Route connector DDC over AUX for native DP sinks
  2026-11-03 14:18 [PATCH v2] drm/amd/display: Route connector DDC over AUX for native DP sinks Mario Limonciello
@ 2026-11-03 14:36 ` sashiko-bot
  2026-11-15  8:20 ` Wayne Lin
  1 sibling, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-11-03 14:36 UTC (permalink / raw)
  To: Mario Limonciello; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Critical] drm/amd/display: UAF race on link->local_sink in amdgpu_dm_i2c_xfer()
- [High] drm/amd/display: NULL link dereference in amdgpu_dm_i2c_xfer()
- [Medium] drm/amd/display: amdgpu_dm_i2c_xfer() misses MST and force_to_use_aux links
--

commit 7a7dcab86c8948b21ebe53eebc9df866754fd915
Author: Mario Limonciello <superm1@kernel.org>

drm/amd/display: Route connector DDC over AUX for native DP sinks

This commit updates amdgpu_dm_i2c_xfer() to route I2C transfers over the
DisplayPort AUX DDC adapter when a native DisplayPort, eDP, or MST sink is
detected on the link, while keeping the hardware I2C engine for DVI/HDMI
sinks.

> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
> index b498fc5fbb140..678caffa3d120 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
> @@ -3373,6 +3373,22 @@ STATIC_IFN_KUNIT int amdgpu_dm_i2c_xfer(struct i2c_adapter *i2c_adap,
>  	int i;
>  	int result = -EIO;
>  
> +	if (!i2c->oem) {
> +		struct dc_link *link = ddc_service->link;
> +		struct amdgpu_dm_connector *aconnector = link->priv;

[Severity: High]
Can ddc_service->link be NULL here?

Previously, amdgpu_dm_i2c_xfer() checked ddc_service->ddc_pin before
dereferencing ddc_service->link. Moving this block ahead of the
ddc_service->ddc_pin check without verifying that link is non-NULL causes a
NULL pointer dereference in the existing KUnit test
dm_test_i2c_xfer_no_ddc_pin():

drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c:dm_test_i2c_xfer_no_ddc_pin() {
	...
	i2c->ddc_service = ddc;
	i2c_set_adapdata(&i2c->base, i2c);

	/* ddc->ddc_pin is NULL -> transfer is rejected with -EIO. */
	KUNIT_EXPECT_EQ(test, amdgpu_dm_i2c_xfer(&i2c->base, NULL, 0), -EIO);
}

In that test, i2c->oem is false and ddc->link is NULL, so evaluating
link->priv crashes immediately.

> +
> +		/*
> +		 * DDC to a native DisplayPort sink is tunneled over the AUX
> +		 * channel; the physical i2c pins only reach DVI/HDMI sinks
> +		 * (e.g. DP++ with a passive adapter).  Route accordingly so
> +		 * the connector's single "ddc" bus works for either sink.
> +		 */
> +		if (aconnector && link->local_sink &&
> +		    dc_is_dp_signal(link->local_sink->sink_signal) &&

[Severity: Critical]
What protects link->local_sink against concurrent hotplug or link detection
while amdgpu_dm_i2c_xfer() reads and dereferences it?

Userspace I2C transfers on /dev/i2c-N invoke amdgpu_dm_i2c_xfer() holding
only i2c_adap->bus_lock, without acquiring aconnector->hpd_lock or
adev->dm.dc_lock and without taking a sink reference via dc_sink_retain().

Concurrently, link detection and disconnect paths release and free
link->local_sink before clearing or updating the pointer:

drivers/gpu/drm/amd/display/dc/link/link_detection.c:link_disconnect_sink() {
	if (link->local_sink) {
		dc_sink_release(link->local_sink);
		link->local_sink = NULL;
	}
	...
}

drivers/gpu/drm/amd/display/dc/link/link_detection.c:link_disconnect_remap() {
	dc_sink_release(link->local_sink);
	link->local_sink = prev_sink;
}

Similar unserialized releases happen in amdgpu_dm_connector_poll(),
amdgpu_dm_emulated_link_detect(), and detect_link_and_local_sink() (for
example when a temporary local_sink with refcount 1 is released on EDID
read failure, same_edid remap, or MST topology discovery). Could a
concurrent I2C transfer observe a non-NULL link->local_sink and suffer a
use-after-free or NULL pointer dereference when reading
link->local_sink->sink_signal?

> +		    aconnector->dm_dp_aux.aux.ddc.algo)
> +			return i2c_transfer(&aconnector->dm_dp_aux.aux.ddc, msgs, num);
> +	}

[Severity: Medium]
Will checking link->local_sink and dc_is_dp_signal() work for DP MST links
or links with force_to_use_aux set?

When an MST topology is started in discover_dp_mst_topology(),
link_disconnect_sink() is called immediately:

drivers/gpu/drm/amd/display/dc/link/link_detection.c:discover_dp_mst_topology() {
	...
	if (dm_helpers_dp_mst_start_top_mgr(link->ctx,
			link, (reason == DETECT_REASON_BOOT || reason == DETECT_REASON_RESUMEFROMS3S4))) {
		link_disconnect_sink(link);
	} else {
	...
}

This sets link->local_sink to NULL while downstream sinks are stored in
link->remote_sinks[], so link->local_sink is NULL on active MST links and
transfers will not be routed to the AUX adapter as described in the commit
message.

Additionally, on connectors with link->force_to_use_aux set (such as ASICs
with no_ddc_pin where ddc_service->ddc_pin is NULL), detect_dp() sets the
transaction type to DDC_TRANSACTION_TYPE_I2C_OVER_AUX (setting
link->aux_mode = true) while dp_passive_dongle_detection() sets
sink_caps->signal to HDMI or DVI:

drivers/gpu/drm/amd/display/dc/link/link_detection.c:detect_dp() {
	...
		if (!detect_dp_sink_caps(link)) {
			if (link->force_to_use_aux) {
				sink_caps->signal = dp_passive_dongle_detection(link->ddc, sink_caps, audio_support);
	...
}

In that case dc_is_dp_signal(link->local_sink->sink_signal) is false and
the transfer falls through to the hardware I2C path (or fails with -EIO
when ddc_pin is NULL). Would checking link->aux_mode (similar to other DDC
selection paths in amdgpu_dm) handle native DP, MST, and force_to_use_aux
links without dereferencing link->local_sink?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261103-superm1-amdgpu-ddc-v2-1-7bde6d004382@kernel.org?part=1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] drm/amd/display: Route connector DDC over AUX for native DP sinks
  2026-11-03 14:18 [PATCH v2] drm/amd/display: Route connector DDC over AUX for native DP sinks Mario Limonciello
  2026-11-03 14:36 ` sashiko-bot
@ 2026-11-15  8:20 ` Wayne Lin
  2026-11-15 14:06   ` Mario Limonciello
  1 sibling, 1 reply; 9+ messages in thread
From: Wayne Lin @ 2026-11-15  8:20 UTC (permalink / raw)
  To: amd-gfx
  Cc: Mario Limonciello, Harry Wentland, Leo Li, Alex Deucher,
	Richard Hughes, simonit.orig, dri-devel

Reviewed-by: Wayne Lin <Wayne.Lin@amd.com>

On Tue, 03 Nov 2026 08:18:40 -0600, Mario Limonciello wrote:
> On DisplayPort and eDP connectors DDC is tunneled over the AUX channel,
> but the connector's "ddc" adapter ("AMDGPU DM i2c hw bus N") always
> drives the physical i2c pins, which don't reach a native DP sink.  The
> AUX backed adapter ("AMDGPU DM aux hw bus N") does, so userspace such as
> fwupd, which uses the "ddc" sysfs link for DDC/CI, has to work around
> this.
>
> Keep a single i2c bus per connector and pick the transport per transfer
> based on the detected sink: if the sink is a native DP/eDP/MST sink,
> forward the transfer to the AUX adapter, otherwise (DVI/HDMI, including
> DP++ with a passive adapter) use the hw i2c engine as before.
>
> Reported-by: simonit.orig@gmail.com
> Closes: https://github.com/fwupd/fwupd/pull/11308
> Signed-off-by: Mario Limonciello <superm1@kernel.org>
> ---
> Changes in v2:
> - Check which i2c bus to use on the fly instead of changing static symlink to
>   avoid regressing passive adapters.
> - Link to v1: https://patch.msgid.link/20261102-superm1-amdgpu-ddc-v1-1-9c5cb4a4f62d@amd.com
> ---
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c  | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
> index b498fc5fbb140..678caffa3d120 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
> @@ -3373,6 +3373,22 @@ STATIC_IFN_KUNIT int amdgpu_dm_i2c_xfer(struct i2c_adapter *i2c_adap,
>  	int i;
>  	int result = -EIO;
>  
> +	if (!i2c->oem) {
> +		struct dc_link *link = ddc_service->link;
> +		struct amdgpu_dm_connector *aconnector = link->priv;
> +
> +		/*
> +		 * DDC to a native DisplayPort sink is tunneled over the AUX
> +		 * channel; the physical i2c pins only reach DVI/HDMI sinks
> +		 * (e.g. DP++ with a passive adapter).  Route accordingly so
> +		 * the connector's single "ddc" bus works for either sink.
> +		 */
> +		if (aconnector && link->local_sink &&
> +		    dc_is_dp_signal(link->local_sink->sink_signal) &&
> +		    aconnector->dm_dp_aux.aux.ddc.algo)
> +			return i2c_transfer(&aconnector->dm_dp_aux.aux.ddc, msgs, num);
> +	}
> +
>  	if (!ddc_service->ddc_pin)
>  		return result;
>  
>
> ---
> base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
> change-id: 20261102-superm1-amdgpu-ddc-63f0eb10c022
>
> Best regards,
> --  
> Mario Limonciello <superm1@kernel.org>
>
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] drm/amd/display: Route connector DDC over AUX for native DP sinks
  2026-11-15  8:20 ` Wayne Lin
@ 2026-11-15 14:06   ` Mario Limonciello
  2026-11-18 12:46     ` Eren Özen
  0 siblings, 1 reply; 9+ messages in thread
From: Mario Limonciello @ 2026-11-15 14:06 UTC (permalink / raw)
  To: simonit.orig, Richard Hughes
  Cc: Harry Wentland, Leo Li, Alex Deucher, dri-devel, Wayne Lin,
	amd-gfx

On 11/15/26 02:20, Wayne Lin wrote:
> Reviewed-by: Wayne Lin <Wayne.Lin@amd.com>

Thanks Wayne.

Simon, Richard,

Can you please check that this resolves the issue raised?

Thanks,

> 
> On Tue, 03 Nov 2026 08:18:40 -0600, Mario Limonciello wrote:
>> On DisplayPort and eDP connectors DDC is tunneled over the AUX channel,
>> but the connector's "ddc" adapter ("AMDGPU DM i2c hw bus N") always
>> drives the physical i2c pins, which don't reach a native DP sink.  The
>> AUX backed adapter ("AMDGPU DM aux hw bus N") does, so userspace such as
>> fwupd, which uses the "ddc" sysfs link for DDC/CI, has to work around
>> this.
>>
>> Keep a single i2c bus per connector and pick the transport per transfer
>> based on the detected sink: if the sink is a native DP/eDP/MST sink,
>> forward the transfer to the AUX adapter, otherwise (DVI/HDMI, including
>> DP++ with a passive adapter) use the hw i2c engine as before.
>>
>> Reported-by: simonit.orig@gmail.com
>> Closes: https://github.com/fwupd/fwupd/pull/11308
>> Signed-off-by: Mario Limonciello <superm1@kernel.org>
>> ---
>> Changes in v2:
>> - Check which i2c bus to use on the fly instead of changing static symlink to
>>    avoid regressing passive adapters.
>> - Link to v1: https://patch.msgid.link/20261102-superm1-amdgpu-ddc-v1-1-9c5cb4a4f62d@amd.com
>> ---
>>   .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c  | 16 ++++++++++++++++
>>   1 file changed, 16 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
>> index b498fc5fbb140..678caffa3d120 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
>> @@ -3373,6 +3373,22 @@ STATIC_IFN_KUNIT int amdgpu_dm_i2c_xfer(struct i2c_adapter *i2c_adap,
>>   	int i;
>>   	int result = -EIO;
>>   
>> +	if (!i2c->oem) {
>> +		struct dc_link *link = ddc_service->link;
>> +		struct amdgpu_dm_connector *aconnector = link->priv;
>> +
>> +		/*
>> +		 * DDC to a native DisplayPort sink is tunneled over the AUX
>> +		 * channel; the physical i2c pins only reach DVI/HDMI sinks
>> +		 * (e.g. DP++ with a passive adapter).  Route accordingly so
>> +		 * the connector's single "ddc" bus works for either sink.
>> +		 */
>> +		if (aconnector && link->local_sink &&
>> +		    dc_is_dp_signal(link->local_sink->sink_signal) &&
>> +		    aconnector->dm_dp_aux.aux.ddc.algo)
>> +			return i2c_transfer(&aconnector->dm_dp_aux.aux.ddc, msgs, num);
>> +	}
>> +
>>   	if (!ddc_service->ddc_pin)
>>   		return result;
>>   
>>
>> ---
>> base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
>> change-id: 20261102-superm1-amdgpu-ddc-63f0eb10c022
>>
>> Best regards,
>> --
>> Mario Limonciello <superm1@kernel.org>
>>
>>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] drm/amd/display: Route connector DDC over AUX for native DP sinks
  2026-11-15 14:06   ` Mario Limonciello
@ 2026-11-18 12:46     ` Eren Özen
  2026-11-18 14:26       ` Mario Limonciello
  0 siblings, 1 reply; 9+ messages in thread
From: Eren Özen @ 2026-11-18 12:46 UTC (permalink / raw)
  To: Mario Limonciello
  Cc: simonit.orig, Richard Hughes, Harry Wentland, Leo Li,
	Alex Deucher, dri-devel, Wayne Lin, amd-gfx

Hi Wayne, Mario,

48b8c06b05ad ("drm/amd/display: Route connector DDC over AUX for native
DP sinks") in amd-staging-drm-next is v2 of this patch, not v3 [1].

v3 added a NULL check on ddc_service->link. Without it, the existing
KUnit test dm_test_i2c_xfer_no_ddc_pin(), whose ddc_service has no link,
dereferences a NULL link and panics the UML kernel. sashiko-bot pointed
this out on v2 [2]. It reproduces on amd-staging-drm-next 8dd68a79583a:

  RIP: 0033:amdgpu_dm_i2c_xfer+0x52/0x210
  Kernel panic - not syncing: Segfault with no mm
  ...
  dm_test_i2c_xfer_no_ddc_pin+0xaf/0x1e0

Only 670 of the 1931 amdgpu_dm tests get to run.

I don't think picking up v3 instead is the answer, though. From reading
the code, sashiko-bot's DP++ concern on v3 [3] looks right:
link->aux_mode is only written in detect_link_and_local_sink() after
detect_dp(), and nothing clears it on unplug. After a native DP monitor
is swapped for a passive DP++ HDMI adapter, the adapter ID read in
dp_passive_dongle_detection() would go over AUX. v2 doesn't have that
problem, because link_disconnect_sink() clears local_sink before
detect_dp().

In the driver, a non-OEM adapter always has ddc_service->link set
(amdgpu_dm_create_i2c() already dereferences it), so I think only the
test needs fixing. I can send a test-only patch that gives the test a
zeroed dc_link. With it, all three i2c_xfer tests pass and the suite
runs to the end again. Mario, if you'd rather fold it into a driver
follow-up, I'm happy to test that instead.

[1] https://lore.kernel.org/all/20261110-superm1-amdgpu-ddc-v3-1-9436b04d1e31@kernel.org/
[2] https://lore.kernel.org/all/sashiko-outbox-195461@kernel.org/
[3] https://lore.kernel.org/all/sashiko-outbox-207767@kernel.org/

Thanks,
Eren

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] drm/amd/display: Route connector DDC over AUX for native DP sinks
  2026-11-18 12:46     ` Eren Özen
@ 2026-11-18 14:26       ` Mario Limonciello
  2026-11-18 16:07         ` Eren Özen
  0 siblings, 1 reply; 9+ messages in thread
From: Mario Limonciello @ 2026-11-18 14:26 UTC (permalink / raw)
  To: Eren Özen
  Cc: simonit.orig, Richard Hughes, Harry Wentland, Leo Li,
	Alex Deucher, dri-devel, Wayne Lin, amd-gfx

On 11/18/26 06:46, Eren Özen wrote:
> Hi Wayne, Mario,
> 
> 48b8c06b05ad ("drm/amd/display: Route connector DDC over AUX for native
> DP sinks") in amd-staging-drm-next is v2 of this patch, not v3 [1].
> 
> v3 added a NULL check on ddc_service->link. Without it, the existing
> KUnit test dm_test_i2c_xfer_no_ddc_pin(), whose ddc_service has no link,
> dereferences a NULL link and panics the UML kernel. sashiko-bot pointed
> this out on v2 [2]. It reproduces on amd-staging-drm-next 8dd68a79583a:
> 
>    RIP: 0033:amdgpu_dm_i2c_xfer+0x52/0x210
>    Kernel panic - not syncing: Segfault with no mm
>    ...
>    dm_test_i2c_xfer_no_ddc_pin+0xaf/0x1e0
> 
> Only 670 of the 1931 amdgpu_dm tests get to run.
> 
> I don't think picking up v3 instead is the answer, though. From reading
> the code, sashiko-bot's DP++ concern on v3 [3] looks right:
> link->aux_mode is only written in detect_link_and_local_sink() after
> detect_dp(), and nothing clears it on unplug. After a native DP monitor
> is swapped for a passive DP++ HDMI adapter, the adapter ID read in
> dp_passive_dongle_detection() would go over AUX. v2 doesn't have that
> problem, because link_disconnect_sink() clears local_sink before
> detect_dp().
> 
> In the driver, a non-OEM adapter always has ddc_service->link set
> (amdgpu_dm_create_i2c() already dereferences it), so I think only the
> test needs fixing. I can send a test-only patch that gives the test a
> zeroed dc_link. With it, all three i2c_xfer tests pass and the suite
> runs to the end again. Mario, if you'd rather fold it into a driver
> follow-up, I'm happy to test that instead.
> 
> [1] https://lore.kernel.org/all/20261110-superm1-amdgpu-ddc-v3-1-9436b04d1e31@kernel.org/
> [2] https://lore.kernel.org/all/sashiko-outbox-195461@kernel.org/
> [3] https://lore.kernel.org/all/sashiko-outbox-207767@kernel.org/
> 
> Thanks,
> Eren

Eren,

Really appreciate the feedback.  If you want to share your test patch 
I'll fold it into what's currently v3 and give you a C-d-b tag for v4.

Simon,

But I still need testing this actually works for the issue originally 
raised on real hardware.

These unit test issues are just noise "for that purpose".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] drm/amd/display: Route connector DDC over AUX for native DP sinks
  2026-11-18 14:26       ` Mario Limonciello
@ 2026-11-18 16:07         ` Eren Özen
  2026-11-18 16:29           ` SimonIT
  0 siblings, 1 reply; 9+ messages in thread
From: Eren Özen @ 2026-11-18 16:07 UTC (permalink / raw)
  To: Mario Limonciello
  Cc: simonit.orig, Richard Hughes, Harry Wentland, Leo Li,
	Alex Deucher, dri-devel, Wayne Lin, amd-gfx

Hi Mario,

Thanks,  the patch is below. 

With v3's ddc_service->link check the test passes even without this
change, so in v4 it only makes the test set up the adapter the way the
driver does. I tested it on amd-staging-drm-next 8dd68a79583a, which has
v2: the three i2c_xfer tests pass and the suite runs to the end again.
The one remaining failure, dm_test_fs_caps_dp_vsdb_version, is the
dropped FreeSync hunk I reported on Cooper's thread.

One thing for v4: if it keeps routing on link->aux_mode, the DP++ case
from my last mail still applies. Simon's testing probably won't hit it
unless he swaps a native DP monitor for a passive DP++ HDMI adapter on
the same port.

Thanks,
Eren

-- >8 --
Subject: drm/amd/display: Give the no-DDC-pin i2c_xfer test a dc_link

Since commit 48b8c06b05ad ("drm/amd/display: Route connector DDC over
AUX for native DP sinks"), amdgpu_dm_i2c_xfer() reads
ddc_service->link for every non-OEM adapter before it checks for a DDC
pin. dm_test_i2c_xfer_no_ddc_pin() builds a ddc_service without a link,
so the test now dereferences a NULL pointer and panics the UML kernel.
Only 670 of the 1931 amdgpu_dm tests run.

The driver itself never creates a non-OEM adapter without a link:
amdgpu_dm_create_i2c() already dereferences it. So fix the test rather
than the driver and give the ddc_service a zeroed dc_link.

With this change the three i2c_xfer tests pass again and the suite runs
to the end.

Fixes: 48b8c06b05ad ("drm/amd/display: Route connector DDC over AUX for native DP sinks")
Link: https://lore.kernel.org/all/sashiko-outbox-195461@kernel.org/
Link: https://lore.kernel.org/all/5386db0f-e9b3-4c62-bb2b-392cca4d761a@kernel.org/
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Eren Özen <erenozen@protonmail.com>
---
 .../amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c
index 33082a674d9e..87dc722715dc 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c
@@ -6455,7 +6455,9 @@ static void dm_test_i2c_func_returns_flags(struct kunit *test)
  * @test: The KUnit test context
  *
  * When the backing ddc_service has no ddc_pin the transfer bails out early
- * with -EIO before touching the message buffers or the dc handle.
+ * with -EIO before touching the message buffers or the dc handle. Non-OEM
+ * adapters always have a link, so the test gives the ddc_service a zeroed
+ * one.
  */
 static void dm_test_i2c_xfer_no_ddc_pin(struct kunit *test)
 {
@@ -6466,6 +6468,8 @@ static void dm_test_i2c_xfer_no_ddc_pin(struct kunit *test)
 	KUNIT_ASSERT_NOT_NULL(test, i2c);
 	ddc = kunit_kzalloc(test, sizeof(*ddc), GFP_KERNEL);
 	KUNIT_ASSERT_NOT_NULL(test, ddc);
+	ddc->link = kunit_kzalloc(test, sizeof(*ddc->link), GFP_KERNEL);
+	KUNIT_ASSERT_NOT_NULL(test, ddc->link);
 
 	i2c->ddc_service = ddc;
 	i2c_set_adapdata(&i2c->base, i2c);


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] drm/amd/display: Route connector DDC over AUX for native DP sinks
  2026-11-18 16:07         ` Eren Özen
@ 2026-11-18 16:29           ` SimonIT
  2026-11-18 16:42             ` Eren Özen
  0 siblings, 1 reply; 9+ messages in thread
From: SimonIT @ 2026-11-18 16:29 UTC (permalink / raw)
  To: Eren Özen, Mario Limonciello
  Cc: Richard Hughes, Harry Wentland, Leo Li, Alex Deucher, dri-devel,
	Wayne Lin, amd-gfx

Hey guys,

Thanks guys for working on the fix!

How do I test the fix easily? I've never compiled or installed a kernel 
manually. Can you give me some hints? I don't want to corrupt my 
installation

Greetings
Simon

Am 18.11.26 um 17:07 schrieb Eren Özen:
> Hi Mario,
>
> Thanks,  the patch is below.
>
> With v3's ddc_service->link check the test passes even without this
> change, so in v4 it only makes the test set up the adapter the way the
> driver does. I tested it on amd-staging-drm-next 8dd68a79583a, which has
> v2: the three i2c_xfer tests pass and the suite runs to the end again.
> The one remaining failure, dm_test_fs_caps_dp_vsdb_version, is the
> dropped FreeSync hunk I reported on Cooper's thread.
>
> One thing for v4: if it keeps routing on link->aux_mode, the DP++ case
> from my last mail still applies. Simon's testing probably won't hit it
> unless he swaps a native DP monitor for a passive DP++ HDMI adapter on
> the same port.
>
> Thanks,
> Eren
>
> -- >8 --
> Subject: drm/amd/display: Give the no-DDC-pin i2c_xfer test a dc_link
>
> Since commit 48b8c06b05ad ("drm/amd/display: Route connector DDC over
> AUX for native DP sinks"), amdgpu_dm_i2c_xfer() reads
> ddc_service->link for every non-OEM adapter before it checks for a DDC
> pin. dm_test_i2c_xfer_no_ddc_pin() builds a ddc_service without a link,
> so the test now dereferences a NULL pointer and panics the UML kernel.
> Only 670 of the 1931 amdgpu_dm tests run.
>
> The driver itself never creates a non-OEM adapter without a link:
> amdgpu_dm_create_i2c() already dereferences it. So fix the test rather
> than the driver and give the ddc_service a zeroed dc_link.
>
> With this change the three i2c_xfer tests pass again and the suite runs
> to the end.
>
> Fixes: 48b8c06b05ad ("drm/amd/display: Route connector DDC over AUX for native DP sinks")
> Link: https://lore.kernel.org/all/sashiko-outbox-195461@kernel.org/
> Link: https://lore.kernel.org/all/5386db0f-e9b3-4c62-bb2b-392cca4d761a@kernel.org/
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Eren Özen <erenozen@protonmail.com>
> ---
>   .../amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c  | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c
> index 33082a674d9e..87dc722715dc 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c
> @@ -6455,7 +6455,9 @@ static void dm_test_i2c_func_returns_flags(struct kunit *test)
>    * @test: The KUnit test context
>    *
>    * When the backing ddc_service has no ddc_pin the transfer bails out early
> - * with -EIO before touching the message buffers or the dc handle.
> + * with -EIO before touching the message buffers or the dc handle. Non-OEM
> + * adapters always have a link, so the test gives the ddc_service a zeroed
> + * one.
>    */
>   static void dm_test_i2c_xfer_no_ddc_pin(struct kunit *test)
>   {
> @@ -6466,6 +6468,8 @@ static void dm_test_i2c_xfer_no_ddc_pin(struct kunit *test)
>   	KUNIT_ASSERT_NOT_NULL(test, i2c);
>   	ddc = kunit_kzalloc(test, sizeof(*ddc), GFP_KERNEL);
>   	KUNIT_ASSERT_NOT_NULL(test, ddc);
> +	ddc->link = kunit_kzalloc(test, sizeof(*ddc->link), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_NULL(test, ddc->link);
>   
>   	i2c->ddc_service = ddc;
>   	i2c_set_adapdata(&i2c->base, i2c);

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] drm/amd/display: Route connector DDC over AUX for native DP sinks
  2026-11-18 16:29           ` SimonIT
@ 2026-11-18 16:42             ` Eren Özen
  0 siblings, 0 replies; 9+ messages in thread
From: Eren Özen @ 2026-11-18 16:42 UTC (permalink / raw)
  To: SimonIT
  Cc: Mario Limonciello, Richard Hughes, Harry Wentland, Leo Li,
	Alex Deucher, dri-devel, Wayne Lin, amd-gfx

Hi Simon,

To avoid a mix-up: the patch in my mail only fixes a unit test that
runs in a simulated kernel during development. It doesn't change how
the  driver talks to your monitor,so there's nothing in it for you to
test.

The fix for your problem is Mario's patch. He's about to fold my test
change into a v4, so it's best to wait for him to say which version to
test.

About breaking your installation, a kernel you build yourself is
normally installed next to your distribution's kernel, not over it. If
it doesn't work, you pick the old kernel in the boot menu and nothing
is lost.

Thanks,
Eren


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-11-19  7:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-03 14:18 [PATCH v2] drm/amd/display: Route connector DDC over AUX for native DP sinks Mario Limonciello
2026-11-03 14:36 ` sashiko-bot
2026-11-15  8:20 ` Wayne Lin
2026-11-15 14:06   ` Mario Limonciello
2026-11-18 12:46     ` Eren Özen
2026-11-18 14:26       ` Mario Limonciello
2026-11-18 16:07         ` Eren Özen
2026-11-18 16:29           ` SimonIT
2026-11-18 16:42             ` Eren Özen

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.