All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Previn <alan.previn.teres.alexis@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH v2 4/7] drm/i915/pxp: Make PXP tee component bind/unbind aware of PXP-owning-GT
Date: Wed,  5 Oct 2022 21:38:30 -0700	[thread overview]
Message-ID: <20221006043834.606220-5-alan.previn.teres.alexis@intel.com> (raw)
In-Reply-To: <20221006043834.606220-1-alan.previn.teres.alexis@intel.com>

Ensure i915_pxp_tee_component_bind / unbind implicitly sorts out
getting the correct PXP control-context from the PXP-owning-GT
when establishing or ending connection.

Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
---
 drivers/gpu/drm/i915/pxp/intel_pxp_tee.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
index 792a56edfde7..05d5ad1092b8 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c
@@ -20,8 +20,12 @@
 static inline struct intel_pxp *i915_dev_to_pxp(struct device *i915_kdev)
 {
 	struct drm_i915_private *i915 = kdev_to_i915(i915_kdev);
+	struct intel_gt *gt = intel_pxp_get_owning_gt(i915);
 
-	return &to_gt(i915)->pxp;
+	if (!gt)
+		return NULL;
+
+	return &gt->pxp;
 }
 
 static int intel_pxp_tee_io_message(struct intel_pxp *pxp,
@@ -128,10 +132,16 @@ static int i915_pxp_tee_component_bind(struct device *i915_kdev,
 {
 	struct drm_i915_private *i915 = kdev_to_i915(i915_kdev);
 	struct intel_pxp *pxp = i915_dev_to_pxp(i915_kdev);
-	struct intel_uc *uc = &pxp_to_gt(pxp)->uc;
+	struct intel_uc *uc;
 	intel_wakeref_t wakeref;
 	int ret = 0;
 
+	if (!pxp) {
+		drm_warn(&i915->drm, "tee comp binding without a PXP-owner GT\n");
+		return -ENODEV;
+	}
+	uc = &pxp_to_gt(pxp)->uc;
+
 	mutex_lock(&pxp->tee_mutex);
 	pxp->pxp_component = data;
 	pxp->pxp_component->tee_dev = tee_kdev;
@@ -167,6 +177,9 @@ static void i915_pxp_tee_component_unbind(struct device *i915_kdev,
 	struct intel_pxp *pxp = i915_dev_to_pxp(i915_kdev);
 	intel_wakeref_t wakeref;
 
+	if (!pxp)
+		return;
+
 	if (intel_pxp_is_enabled(i915))
 		with_intel_runtime_pm_if_in_use(&i915->runtime_pm, wakeref)
 			intel_pxp_fini_hw(pxp);
-- 
2.34.1


  parent reply	other threads:[~2022-10-06  4:36 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06  4:38 [Intel-gfx] [PATCH v2 0/7] drm/i915/pxp: Prepare intel_pxp entry points for MTL Alan Previn
2022-10-06  4:38 ` [Intel-gfx] [PATCH v2 1/7] drm/i915/pxp: Make gt and pxp init/fini aware of PXP-owning-GT Alan Previn
2022-10-13 20:48   ` Ceraolo Spurio, Daniele
2022-10-17 17:01     ` Teres Alexis, Alan Previn
2022-10-21  3:54       ` Teres Alexis, Alan Previn
2022-10-21  8:16       ` Teres Alexis, Alan Previn
2022-10-06  4:38 ` [Intel-gfx] [PATCH v2 2/7] drm/i915/pxp: Make intel_pxp_is_enabled implicitly sort PXP-owning-GT Alan Previn
2022-10-13 21:10   ` Ceraolo Spurio, Daniele
2022-10-17 17:12     ` Teres Alexis, Alan Previn
2022-10-06  4:38 ` [Intel-gfx] [PATCH v2 3/7] drm/i915/pxp: Make intel_pxp_is_active " Alan Previn
2022-10-06  4:38 ` Alan Previn [this message]
2022-10-06  4:38 ` [Intel-gfx] [PATCH v2 5/7] drm/i915/pxp: Make intel_pxp_start " Alan Previn
2022-10-06  4:38 ` [Intel-gfx] [PATCH v2 6/7] drm/i915/pxp: Make intel_pxp_key_check " Alan Previn
2022-10-06  4:38 ` [Intel-gfx] [PATCH v2 7/7] drm/i915/pxp: Make intel_pxp power management " Alan Previn
2022-10-21 16:29   ` Teres Alexis, Alan Previn
2022-10-06  5:09 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/pxp: Prepare intel_pxp entry points for MTL (rev2) Patchwork
2022-10-06  5:09 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-10-06  5:32 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-10-06 18:19 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-10-10 19:05   ` Teres Alexis, Alan Previn

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=20221006043834.606220-5-alan.previn.teres.alexis@intel.com \
    --to=alan.previn.teres.alexis@intel.com \
    --cc=intel-gfx@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.