Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Juston Li <justonli@google.com>
To: intel-gfx@lists.freedesktop.org
Cc: alan.previn.teres.alexis@intel.com
Subject: [Intel-gfx] [PATCH v2] drm/i915/pxp: don't start pxp without mei_pxp bind
Date: Wed, 10 Aug 2022 00:42:53 +0000	[thread overview]
Message-ID: <20220810004253.3240393-1-justonli@google.com> (raw)

pxp will not start correctly until after mei_pxp bind completes and
intel_pxp_init_hw() is called.

This fixes a race condition during bootup where we observed a small
window for pxp commands to be sent before mei_pxp bind completed.

Changes since v1:
- check pxp_component instead of pxp_component_added (Daniele)
- pxp_component needs tee_mutex (Daniele)
- return -EAGAIN so caller knows to retry (Daniele)

Signed-off-by: Juston Li <justonli@google.com>
---
 drivers/gpu/drm/i915/pxp/intel_pxp.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp.c b/drivers/gpu/drm/i915/pxp/intel_pxp.c
index 15311eaed848..8b395ebc430a 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp.c
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp.c
@@ -187,6 +187,14 @@ int intel_pxp_start(struct intel_pxp *pxp)
 	if (!intel_pxp_is_enabled(pxp))
 		return -ENODEV;
 
+	mutex_lock(&pxp->tee_mutex);
+	/* check if mei_pxp is bound */
+	if (!pxp->pxp_component) {
+		mutex_unlock(&pxp->tee_mutex);
+		return -EAGAIN;
+	}
+	mutex_unlock(&pxp->tee_mutex);
+
 	mutex_lock(&pxp->arb_mutex);
 
 	if (pxp->arb_is_valid)
-- 
2.37.1.559.g78731f0fdb-goog


             reply	other threads:[~2022-08-10  0:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10  0:42 Juston Li [this message]
2022-08-10  1:21 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/pxp: don't start pxp without mei_pxp bind (rev2) Patchwork
2022-08-10  4:35 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-08-15 15:35 ` [Intel-gfx] [PATCH v2] drm/i915/pxp: don't start pxp without mei_pxp bind Ceraolo Spurio, Daniele
2022-08-15 16:36   ` Juston Li
2022-08-15 20:20   ` Juston Li

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=20220810004253.3240393-1-justonli@google.com \
    --to=justonli@google.com \
    --cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox