[PATCH 13/19] drm/amd/display: force CP to DESIRED when removing display.

Pillai, Aurabindo Aurabindo.Pillai at amd.com
Mon Apr 19 15:42:16 UTC 2021


[AMD Official Use Only - Internal Distribution Only]

This patch introduces a null pointer deref on MST hotplug, so this shall be dropped.

--

Thanks & Regards,
Aurabindo Pillai
________________________________
From: Aurabindo Pillai <aurabindo.pillai at amd.com>
Sent: Friday, April 16, 2021 10:34 AM
To: amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>
Cc: Wentland, Harry <Harry.Wentland at amd.com>; Li, Sun peng (Leo) <Sunpeng.Li at amd.com>; Lakha, Bhawanpreet <Bhawanpreet.Lakha at amd.com>; Siqueira, Rodrigo <Rodrigo.Siqueira at amd.com>; Pillai, Aurabindo <Aurabindo.Pillai at amd.com>; Zhuo, Qingqing <Qingqing.Zhuo at amd.com>; Brol, Eryk <Eryk.Brol at amd.com>; R, Bindu <Bindu.R at amd.com>; Jacob, Anson <Anson.Jacob at amd.com>; Zhang, Dingchen (David) <Dingchen.Zhang at amd.com>; Zhang, Dingchen (David) <Dingchen.Zhang at amd.com>
Subject: [PATCH 13/19] drm/amd/display: force CP to DESIRED when removing display.

From: "Dingchen (David) Zhang" <dingchen.zhang at amd.com>

[why]
It is possible that the commit from userspace to cause link stream
disable and hdcp auth reset when the HDCP has been enabled at the
moment. We'd expect the CP prop back to DESIRED from ENABLED.

[how]
In the helper of hdcp display removal, we check and change the CP prop
to DESIRED if at the moment CP is ENABLED before the auth reset and
removal of linked list element.

Signed-off-by: Dingchen (David) Zhang <dingchen.zhang at amd.com>
Reviewed-by: Dingchen Zhang <Dingchen.Zhang at amd.com>
Acked-by: Aurabindo Pillai <aurabindo.pillai at amd.com>
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c  | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
index 616f5b1ea3a8..50f6b3a86931 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
@@ -160,6 +160,7 @@ static void link_lock(struct hdcp_workqueue *work, bool lock)
                         mutex_unlock(&work[i].mutex);
         }
 }
+
 void hdcp_update_display(struct hdcp_workqueue *hdcp_work,
                          unsigned int link_index,
                          struct amdgpu_dm_connector *aconnector,
@@ -222,10 +223,22 @@ static void hdcp_remove_display(struct hdcp_workqueue *hdcp_work,
                          struct amdgpu_dm_connector *aconnector)
 {
         struct hdcp_workqueue *hdcp_w = &hdcp_work[link_index];
+       struct drm_connector_state *conn_state = aconnector->base.state;

         mutex_lock(&hdcp_w->mutex);
         hdcp_w->aconnector = aconnector;

+       /* the removal of display will invoke auth reset -> hdcp destroy and
+        * we'd expect the CP prop changed back to DESIRED if at the time ENABLED.
+        * the CP prop change should occur before the element removed from linked list.
+        */
+       if (conn_state && conn_state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED) {
+               conn_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;
+
+               pr_debug("[HDCP_DM] display %d, CP 2 -> 1, type %u, DPMS %u\n",
+                        aconnector->base.index, conn_state->hdcp_content_type, aconnector->base.dpms);
+       }
+
         mod_hdcp_remove_display(&hdcp_w->hdcp, aconnector->base.index, &hdcp_w->output);

         process_output(hdcp_w);
--
2.31.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20210419/9946cdf6/attachment.htm>


More information about the amd-gfx mailing list