Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Suraj Kandpal <suraj.kandpal@intel.com>
To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: Suraj Kandpal <suraj.kandpal@intel.com>,
	Arun R Murthy <arun.r.murthy@intel.com>,
	Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Subject: [PATCH 3/4] drm/xe: Use gsc_proxy_init_done to check proxy status
Date: Wed, 28 Feb 2024 11:17:14 +0530	[thread overview]
Message-ID: <20240228054713.1783819-2-suraj.kandpal@intel.com> (raw)
In-Reply-To: <20240227053204.1748920-4-suraj.kandpal@intel.com>

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 forcewake get 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>
---
 drivers/gpu/drm/xe/display/xe_hdcp_gsc.c | 29 +++++++++++++++++++++++-
 drivers/gpu/drm/xe/xe_gsc_proxy.c        |  4 ++--
 drivers/gpu/drm/xe/xe_gsc_proxy.h        |  1 +
 3 files changed, 31 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..3af5a86db3aa 100644
--- a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
+++ b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
@@ -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)
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);
 
-- 
2.43.2


  reply	other threads:[~2024-02-28  5:50 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27  5:32 [PATCH 0/4] XE HDCP Enablement Suraj Kandpal
2024-02-27  5:32 ` [PATCH 1/4] drm/i915/hdcp: Move intel_hdcp_gsc_message def away from header file Suraj Kandpal
2024-02-27  6:33   ` Suraj Kandpal
2024-02-28  6:01     ` Murthy, Arun R
2024-02-28  5:59   ` Kandpal, Suraj
2024-03-04 15:59   ` Jani Nikula
2024-02-27  5:32 ` [PATCH 2/4] drm/xe/hdcp: Use xe_device struct Suraj Kandpal
2024-02-27  5:32 ` [PATCH 3/4] drm/xe: Use gsc_proxy_init_done to check proxy status Suraj Kandpal
2024-02-28  5:47   ` Suraj Kandpal [this message]
2024-02-27  5:32 ` [PATCH 4/4] drm/xe/hdcp: Enable HDCP for XE Suraj Kandpal
2024-03-05 13:36   ` Lucas De Marchi
2024-02-27  5:39 ` ✓ CI.Patch_applied: success for XE HDCP Enablement (rev6) Patchwork
2024-02-27  5:39 ` ✓ CI.checkpatch: " Patchwork
2024-02-27  5:40 ` ✓ CI.KUnit: " Patchwork
2024-02-27  5:51 ` ✓ CI.Build: " Patchwork
2024-02-27  5:52 ` ✗ CI.Hooks: failure " Patchwork
2024-02-27  5:53 ` ✗ CI.checksparse: warning " Patchwork
2024-02-27  6:23 ` ✗ CI.BAT: failure " Patchwork
2024-02-27  6:40 ` ✓ CI.Patch_applied: success for XE HDCP Enablement (rev7) Patchwork
2024-02-27  6:40 ` ✓ CI.checkpatch: " Patchwork
2024-02-27  6:41 ` ✓ CI.KUnit: " Patchwork
2024-02-27  6:52 ` ✓ CI.Build: " Patchwork
2024-02-27  6:53 ` ✗ CI.Hooks: failure " Patchwork
2024-02-27  6:54 ` ✗ CI.checksparse: warning " Patchwork
2024-02-27  7:15 ` ✓ CI.BAT: success " Patchwork
2024-02-28  5:54 ` ✓ CI.Patch_applied: success for XE HDCP Enablement (rev8) Patchwork
2024-02-28  5:54 ` ✓ CI.checkpatch: " Patchwork
2024-02-28  5:55 ` ✓ CI.KUnit: " Patchwork
2024-02-28  6:06 ` ✓ CI.Build: " Patchwork
2024-02-28  6:07 ` ✗ CI.Hooks: failure " Patchwork
2024-02-28  6:08 ` ✗ CI.checksparse: warning " Patchwork
2024-02-28  6:36 ` ✓ CI.BAT: success " Patchwork
2024-03-05 13:38 ` [PATCH 0/4] XE HDCP Enablement Lucas De Marchi
  -- strict thread matches above, loose matches on Subject: below --
2024-03-06  2:42 Suraj Kandpal
2024-03-06  2:42 ` [PATCH 3/4] drm/xe: Use gsc_proxy_init_done to check proxy status Suraj Kandpal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240228054713.1783819-2-suraj.kandpal@intel.com \
    --to=suraj.kandpal@intel.com \
    --cc=arun.r.murthy@intel.com \
    --cc=daniele.ceraolospurio@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox