From: Arisa Snowbell <arisa.snowbell@gmail.com>
To: intel-xe@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org,
"Daniele Ceraolo Spurio" <daniele.ceraolospurio@intel.com>,
"Arisa Snowbell" <arisa.snowbell@gmail.com>,
"Matthew Brost" <matthew.brost@intel.com>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Christian König" <christian.koenig@amd.com>,
"Philipp Stanner" <phasta@kernel.org>,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linaro-mm-sig@lists.linaro.org
Subject: [PATCH 4/5] drm/xe: hold video decode work and HuC queries for a pending DG2 HuC load
Date: Thu, 26 Nov 2026 21:57:56 +0100 [thread overview]
Message-ID: <20261126205758.49845-5-arisa.snowbell@gmail.com> (raw)
In-Reply-To: <20261126205758.49845-1-arisa.snowbell@gmail.com>
On DG2 the HuC load by the GSC completes asynchronously after probe, a GT
reset or a resume. Media submitted before then would run without the HuC,
and userspace querying the HuC version (as Mesa and the media driver do at
init) would see a device without one.
Like i915 (i915_request_await_huc()), make video decode jobs depend on the
fence of the pending load. The HuC version query waits for it too,
interruptibly and bounded by the load's own 10 s deadline; document that.
Signed-off-by: Arisa Snowbell <arisa.snowbell@gmail.com>
---
drivers/gpu/drm/xe/xe_exec.c | 13 +++++++++++++
drivers/gpu/drm/xe/xe_query.c | 5 +++++
include/uapi/drm/xe_drm.h | 5 +++++
3 files changed, 23 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_exec.c b/drivers/gpu/drm/xe/xe_exec.c
index f9b0fdb96..65e445205 100644
--- a/drivers/gpu/drm/xe/xe_exec.c
+++ b/drivers/gpu/drm/xe/xe_exec.c
@@ -14,6 +14,8 @@
#include "xe_device.h"
#include "xe_exec_queue.h"
+#include "xe_gt_types.h"
+#include "xe_huc_mei.h"
#include "xe_hw_engine_group.h"
#include "xe_macros.h"
#include "xe_pm.h"
@@ -317,6 +319,17 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
if (err)
goto err_put_job;
+ /* as on i915, video decode must not run before a pending HuC load */
+ if (q->class == XE_ENGINE_CLASS_VIDEO_DECODE) {
+ struct dma_fence *huc_load = xe_huc_mei_load_fence(&q->gt->uc.huc);
+
+ if (huc_load) {
+ err = drm_sched_job_add_dependency(&job->drm, huc_load);
+ if (err)
+ goto err_put_job;
+ }
+ }
+
if (!xe_vm_in_lr_mode(vm)) {
err = xe_svm_notifier_lock_interruptible(vm);
if (err)
diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
index 9cc35fc83..696bae5ee 100644
--- a/drivers/gpu/drm/xe/xe_query.c
+++ b/drivers/gpu/drm/xe/xe_query.c
@@ -22,6 +22,7 @@
#include "xe_gt.h"
#include "xe_gt_topology.h"
#include "xe_guc_hwconfig.h"
+#include "xe_huc_mei.h"
#include "xe_macros.h"
#include "xe_mmio.h"
#include "xe_oa.h"
@@ -600,6 +601,7 @@ query_uc_fw_version(struct xe_device *xe, struct drm_xe_device_query *query)
case XE_QUERY_UC_TYPE_HUC: {
struct xe_gt *media_gt = NULL;
struct xe_huc *huc;
+ int ret;
if (MEDIA_VER(xe) >= 13) {
struct xe_tile *tile;
@@ -619,6 +621,9 @@ query_uc_fw_version(struct xe_device *xe, struct drm_xe_device_query *query)
break;
huc = &media_gt->uc.huc;
+ ret = xe_huc_mei_wait(huc);
+ if (ret)
+ return ret;
if (huc->fw.status == XE_UC_FIRMWARE_RUNNING)
version = &huc->fw.versions.found[XE_UC_FW_VER_RELEASE];
break;
diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
index 578f0c1eb..db893d041 100644
--- a/include/uapi/drm/xe_drm.h
+++ b/include/uapi/drm/xe_drm.h
@@ -628,6 +628,11 @@ struct drm_xe_query_engine_cycles {
*
* Given a uc_type this will return the branch, major, minor and patch version
* of the micro-controller firmware.
+ *
+ * On platforms where the GSC loads the HuC (DG2), the load runs asynchronously
+ * after probe, reset and resume. A query of %XE_QUERY_UC_TYPE_HUC then waits
+ * (interruptibly, for at most 10 seconds) until a pending load settled, so
+ * that it does not report a HuC that is about to run as missing.
*/
struct drm_xe_query_uc_fw_version {
/** @uc_type: The micro-controller type to query firmware version */
--
2.56.1
next prev parent reply other threads:[~2026-11-26 20:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 20:57 [PATCH 0/5] drm/xe: load the DG2 HuC through the GSC via mei_pxp Arisa Snowbell
2026-11-26 20:57 ` [PATCH 1/5] drm/xe/heci: expose the DG2 HECI1 interface to mei Arisa Snowbell
2026-11-26 20:57 ` [PATCH 2/5] mei: gsc: bind the xe HECI1 device Arisa Snowbell
2026-11-26 20:57 ` [PATCH 3/5] drm/xe/huc: load the DG2 HuC through the GSC via mei_pxp Arisa Snowbell
2026-11-26 21:23 ` sashiko-bot
2026-12-02 1:38 ` Ceraolo Spurio, Daniele
2026-11-26 20:57 ` Arisa Snowbell [this message]
2026-11-26 21:12 ` [PATCH 4/5] drm/xe: hold video decode work and HuC queries for a pending DG2 HuC load sashiko-bot
2026-11-26 20:57 ` [PATCH 5/5] drm/xe/uc_fw: select the DG2 HuC blob for a load by the GSC Arisa Snowbell
2026-11-30 15:51 ` ✗ LGCI.VerificationFailed: failure for drm/xe: load the DG2 HuC through the GSC via mei_pxp Patchwork
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=20261126205758.49845-5-arisa.snowbell@gmail.com \
--to=arisa.snowbell@gmail.com \
--cc=airlied@gmail.com \
--cc=christian.koenig@amd.com \
--cc=daniele.ceraolospurio@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthew.brost@intel.com \
--cc=mripard@kernel.org \
--cc=phasta@kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
--cc=sumit.semwal@linaro.org \
--cc=thomas.hellstrom@linux.intel.com \
--cc=tzimmermann@suse.de \
/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.