Skip to content

drm/xe: load the DG2 HuC through the GSC via mei_pxp

Arisa Snowbell dri-devel intel-xe linux-media lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5drm/xe/heci: expose the DG2 HECI1 interface to meidrivers/gpu/drm/xe/regs/xe_gsc_regs.h drivers/gpu/drm/xe/xe_heci_gsc.c drivers/gpu/drm/xe/xe_heci_gsc.h +1 more+149 -520 replies
2/5mei: gsc: bind the xe HECI1 devicedrivers/misc/mei/gsc-me.c+5 -00 replies
3/5drm/xe/huc: load the DG2 HuC through the GSC via mei_pxpdrivers/gpu/drm/xe/Makefile drivers/gpu/drm/xe/regs/xe_guc_regs.h drivers/gpu/drm/xe/xe_huc.c +4 more+673 -16 replies
4/5drm/xe: hold video decode work and HuC queries for a pending DG2 HuC loaddrivers/gpu/drm/xe/xe_exec.c drivers/gpu/drm/xe/xe_query.c include/uapi/drm/xe_drm.h+23 -00 replies
5/5drm/xe/uc_fw: select the DG2 HuC blob for a load by the GSCdrivers/gpu/drm/xe/xe_uc_fw.c+9 -50 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/5] drm/xe: load the DG2 HuC through the GSC via mei_pxp

On DG2 the HuC is loaded and authenticated by the GSC, through the PXP client on HECI1, so xe has never had a HuC there: VDEnc encode with bitrate control (CBR/VBR, used by the media driver, QSV and anv's Vulkan Video) does not work on DG2 under xe. This series adds the path i915 uses:

1. xe exposes HECI1 to mei as "xe.mei-gsc", with 4 MiB of VRAM as the GSC extended operational memory and its interrupt routed.
2. mei-gsc binds it.
3. xe registers as the I915_COMPONENT_PXP component and, after every uC load (probe, GT reset, resume) and when mei_pxp binds, asks the GSC to load the HuC with PXP43 START_HUC_AUTH through gsc_command(). The GSC hardware stays with mei.
4. As i915 does (i915_request_await_huc()), video decode jobs wait on a fence of the pending load, and the HuC version query waits for it too (interruptibly, at most 10 s), so userspace probing at init does not see a HuC-less device. The uAPI doc says so.
5. The DG2 blob (i915/dg2_huc_gsc.bin) is selected; only this patch changes behavior, so the series bisects.

If mei_pxp is missing or does not bind within 10 s, the HuC stays unloaded and later loads stop waiting for it until it binds, like i915's INTEL_HUC_DELAYED_LOAD_ERROR. A failed setup leaves the HuC unloaded and does not fail the probe.

I know the stance from issue 234 is that i915 is the driver for DG2 and that xe does not plan to enable the HuC there. I'm sending this anyway because DG2 runs well on xe otherwise and the HuC is the piece missing for media on it; if it is still not wanted, I'd be glad to hear what would make it acceptable. MR !361 on the xe GitLab tried the same and reviews there asked for what this series does: media waiting for the load, the GSC left to mei through mei_pxp, and suspend handled while a load is pending.

Tested on an Arc Pro A40 (8086:56b1) with the same patches applied to 7.4-rc4 (the only conflict was an include line):
- boot: mei_pxp binds ~1 s after probe, HuC 7.10.16 authenticated, huc_info RUNNING; h264_vaapi CBR 8 Mbit/s gives 7.95 Mbit/s
- GT reset (force_reset_sync): HuC stays RUNNING, CBR as before
- S3 suspend and resume: mei_pxp re-binds, HuC RUNNING, CBR as before
- runtime D3cold (the slot's ACPI power resource goes off), three times in a row: the first encode after waking runs at CBR as before, HuC RUNNING
- anv Vulkan Video and iHD (VA-API, oneVPL) encode with rate control
Each patch builds with W=1 on drm-xe-next; checkpatch --strict is clean apart from the MAINTAINERS note for the new files.

Known limitation, the same as on i915: a GSC command that never returns holds up a reset or suspend in the stop of the load worker until mei resets; decode submissions do not wait on it past the 10 s deadline.

Copyright: I'm not from Intel and unsure how the header of the new files should read. xe_huc_mei.c is adapted in large part from i915's intel_huc.c and intel_pxp_huc.c, so it keeps "Copyright © 2016-2022 Intel Corporation" and adds my own line; xe_huc_mei.h carries only mine. Please tell me if it should be written differently.

Tools: the code and changelogs were written with an LLM coding assistant (Claude) in a long interactive session, from i915's implementation, the xe sources and my description of what to build, and reviewed by a second LLM pass. I reviewed, tested and debugged everything on the hardware above, and I'm responsible for it.

Arisa Snowbell (5):
drm/xe/heci: expose the DG2 HECI1 interface to mei
mei: gsc: bind the xe HECI1 device
drm/xe/huc: load the DG2 HuC through the GSC via mei_pxp drm/xe: hold video decode work and HuC queries for a pending DG2 HuC
load
drm/xe/uc_fw: select the DG2 HuC blob for a load by the GSC

 drivers/gpu/drm/xe/Makefile           |   1 +
 drivers/gpu/drm/xe/regs/xe_gsc_regs.h |   1 +
 drivers/gpu/drm/xe/regs/xe_guc_regs.h |   3 +
 drivers/gpu/drm/xe/xe_exec.c          |  13 +
 drivers/gpu/drm/xe/xe_heci_gsc.c      | 171 +++++---
 drivers/gpu/drm/xe/xe_heci_gsc.h      |  27 +-
 drivers/gpu/drm/xe/xe_huc.c           |  16 +-
 drivers/gpu/drm/xe/xe_huc_mei.c       | 569 ++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_huc_mei.h       |  21 +
 drivers/gpu/drm/xe/xe_huc_types.h     |  57 +++
 drivers/gpu/drm/xe/xe_irq.c           |   2 +
 drivers/gpu/drm/xe/xe_query.c         |   5 +
 drivers/gpu/drm/xe/xe_uc.c            |   7 +
 drivers/gpu/drm/xe/xe_uc_fw.c         |  14 +-
 drivers/misc/mei/gsc-me.c             |   5 +
 include/uapi/drm/xe_drm.h             |   5 +
 16 files changed, 859 insertions(+), 58 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/xe_huc_mei.c
 create mode 100644 drivers/gpu/drm/xe/xe_huc_mei.h

base-commit: fc2a3dd1a3a2105f34e2f5c7a3e21f82fc0a0851

Signature · 1 line
2.56.1