On legacy platforms, KCR HW enabling is done at the time the mei
component interface is bound. It's also disabled during unbind.
However, for MTL onwards, we don't depend on a tee component
to start sending GSC-CS firmware messages.

Thus, immediately enable (or disable) KCR HW on PXP's init,
fini and resume.

Signed-off-by: Alan Previn <alan.previn.teres.ale...@intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospu...@intel.com>
---
 drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.c | 15 ++++++++++++++-
 drivers/gpu/drm/i915/pxp/intel_pxp_pm.c    |  3 ++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.c 
b/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.c
index 4bc276daca16..8dc41de3f6f7 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.c
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.c
@@ -10,6 +10,7 @@
 #include "gt/uc/intel_gsc_uc_heci_cmd_submit.h"
 
 #include "i915_drv.h"
+#include "intel_pxp.h"
 #include "intel_pxp_cmd_interface_42.h"
 #include "intel_pxp_cmd_interface_43.h"
 #include "intel_pxp_gsccs.h"
@@ -422,10 +423,22 @@ gsccs_allocate_execution_resource(struct intel_pxp *pxp)
 
 void intel_pxp_gsccs_fini(struct intel_pxp *pxp)
 {
+       intel_wakeref_t wakeref;
+
        gsccs_destroy_execution_resource(pxp);
+       with_intel_runtime_pm(&pxp->ctrl_gt->i915->runtime_pm, wakeref)
+               intel_pxp_fini_hw(pxp);
 }
 
 int intel_pxp_gsccs_init(struct intel_pxp *pxp)
 {
-       return gsccs_allocate_execution_resource(pxp);
+       int ret;
+       intel_wakeref_t wakeref;
+
+       ret = gsccs_allocate_execution_resource(pxp);
+       if (!ret) {
+               with_intel_runtime_pm(&pxp->ctrl_gt->i915->runtime_pm, wakeref)
+                       intel_pxp_init_hw(pxp);
+       }
+       return ret;
 }
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c 
b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
index 4f836b317424..1a04067f61fc 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp_pm.c
@@ -43,8 +43,9 @@ void intel_pxp_resume_complete(struct intel_pxp *pxp)
         * The PXP component gets automatically unbound when we go into S3 and
         * re-bound after we come out, so in that scenario we can defer the
         * hw init to the bind call.
+        * NOTE: GSC-CS backend doesn't rely on components.
         */
-       if (!pxp->pxp_component)
+       if (!HAS_ENGINE(pxp->ctrl_gt, GSC0) && !pxp->pxp_component)
                return;
 
        intel_pxp_init_hw(pxp);
-- 
2.39.0

Reply via email to