Skip to contentSkip to conversation

drm/msm/dp: skip validity check for DP CTS EDID checksum

PATCH Applied Jani Nikula 4 participants 6 messages Sep 1, 2023 – Oct 8, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/msm/dp: skip validity check for DP CTS EDID checksum

The DP CTS test for EDID last block checksum expects the checksum for the last block, invalid or not. Skip the validity check.

For the most part (*), the EDIDs returned by drm_get_edid() will be valid anyway, and there's the CTS workaround to get the checksum for completely invalid EDIDs. See commit 7948fe12d47a ("drm/msm/dp: return correct edid checksum after corrupted edid checksum read").

This lets us remove one user of drm_edid_block_valid() with hopes the function can be removed altogether in the future.

(*) drm_get_edid() ignores checksum errors on CTA extensions.

Cc Abhinav Kumar <[email protected]>
Cc Dmitry Baryshkov <[email protected]>
Cc Kuogee Hsieh <[email protected]>
Cc Marijn Suijten <[email protected]>
Cc Rob Clark <[email protected]>
Cc Sean Paul <[email protected]>
Cc Stephen Boyd <[email protected]>
---
 drivers/gpu/drm/msm/dp/dp_panel.c | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)
drivers/gpu/drm/msm/dp/dp_panel.c +2 -19
index 42d52510ffd4..86a8e06c7a60 100644
@@ -289,26 +289,9 @@ int dp_panel_get_modes(struct dp_panel *dp_panel,
 
 static u8 dp_panel_get_edid_checksum(struct edid *edid)
 {
-	struct edid *last_block;
-	u8 *raw_edid;
-	bool is_edid_corrupt = false;
+	edid += edid->extensions;
 
-	if (!edid) {
-		DRM_ERROR("invalid edid input\n");
-		return 0;
-	}
-
-	raw_edid = (u8 *)edid;
-	raw_edid += (edid->extensions * EDID_LENGTH);
-	last_block = (struct edid *)raw_edid;
-
-	/* block type extension */
-	drm_edid_block_valid(raw_edid, 1, false, &is_edid_corrupt);
-	if (!is_edid_corrupt)
-		return last_block->checksum;
-
-	DRM_ERROR("Invalid block, no checksum\n");
-	return 0;
+	return edid->checksum;
 }
 
 void dp_panel_handle_sink_request(struct dp_panel *dp_panel)
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw

Quoting Jani Nikula (2023-09-01 07:20:34)

Quoted 23 lines

The DP CTS test for EDID last block checksum expects the checksum for the last block, invalid or not. Skip the validity check.

For the most part (*), the EDIDs returned by drm_get_edid() will be valid anyway, and there's the CTS workaround to get the checksum for completely invalid EDIDs. See commit 7948fe12d47a ("drm/msm/dp: return correct edid checksum after corrupted edid checksum read").

This lets us remove one user of drm_edid_block_valid() with hopes the function can be removed altogether in the future.

(*) drm_get_edid() ignores checksum errors on CTA extensions.

Cc Abhinav Kumar <[email protected]>
Cc Dmitry Baryshkov <[email protected]>
Cc Kuogee Hsieh <[email protected]>
Cc Marijn Suijten <[email protected]>
Cc Rob Clark <[email protected]>
Cc Sean Paul <[email protected]>
Cc Stephen Boyd <[email protected]>
Quoted 1 line

---

drivers/gpu/drm/msm/dp/dp_panel.c int dp_panel_get_modes(struct dp_panel *dp_panel, · line 290

Quoted 8 lines
drivers/gpu/drm/msm/dp/dp_panel.c +0 -0
index 42d52510ffd4..86a8e06c7a60 100644
@@ -289,26 +289,9 @@ int dp_panel_get_modes(struct dp_panel *dp_panel,
 
 static u8 dp_panel_get_edid_checksum(struct edid *edid)

It would be nice to make 'edid' const here in another patch.

#2 lore raw
Quoted 26 lines · Stephen Boyd

Quoting Jani Nikula (2023-09-01 07:20:34)

Quoted 23 lines

The DP CTS test for EDID last block checksum expects the checksum for the last block, invalid or not. Skip the validity check.

For the most part (*), the EDIDs returned by drm_get_edid() will be valid anyway, and there's the CTS workaround to get the checksum for completely invalid EDIDs. See commit 7948fe12d47a ("drm/msm/dp: return correct edid checksum after corrupted edid checksum read").

This lets us remove one user of drm_edid_block_valid() with hopes the function can be removed altogether in the future.

(*) drm_get_edid() ignores checksum errors on CTA extensions.

Cc Abhinav Kumar <[email protected]>
Cc Dmitry Baryshkov <[email protected]>
Cc Kuogee Hsieh <[email protected]>
Cc Marijn Suijten <[email protected]>
Cc Rob Clark <[email protected]>
Cc Sean Paul <[email protected]>
Cc Stephen Boyd <[email protected]>
Quoted 1 line

---

Quoted 1 line

Thanks; is that enough to merge? I can't claim I would have been able to test this.

Quoted 11 lines

drivers/gpu/drm/msm/dp/dp_panel.c int dp_panel_get_modes(struct dp_panel *dp_panel, · line 290

Quoted 9 lines
drivers/gpu/drm/msm/dp/dp_panel.c +0 -0
index 42d52510ffd4..86a8e06c7a60 100644
@@ -289,26 +289,9 @@ int dp_panel_get_modes(struct dp_panel *dp_panel,
 
 static u8 dp_panel_get_edid_checksum(struct edid *edid)

It would be nice to make 'edid' const here in another patch.

Sure.

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel
Reviewed-by
#3 lore raw

Hi Jani

Quoted 27 lines · Jani Nikula
Quoted 26 lines · Stephen Boyd

Quoting Jani Nikula (2023-09-01 07:20:34)

Quoted 24 lines

The DP CTS test for EDID last block checksum expects the checksum for the last block, invalid or not. Skip the validity check.

For the most part (*), the EDIDs returned by drm_get_edid() will be valid anyway, and there's the CTS workaround to get the checksum for completely invalid EDIDs. See commit 7948fe12d47a ("drm/msm/dp: return correct edid checksum after corrupted edid checksum read").

This lets us remove one user of drm_edid_block_valid() with hopes the function can be removed altogether in the future.

(*) drm_get_edid() ignores checksum errors on CTA extensions.

Cc Abhinav Kumar <[email protected]>
Cc Dmitry Baryshkov <[email protected]>
Cc Kuogee Hsieh <[email protected]>
Cc Marijn Suijten <[email protected]>
Cc Rob Clark <[email protected]>
Cc Sean Paul <[email protected]>
Cc Stephen Boyd <[email protected]>

---

Quoted 5 lines
Quoted 1 line

Thanks; is that enough to merge? I can't claim I would have been able to test this.

Change looks fine.

We can pick this up in the MSM tree if you would like.

Dmitry, you can please pick this up along with my R-b and Kuogee's R-b as well.

I think his R-b got misformatted. I can ask him to add that again.

Quoted 18 lines
Quoted 11 lines

drivers/gpu/drm/msm/dp/dp_panel.c int dp_panel_get_modes(struct dp_panel *dp_panel, · line 290

Quoted 9 lines
drivers/gpu/drm/msm/dp/dp_panel.c +0 -0
index 42d52510ffd4..86a8e06c7a60 100644
@@ -289,26 +289,9 @@ int dp_panel_get_modes(struct dp_panel *dp_panel,
 
  static u8 dp_panel_get_edid_checksum(struct edid *edid)

It would be nice to make 'edid' const here in another patch.

Sure.

BR,
Jani.

#4 lore raw
Quoted 36 lines · Abhinav Kumar

Hi Jani

Quoted 27 lines · Jani Nikula
Quoted 26 lines · Stephen Boyd

Quoting Jani Nikula (2023-09-01 07:20:34)

Quoted 24 lines

The DP CTS test for EDID last block checksum expects the checksum for the last block, invalid or not. Skip the validity check.

For the most part (*), the EDIDs returned by drm_get_edid() will be valid anyway, and there's the CTS workaround to get the checksum for completely invalid EDIDs. See commit 7948fe12d47a ("drm/msm/dp: return correct edid checksum after corrupted edid checksum read").

This lets us remove one user of drm_edid_block_valid() with hopes the function can be removed altogether in the future.

(*) drm_get_edid() ignores checksum errors on CTA extensions.

Cc Abhinav Kumar <[email protected]>
Cc Dmitry Baryshkov <[email protected]>
Cc Kuogee Hsieh <[email protected]>
Cc Marijn Suijten <[email protected]>
Cc Rob Clark <[email protected]>
Cc Sean Paul <[email protected]>
Cc Stephen Boyd <[email protected]>

---

Quoted 5 lines
Quoted 1 line

Thanks; is that enough to merge? I can't claim I would have been able to test this.

Quoted 5 lines

Change looks fine.

We can pick this up in the MSM tree if you would like.

I'd appreciate that, thanks!

BR,
Jani.

Quoted 24 lines

Dmitry, you can please pick this up along with my R-b and Kuogee's R-b as well.

I think his R-b got misformatted. I can ask him to add that again.

Quoted 18 lines
Quoted 11 lines

drivers/gpu/drm/msm/dp/dp_panel.c int dp_panel_get_modes(struct dp_panel *dp_panel, · line 290

Quoted 9 lines
drivers/gpu/drm/msm/dp/dp_panel.c +0 -0
index 42d52510ffd4..86a8e06c7a60 100644
@@ -289,26 +289,9 @@ int dp_panel_get_modes(struct dp_panel *dp_panel,
 
  static u8 dp_panel_get_edid_checksum(struct edid *edid)

It would be nice to make 'edid' const here in another patch.

Sure.

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel
#5 lore raw
In reply to Jani Nikula
Quoted 9 lines · Jani Nikula

The DP CTS test for EDID last block checksum expects the checksum for the last block, invalid or not. Skip the validity check.

For the most part (*), the EDIDs returned by drm_get_edid() will be valid anyway, and there's the CTS workaround to get the checksum for completely invalid EDIDs. See commit 7948fe12d47a ("drm/msm/dp: return correct edid checksum after corrupted edid checksum read").

[...]

Applied, thanks!

[1/1] drm/msm/dp: skip validity check for DP CTS EDID checksum

      https://gitlab.freedesktop.org/lumag/msm/-/commit/22e96e73182c

Best regards,

Signature · 1 line
Dmitry Baryshkov <[email protected]>