Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915/uc: Add function to define defaults for GuC/HuC enable

There is a module parameter for controlling what GuC/HuC features are
enabled. Setting to -1 means 'use the default'. However, the default
was not well defined, out of date and needs to be different across
platforms.

The default is now to disable both GuC and HuC on legacy platforms
where legacy means TGL/RKL and anything prior to Gen12. For new
platforms, the default is to load HuC but not enable GuC submission
as that has not landed yet.

Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20210113220724.2484897-1-John.C.Harrison@Intel.com

authored by

John Harrison and committed by
Chris Wilson
1e58215f e7004ea4

+28 -11
+26 -5
drivers/gpu/drm/i915/gt/uc/intel_uc.c
··· 15 15 static const struct intel_uc_ops uc_ops_off; 16 16 static const struct intel_uc_ops uc_ops_on; 17 17 18 + static void uc_expand_default_options(struct intel_uc *uc) 19 + { 20 + struct drm_i915_private *i915 = uc_to_gt(uc)->i915; 21 + 22 + if (i915->params.enable_guc != -1) 23 + return; 24 + 25 + /* Don't enable GuC/HuC on pre-Gen12 */ 26 + if (INTEL_GEN(i915) < 12) { 27 + i915->params.enable_guc = 0; 28 + return; 29 + } 30 + 31 + /* Don't enable GuC/HuC on older Gen12 platforms */ 32 + if (IS_TIGERLAKE(i915) || IS_ROCKETLAKE(i915)) { 33 + i915->params.enable_guc = 0; 34 + return; 35 + } 36 + 37 + /* Default: enable HuC authentication only */ 38 + i915->params.enable_guc = ENABLE_GUC_LOAD_HUC; 39 + } 40 + 18 41 /* Reset GuC providing us with fresh state for both GuC and HuC. 19 42 */ 20 43 static int __intel_uc_reset_hw(struct intel_uc *uc) ··· 75 52 yesno(intel_uc_wants_guc_submission(uc)), 76 53 yesno(intel_uc_wants_huc(uc))); 77 54 78 - if (i915->params.enable_guc == -1) 79 - return; 80 - 81 55 if (i915->params.enable_guc == 0) { 82 56 GEM_BUG_ON(intel_uc_wants_guc(uc)); 83 57 GEM_BUG_ON(intel_uc_wants_guc_submission(uc)); ··· 99 79 "Incompatible option enable_guc=%d - %s\n", 100 80 i915->params.enable_guc, "GuC submission is N/A"); 101 81 102 - if (i915->params.enable_guc & ~(ENABLE_GUC_SUBMISSION | 103 - ENABLE_GUC_LOAD_HUC)) 82 + if (i915->params.enable_guc & ~ENABLE_GUC_MASK) 104 83 drm_info(&i915->drm, 105 84 "Incompatible option enable_guc=%d - %s\n", 106 85 i915->params.enable_guc, "undocumented flag"); ··· 107 88 108 89 void intel_uc_init_early(struct intel_uc *uc) 109 90 { 91 + uc_expand_default_options(uc); 92 + 110 93 intel_guc_init_early(&uc->guc); 111 94 intel_huc_init_early(&uc->huc); 112 95
+1 -6
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
··· 152 152 uc_fw->path = NULL; 153 153 } 154 154 } 155 - 156 - /* We don't want to enable GuC/HuC on pre-Gen11 by default */ 157 - if (i915->params.enable_guc == -1 && p < INTEL_ICELAKE) 158 - uc_fw->path = NULL; 159 155 } 160 156 161 157 static const char *__override_guc_firmware_path(struct drm_i915_private *i915) 162 158 { 163 - if (i915->params.enable_guc & (ENABLE_GUC_SUBMISSION | 164 - ENABLE_GUC_LOAD_HUC)) 159 + if (i915->params.enable_guc & ENABLE_GUC_MASK) 165 160 return i915->params.guc_firmware_path; 166 161 return ""; 167 162 }
+1
drivers/gpu/drm/i915/i915_params.h
··· 32 32 33 33 #define ENABLE_GUC_SUBMISSION BIT(0) 34 34 #define ENABLE_GUC_LOAD_HUC BIT(1) 35 + #define ENABLE_GUC_MASK GENMASK(1, 0) 35 36 36 37 /* 37 38 * Invoke param, a function-like macro, for each i915 param, with arguments: