Skip to content

Commit

Permalink
drm/i915/uc: Add function to define defaults for GuC/HuC enable
Browse files Browse the repository at this point in the history
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
  • Loading branch information
John Harrison authored and Chris Wilson committed Jan 20, 2021
1 parent e7004ea commit 1e58215
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
31 changes: 26 additions & 5 deletions drivers/gpu/drm/i915/gt/uc/intel_uc.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,29 @@
static const struct intel_uc_ops uc_ops_off;
static const struct intel_uc_ops uc_ops_on;

static void uc_expand_default_options(struct intel_uc *uc)
{
struct drm_i915_private *i915 = uc_to_gt(uc)->i915;

if (i915->params.enable_guc != -1)
return;

/* Don't enable GuC/HuC on pre-Gen12 */
if (INTEL_GEN(i915) < 12) {
i915->params.enable_guc = 0;
return;
}

/* Don't enable GuC/HuC on older Gen12 platforms */
if (IS_TIGERLAKE(i915) || IS_ROCKETLAKE(i915)) {
i915->params.enable_guc = 0;
return;
}

/* Default: enable HuC authentication only */
i915->params.enable_guc = ENABLE_GUC_LOAD_HUC;
}

/* Reset GuC providing us with fresh state for both GuC and HuC.
*/
static int __intel_uc_reset_hw(struct intel_uc *uc)
Expand Down Expand Up @@ -52,9 +75,6 @@ static void __confirm_options(struct intel_uc *uc)
yesno(intel_uc_wants_guc_submission(uc)),
yesno(intel_uc_wants_huc(uc)));

if (i915->params.enable_guc == -1)
return;

if (i915->params.enable_guc == 0) {
GEM_BUG_ON(intel_uc_wants_guc(uc));
GEM_BUG_ON(intel_uc_wants_guc_submission(uc));
Expand All @@ -79,15 +99,16 @@ static void __confirm_options(struct intel_uc *uc)
"Incompatible option enable_guc=%d - %s\n",
i915->params.enable_guc, "GuC submission is N/A");

if (i915->params.enable_guc & ~(ENABLE_GUC_SUBMISSION |
ENABLE_GUC_LOAD_HUC))
if (i915->params.enable_guc & ~ENABLE_GUC_MASK)
drm_info(&i915->drm,
"Incompatible option enable_guc=%d - %s\n",
i915->params.enable_guc, "undocumented flag");
}

void intel_uc_init_early(struct intel_uc *uc)
{
uc_expand_default_options(uc);

intel_guc_init_early(&uc->guc);
intel_huc_init_early(&uc->huc);

Expand Down
7 changes: 1 addition & 6 deletions drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,11 @@ __uc_fw_auto_select(struct drm_i915_private *i915, struct intel_uc_fw *uc_fw)
uc_fw->path = NULL;
}
}

/* We don't want to enable GuC/HuC on pre-Gen11 by default */
if (i915->params.enable_guc == -1 && p < INTEL_ICELAKE)
uc_fw->path = NULL;
}

static const char *__override_guc_firmware_path(struct drm_i915_private *i915)
{
if (i915->params.enable_guc & (ENABLE_GUC_SUBMISSION |
ENABLE_GUC_LOAD_HUC))
if (i915->params.enable_guc & ENABLE_GUC_MASK)
return i915->params.guc_firmware_path;
return "";
}
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/i915/i915_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ struct drm_printer;

#define ENABLE_GUC_SUBMISSION BIT(0)
#define ENABLE_GUC_LOAD_HUC BIT(1)
#define ENABLE_GUC_MASK GENMASK(1, 0)

/*
* Invoke param, a function-like macro, for each i915 param, with arguments:
Expand Down

0 comments on commit 1e58215

Please sign in to comment.