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/[email protected]/
Link:
https://lore.kernel.org/all/[email protected]/
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Eren Özen <[email protected]>
---
.../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);