Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/xe: Use gsc_proxy_init_done to check proxy status

Expose gsc_proxy_init_done so that we can check if gsc proxy has
been initialized or not.

--v2
-Check if GSC FW is enabled before taking forcewake ref [Daniele]

--v3
-Directly call proxy check function inside if condition

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: Mika Kahola <mika.kahola@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240306024247.1857881-5-suraj.kandpal@intel.com

authored by

Suraj Kandpal and committed by
Mika Kahola
4af50beb b8e7996f

+31 -3
+28 -1
drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
··· 4 4 */ 5 5 6 6 #include <drm/drm_print.h> 7 + 7 8 #include "intel_hdcp_gsc.h" 8 9 #include "xe_device_types.h" 10 + #include "xe_device.h" 11 + #include "xe_gt.h" 12 + #include "xe_gsc_proxy.h" 13 + #include "xe_pm.h" 14 + #include "xe_uc_fw.h" 9 15 10 16 bool intel_hdcp_gsc_cs_required(struct xe_device *xe) 11 17 { ··· 20 14 21 15 bool intel_hdcp_gsc_check_status(struct xe_device *xe) 22 16 { 23 - return false; 17 + struct xe_tile *tile = xe_device_get_root_tile(xe); 18 + struct xe_gt *gt = tile->media_gt; 19 + bool ret = true; 20 + 21 + if (!xe_uc_fw_is_enabled(&gt->uc.gsc.fw)) 22 + return false; 23 + 24 + xe_pm_runtime_get(xe); 25 + if (xe_force_wake_get(gt_to_fw(gt), XE_FW_GSC)) { 26 + drm_dbg_kms(&xe->drm, 27 + "failed to get forcewake to check proxy status\n"); 28 + ret = false; 29 + goto out; 30 + } 31 + 32 + if (!xe_gsc_proxy_init_done(&gt->uc.gsc)) 33 + ret = false; 34 + 35 + xe_force_wake_put(gt_to_fw(gt), XE_FW_GSC); 36 + out: 37 + xe_pm_runtime_put(xe); 38 + return ret; 24 39 } 25 40 26 41 int intel_hdcp_gsc_init(struct xe_device *xe)
+2 -2
drivers/gpu/drm/xe/xe_gsc_proxy.c
··· 66 66 return dev_get_drvdata(kdev); 67 67 } 68 68 69 - static bool gsc_proxy_init_done(struct xe_gsc *gsc) 69 + bool xe_gsc_proxy_init_done(struct xe_gsc *gsc) 70 70 { 71 71 struct xe_gt *gt = gsc_to_gt(gsc); 72 72 u32 fwsts1 = xe_mmio_read32(gt, HECI_FWSTS1(MTL_GSC_HECI1_BASE)); ··· 528 528 if (err) 529 529 return err; 530 530 531 - if (!gsc_proxy_init_done(gsc)) { 531 + if (!xe_gsc_proxy_init_done(gsc)) { 532 532 xe_gt_err(gsc_to_gt(gsc), "GSC FW reports proxy init not completed\n"); 533 533 return -EIO; 534 534 }
+1
drivers/gpu/drm/xe/xe_gsc_proxy.h
··· 11 11 struct xe_gsc; 12 12 13 13 int xe_gsc_proxy_init(struct xe_gsc *gsc); 14 + bool xe_gsc_proxy_init_done(struct xe_gsc *gsc); 14 15 void xe_gsc_proxy_remove(struct xe_gsc *gsc); 15 16 int xe_gsc_proxy_start(struct xe_gsc *gsc); 16 17