diff mbox series

[3/5] drm/xe: Use gsc_proxy_init_done to check proxy status

Message ID 20240209101412.1326176-4-suraj.kandpal@intel.com (mailing list archive)
State New, archived
Headers show
Series XE HDCP Enablement | expand

Commit Message

Kandpal, Suraj Feb. 9, 2024, 10:14 a.m. UTC
Expose gsc_proxy_init_done so that we can check if gsc proxy has
been initialized or not.

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
---
 drivers/gpu/drm/xe/display/xe_hdcp_gsc.c | 25 +++++++++++++++++++++++-
 drivers/gpu/drm/xe/xe_gsc_proxy.c        |  4 ++--
 drivers/gpu/drm/xe/xe_gsc_proxy.h        |  1 +
 3 files changed, 27 insertions(+), 3 deletions(-)

Comments

Daniele Ceraolo Spurio Feb. 13, 2024, 11:22 p.m. UTC | #1
On 2/9/2024 2:14 AM, Suraj Kandpal wrote:
> Expose gsc_proxy_init_done so that we can check if gsc proxy has
> been initialized or not.
>
> Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
> ---
>   drivers/gpu/drm/xe/display/xe_hdcp_gsc.c | 25 +++++++++++++++++++++++-
>   drivers/gpu/drm/xe/xe_gsc_proxy.c        |  4 ++--
>   drivers/gpu/drm/xe/xe_gsc_proxy.h        |  1 +
>   3 files changed, 27 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
> index 5d1d0054b578..425db3532ce5 100644
> --- a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
> +++ b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
> @@ -4,8 +4,12 @@
>    */
>   
>   #include <drm/drm_print.h>
> +
>   #include "intel_hdcp_gsc.h"
>   #include "xe_device_types.h"
> +#include "xe_gt.h"
> +#include "xe_gsc_proxy.h"
> +#include "xe_pm.h"
>   
>   bool intel_hdcp_gsc_cs_required(struct xe_device *xe)
>   {
> @@ -14,7 +18,26 @@ 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;
> +

Sorry for missing this in the previous rev, but I just remembered that 
if the GSC FW is not enabled then the forcewake domain is not 
initialized, which would lead to the forcewake_get throwing an error, so 
we need a check here first:

         if (!xe_uc_fw_is_enabled(&gt->uc.gsc.fw))
                 return false;

With this change:
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

Daniele

> +	xe_pm_runtime_get(xe);
> +	ret = xe_force_wake_get(gt_to_fw(gt), XE_FW_GSC);
> +	if (ret) {
> +		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)
> diff --git a/drivers/gpu/drm/xe/xe_gsc_proxy.c b/drivers/gpu/drm/xe/xe_gsc_proxy.c
> index 309ef80e3b95..1ced6b4d4946 100644
> --- a/drivers/gpu/drm/xe/xe_gsc_proxy.c
> +++ b/drivers/gpu/drm/xe/xe_gsc_proxy.c
> @@ -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;
>   	}
> diff --git a/drivers/gpu/drm/xe/xe_gsc_proxy.h b/drivers/gpu/drm/xe/xe_gsc_proxy.h
> index 908f9441f093..c511ade6b863 100644
> --- a/drivers/gpu/drm/xe/xe_gsc_proxy.h
> +++ b/drivers/gpu/drm/xe/xe_gsc_proxy.h
> @@ -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);
>
Murthy, Arun R Feb. 26, 2024, 10:21 a.m. UTC | #2
> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Daniele
> Ceraolo Spurio
> Sent: Wednesday, February 14, 2024 4:52 AM
> To: Kandpal, Suraj <suraj.kandpal@intel.com>; intel-gfx@lists.freedesktop.org;
> intel-xe@lists.freedesktop.org
> Subject: Re: [PATCH 3/5] drm/xe: Use gsc_proxy_init_done to check proxy
> status
> 
> 
> 
> On 2/9/2024 2:14 AM, Suraj Kandpal wrote:
> > Expose gsc_proxy_init_done so that we can check if gsc proxy has been
> > initialized or not.
> >
> > Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
> > ---
> >   drivers/gpu/drm/xe/display/xe_hdcp_gsc.c | 25
> +++++++++++++++++++++++-
> >   drivers/gpu/drm/xe/xe_gsc_proxy.c        |  4 ++--
> >   drivers/gpu/drm/xe/xe_gsc_proxy.h        |  1 +
> >   3 files changed, 27 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
> > b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
> > index 5d1d0054b578..425db3532ce5 100644
> > --- a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
> > +++ b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
> > @@ -4,8 +4,12 @@
> >    */
> >
> >   #include <drm/drm_print.h>
> > +
> >   #include "intel_hdcp_gsc.h"
> >   #include "xe_device_types.h"
> > +#include "xe_gt.h"
> > +#include "xe_gsc_proxy.h"
> > +#include "xe_pm.h"
> >
> >   bool intel_hdcp_gsc_cs_required(struct xe_device *xe)
> >   {
> > @@ -14,7 +18,26 @@ 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;
> > +
> 
> Sorry for missing this in the previous rev, but I just remembered that if the GSC
> FW is not enabled then the forcewake domain is not initialized, which would
> lead to the forcewake_get throwing an error, so we need a check here first:
> 
>          if (!xe_uc_fw_is_enabled(&gt->uc.gsc.fw))
>                  return false;
> 
> With this change:
> Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> 
> Daniele
> 
With the above said changes
Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com>

Thanks and Regards,
Arun R Murthy
-------------------

> > +	xe_pm_runtime_get(xe);
> > +	ret = xe_force_wake_get(gt_to_fw(gt), XE_FW_GSC);
> > +	if (ret) {
> > +		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) diff --git
> > a/drivers/gpu/drm/xe/xe_gsc_proxy.c
> > b/drivers/gpu/drm/xe/xe_gsc_proxy.c
> > index 309ef80e3b95..1ced6b4d4946 100644
> > --- a/drivers/gpu/drm/xe/xe_gsc_proxy.c
> > +++ b/drivers/gpu/drm/xe/xe_gsc_proxy.c
> > @@ -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;
> >   	}
> > diff --git a/drivers/gpu/drm/xe/xe_gsc_proxy.h
> > b/drivers/gpu/drm/xe/xe_gsc_proxy.h
> > index 908f9441f093..c511ade6b863 100644
> > --- a/drivers/gpu/drm/xe/xe_gsc_proxy.h
> > +++ b/drivers/gpu/drm/xe/xe_gsc_proxy.h
> > @@ -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);
> >
diff mbox series

