Skip to content

Commit 472098c

Browse files
committed
drm/i915/huc: only load HuC on GTs that have VCS engines
On MTL the primary GT doesn't have any media capabilities, so no video engines and no HuC. We must therefore skip the HuC fetch and load on that specific case. Given that other multi-GT platforms might have HuC on the primary GT, we can't just check for that and it is easier to instead check for the lack of VCS engines. Based on code from Aravind Iddamsetty v2: clarify which engine_mask is used for each GT and why (Tvrtko) Signed-off-by: Daniele Ceraolo Spurio <[email protected]> Cc: Aravind Iddamsetty <[email protected]> Cc: John Harrison <[email protected]> Cc: Alan Previn <[email protected]> Cc: Tvrtko Ursulin <[email protected]> Reviewed-by: Aravind Iddamsetty <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 3653727 commit 472098c

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed

drivers/gpu/drm/i915/gt/uc/intel_huc.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,41 @@ void intel_huc_unregister_gsc_notifier(struct intel_huc *huc, struct bus_type *b
211211
huc->delayed_load.nb.notifier_call = NULL;
212212
}
213213

214+
static bool vcs_supported(struct intel_gt *gt)
215+
{
216+
intel_engine_mask_t mask = gt->info.engine_mask;
217+
218+
/*
219+
* We reach here from i915_driver_early_probe for the primary GT before
220+
* its engine mask is set, so we use the device info engine mask for it;
221+
* this means we're not taking VCS fusing into account, but if the
222+
* primary GT supports VCS engines we expect at least one of them to
223+
* remain unfused so we're fine.
224+
* For other GTs we expect the GT-specific mask to be set before we
225+
* call this function.
226+
*/
227+
GEM_BUG_ON(!gt_is_root(gt) && !gt->info.engine_mask);
228+
229+
if (gt_is_root(gt))
230+
mask = RUNTIME_INFO(gt->i915)->platform_engine_mask;
231+
else
232+
mask = gt->info.engine_mask;
233+
234+
return __ENGINE_INSTANCES_MASK(mask, VCS0, I915_MAX_VCS);
235+
}
236+
214237
void intel_huc_init_early(struct intel_huc *huc)
215238
{
216239
struct drm_i915_private *i915 = huc_to_gt(huc)->i915;
240+
struct intel_gt *gt = huc_to_gt(huc);
217241

218242
intel_uc_fw_init_early(&huc->fw, INTEL_UC_FW_TYPE_HUC);
219243

244+
if (!vcs_supported(gt)) {
245+
intel_uc_fw_change_status(&huc->fw, INTEL_UC_FIRMWARE_NOT_SUPPORTED);
246+
return;
247+
}
248+
220249
if (GRAPHICS_VER(i915) >= 11) {
221250
huc->status.reg = GEN11_HUC_KERNEL_LOAD_INFO;
222251
huc->status.mask = HUC_LOAD_SUCCESSFUL;

drivers/gpu/drm/i915/i915_drv.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -782,12 +782,15 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
782782
#define __HAS_ENGINE(engine_mask, id) ((engine_mask) & BIT(id))
783783
#define HAS_ENGINE(gt, id) __HAS_ENGINE((gt)->info.engine_mask, id)
784784

785-
#define ENGINE_INSTANCES_MASK(gt, first, count) ({ \
785+
#define __ENGINE_INSTANCES_MASK(mask, first, count) ({ \
786786
unsigned int first__ = (first); \
787787
unsigned int count__ = (count); \
788-
((gt)->info.engine_mask & \
789-
GENMASK(first__ + count__ - 1, first__)) >> first__; \
788+
((mask) & GENMASK(first__ + count__ - 1, first__)) >> first__; \
790789
})
790+
791+
#define ENGINE_INSTANCES_MASK(gt, first, count) \
792+
__ENGINE_INSTANCES_MASK((gt)->info.engine_mask, first, count)
793+
791794
#define RCS_MASK(gt) \
792795
ENGINE_INSTANCES_MASK(gt, RCS0, I915_MAX_RCS)
793796
#define BCS_MASK(gt) \

0 commit comments

Comments
 (0)