drm/xe: Use gsc_proxy_init_done to check proxy status
authorSuraj Kandpal <suraj.kandpal@intel.com>
Wed, 6 Mar 2024 02:42:47 +0000 (08:12 +0530)
committerMika Kahola <mika.kahola@intel.com>
Wed, 6 Mar 2024 07:50:48 +0000 (09:50 +0200)
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
drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
drivers/gpu/drm/xe/xe_gsc_proxy.c
drivers/gpu/drm/xe/xe_gsc_proxy.h

index 5d1d0054b57865ac9a179fbca9a434586f1bdef1..3af5a86db3aa89d41bc2146a49b71dc9af1c54b6 100644 (file)
@@ -4,8 +4,14 @@
  */
 
 #include <drm/drm_print.h>
+
 #include "intel_hdcp_gsc.h"
 #include "xe_device_types.h"
+#include "xe_device.h"
+#include "xe_gt.h"
+#include "xe_gsc_proxy.h"
+#include "xe_pm.h"
+#include "xe_uc_fw.h"
 
 bool intel_hdcp_gsc_cs_required(struct xe_device *xe)
 {
@@ -14,7 +20,28 @@ bool intel_hdcp_gsc_cs_required(struct xe_device *xe)
 
 bool intel_hdcp_gsc_check_status(struct xe_device *xe)
 {
-       return false;
+       struct xe_tile *tile = xe_device_get_root_tile(xe);
+       struct xe_gt *gt = tile->media_gt;
+       bool ret = true;
+
+       if (!xe_uc_fw_is_enabled(&gt->uc.gsc.fw))
+               return false;
+
+       xe_pm_runtime_get(xe);
+       if (xe_force_wake_get(gt_to_fw(gt), XE_FW_GSC)) {
+               drm_dbg_kms(&xe->drm,
+                           "failed to get forcewake to check proxy status\n");
+               ret = false;
+               goto out;
+       }
+
+       if (!xe_gsc_proxy_init_done(&gt->uc.gsc))
+               ret = false;
+
+       xe_force_wake_put(gt_to_fw(gt), XE_FW_GSC);
+out:
+       xe_pm_runtime_put(xe);
+       return ret;
 }
 
 int intel_hdcp_gsc_init(struct xe_device *xe)
index 309ef80e3b95e8febf0f9bc5e6e01ece11c13376..1ced6b4d494659c84d87c9949ef7f66480498077 100644 (file)
@@ -66,7 +66,7 @@ static inline struct xe_device *kdev_to_xe(struct device *kdev)
        return dev_get_drvdata(kdev);
 }
 
-static bool gsc_proxy_init_done(struct xe_gsc *gsc)
+bool xe_gsc_proxy_init_done(struct xe_gsc *gsc)
 {
        struct xe_gt *gt = gsc_to_gt(gsc);
        u32 fwsts1 = xe_mmio_read32(gt, HECI_FWSTS1(MTL_GSC_HECI1_BASE));
@@ -528,7 +528,7 @@ int xe_gsc_proxy_start(struct xe_gsc *gsc)
        if (err)
                return err;
 
-       if (!gsc_proxy_init_done(gsc)) {
+       if (!xe_gsc_proxy_init_done(gsc)) {
                xe_gt_err(gsc_to_gt(gsc), "GSC FW reports proxy init not completed\n");
                return -EIO;
        }
index 908f9441f0934031d8bd4071a8b0818e80bfcf39..c511ade6b8637839756aeb2e61bfaf85b95c0217 100644 (file)
@@ -11,6 +11,7 @@
 struct xe_gsc;
 
 int xe_gsc_proxy_init(struct xe_gsc *gsc);
+bool xe_gsc_proxy_init_done(struct xe_gsc *gsc);
 void xe_gsc_proxy_remove(struct xe_gsc *gsc);
 int xe_gsc_proxy_start(struct xe_gsc *gsc);