Patch

diff --git a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
index 5d1d0054b578..425db3532ce5 100644
--- a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
+++ b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
@@ -4,8 +4,12 @@ 
  */
 
 #include <drm/drm_print.h>
+
 #include "intel_hdcp_gsc.h"
 #include "xe_device_types.h"
+#include "xe_gt.h"
+#include "xe_gsc_proxy.h"
+#include "xe_pm.h"
 
 bool intel_hdcp_gsc_cs_required(struct xe_device *xe)
 {
@@ -14,7 +18,26 @@  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;
+
+	xe_pm_runtime_get(xe);
+	ret = xe_force_wake_get(gt_to_fw(gt), XE_FW_GSC);
+	if (ret) {
+		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)
diff --git a/drivers/gpu/drm/xe/xe_gsc_proxy.c b/drivers/gpu/drm/xe/xe_gsc_proxy.c
index 309ef80e3b95..1ced6b4d4946 100644
--- a/drivers/gpu/drm/xe/xe_gsc_proxy.c
+++ b/drivers/gpu/drm/xe/xe_gsc_proxy.c
@@ -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;
 	}
diff --git a/drivers/gpu/drm/xe/xe_gsc_proxy.h b/drivers/gpu/drm/xe/xe_gsc_proxy.h
index 908f9441f093..c511ade6b863 100644
--- a/drivers/gpu/drm/xe/xe_gsc_proxy.h
+++ b/drivers/gpu/drm/xe/xe_gsc_proxy.h
@@ -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);