OSDN Git Service

drm/amd/display: Improvements in secure display
authorAlan Liu <HaoPing.Liu@amd.com>
Fri, 2 Dec 2022 11:10:34 +0000 (19:10 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 3 Jan 2023 21:51:12 +0000 (16:51 -0500)
[Why]
- Need error message when failing to allocating secure_display_ctx.
- Need to check if secure display context in psp is initialized or not
before using it.

[How]
- Add error message when memory allocation fail.
- Add check before accessing psp secure display context.

Acked-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Alan Liu <HaoPing.Liu@amd.com>
Reviewed-by: Wayne Lin <Wayne.Lin@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c

index 0a3eb6d..2ff3d4f 100644 (file)
@@ -1643,6 +1643,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 #endif
 #if defined(CONFIG_DRM_AMD_SECURE_DISPLAY)
        adev->dm.secure_display_ctxs = amdgpu_dm_crtc_secure_display_create_contexts(adev);
+       if (!adev->dm.secure_display_ctxs) {
+               DRM_ERROR("amdgpu: failed to initialize secure_display_ctxs.\n");
+       }
 #endif
        if (dc_is_dmub_outbox_supported(adev->dm.dc)) {
                init_completion(&adev->dm.dmub_aux_transfer_done);
index 8bf33fa..ad73e58 100644 (file)
@@ -117,6 +117,12 @@ static void amdgpu_dm_crtc_notify_ta_to_read(struct work_struct *work)
        }
 
        psp = &drm_to_adev(crtc->dev)->psp;
+
+       if (!psp->securedisplay_context.context.initialized) {
+               DRM_DEBUG_DRIVER("Secure Display fails to notify PSP TA\n");
+               return;
+       }
+
        stream = to_amdgpu_crtc(crtc)->dm_irq_params.stream;
        phy_inst = stream->link->link_enc_hw_inst;