From: Ivan Lipski <[email protected]>

[Why&How]
Enable HDCP on DCN6 by
- Enabling dc_is_dmub_outbox_supported if fused_io (fw locality)
  is supported
- Plumbing DTM TA v3 support to it.

Cc: Alvin Lee <[email protected]>
Signed-off-by: Ivan Lipski <[email protected]>
Signed-off-by: Wayne Lin <[email protected]>
---
 .../amd/display/amdgpu_dm/amdgpu_dm_hdcp.c    |  3 ++-
 .../amdgpu_dm/tests/amdgpu_dm_hdcp_test.c     | 27 +++++++++++++++++++
 drivers/gpu/drm/amd/display/dc/core/dc.c      |  4 +++
 3 files changed, 33 insertions(+), 1 deletion(-)

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 47cbc826ed45..3cf96cc38575 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
@@ -883,7 +883,8 @@ struct hdcp_workqueue *hdcp_create_workqueue(struct 
amdgpu_device *adev,
                    dc->ctx->dce_version == DCN_VERSION_3_5  ||
                    dc->ctx->dce_version == DCN_VERSION_3_51 ||
                    dc->ctx->dce_version == DCN_VERSION_3_6  ||
-                   dc->ctx->dce_version == DCN_VERSION_4_01)
+                   dc->ctx->dce_version == DCN_VERSION_4_01 ||
+                   dc->ctx->dce_version == DCN_VERSION_6_0)
                        config->psp.caps.dtm_v3_supported = 1;
 
                config->ddc.handle = dc_get_link_at_index(dc, i);
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_hdcp_test.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_hdcp_test.c
index 5af6ae47bb21..b0691a83d3da 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_hdcp_test.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_hdcp_test.c
@@ -1247,6 +1247,32 @@ static void 
dm_test_hdcp_create_workqueue_sets_dtm_v3_for_dcn31(struct kunit *te
        hdcp_destroy(&adev->dev->kobj, work);
 }
 
+/**
+ * dm_test_hdcp_create_workqueue_sets_dtm_v3_for_dcn60 - DCN 6.0 enables DTM v3
+ * @test: KUnit test context
+ *
+ * On a DCN 6.0 device, hdcp_create_workqueue() must set the per-link
+ * dtm_v3_supported cap.
+ */
+static void dm_test_hdcp_create_workqueue_sets_dtm_v3_for_dcn60(struct kunit 
*test)
+{
+       struct amdgpu_device *adev = dm_kunit_alloc_adev(test);
+       struct cp_psp cp_psp = {0};
+       struct dc *dc = dm_kunit_alloc_dc_with_ctx(test);
+       struct hdcp_workqueue *work;
+
+       adev->dev = adev->ddev.dev;
+       dc->caps.max_links = 1;
+       dc->ctx->dce_version = DCN_VERSION_6_0;
+
+       work = hdcp_create_workqueue(adev, &cp_psp, dc);
+
+       KUNIT_ASSERT_NOT_NULL(test, work);
+       KUNIT_EXPECT_EQ(test, work[0].hdcp.config.psp.caps.dtm_v3_supported, 1);
+
+       hdcp_destroy(&adev->dev->kobj, work);
+}
+
 /**
  * dm_test_hdcp_create_workqueue_initializes_all_links - loop covers every link
  * @test: KUnit test context
@@ -2564,6 +2590,7 @@ static struct kunit_case dm_hdcp_test_cases[] = {
        KUNIT_CASE(dm_test_hdcp_create_workqueue_zero_max_links_returns_null),
        KUNIT_CASE(dm_test_hdcp_create_workqueue_initializes_work),
        KUNIT_CASE(dm_test_hdcp_create_workqueue_sets_dtm_v3_for_dcn31),
+       KUNIT_CASE(dm_test_hdcp_create_workqueue_sets_dtm_v3_for_dcn60),
        KUNIT_CASE(dm_test_hdcp_create_workqueue_initializes_all_links),
        /* hdcp_destroy() */
        KUNIT_CASE(dm_test_hdcp_destroy_frees_and_removes_sysfs),
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c 
b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 6f2f219a928a..656a941b1ba0 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -6850,6 +6850,10 @@ bool dc_is_dmub_outbox_supported(struct dc *dc)
                break;
        }
 
+       /* Fused IO replies (e.g. HDCP FW locality check) arrive via outbox 
notifications */
+       if (dc->caps.fused_io_supported)
+               return true;
+
        /* dmub aux needs dmub notifications to be enabled */
        return dc->debug.enable_dmub_aux_for_legacy_ddc;
 
-- 
2.43.0

Reply via email to