linux/drivers/gpu/drm/i915/intel_uc.c
/**
 * sanitize_options_early - sanitize uC related modparam options
 * @i915: device private
 *
 * In case of "enable_guc" option this function will attempt to modify
 * it only if it was initially set to "auto(-1)". Default value for this
 * modparam varies between platforms and it is hardcoded in driver code.
 * Any other modparam value is only monitored against availability of the
 * related hardware or firmware definitions.
 *
 * In case of "guc_log_level" option this function will attempt to modify
 * it only if it was initially set to "auto(-1)" or if initial value was
 * "enable(1..4)" on platforms without the GuC. Default value for this
 * modparam varies between platforms and is usually set to "disable(0)"
 * unless GuC is enabled on given platform and the driver is compiled with
 * debug config when this modparam will default to "enable(1..4)".
 */
sanitize uC related modparam options
@i915: device private

In case of "enable_guc" option this function will attempt to modify
it only if it was initially set to "auto(-1)". Default value for this
modparam varies between platforms and it is hardcoded in driver code.
Any other modparam value is only monitored against availability of the
related hardware or firmware definitions.


sanitize uC related modparam options @i915 : device private In case of " enable_guc " option this function will attempt to modify it only if it was initially set to " auto ( - 1 ) " . Default value for this modparam varies between platforms and it is hardcoded in driver code . Any other modparam value is only monitored against availability of the related hardware or firmware definitions .
static void sanitize_options_early(struct drm_i915_private *i915)
{
	struct intel_uc_fw *guc_fw = &i915->guc.fw;
	struct intel_uc_fw *huc_fw = &i915->huc.fw;
	if (i915_modparams.enable_guc < 0)
		i915_modparams.enable_guc = __get_platform_enable_guc(i915);
	DRM_DEBUG_DRIVER("enable_guc=%d (submission:%s huc:%s)\n",
			 i915_modparams.enable_guc,
			 yesno(intel_uc_is_using_guc_submission()),
			 yesno(intel_uc_is_using_huc()));
	if (intel_uc_is_using_guc() && !intel_uc_fw_is_selected(guc_fw)) {
		DRM_WARN("Incompatible option detected: %s=%d, %s!\n",
			 "enable_guc", i915_modparams.enable_guc,
			 !HAS_GUC(i915) ? "no GuC hardware" :
					  "no GuC firmware");
	}
	if (intel_uc_is_using_huc() && !intel_uc_fw_is_selected(huc_fw)) {
		DRM_WARN("Incompatible option detected: %s=%d, %s!\n",
			 "enable_guc", i915_modparams.enable_guc,
			 !HAS_HUC(i915) ? "no HuC hardware" :
					  "no HuC firmware");
	}
	if (i915_modparams.guc_log_level < 0)
		i915_modparams.guc_log_level =
			__get_default_guc_log_level(i915);
	if (i915_modparams.guc_log_level > 0 && !intel_uc_is_using_guc()) {
		DRM_WARN("Incompatible option detected: %s=%d, %s!\n",
			 "guc_log_level", i915_modparams.guc_log_level,
			 !HAS_GUC(i915) ? "no GuC hardware" :
					  "GuC not enabled");
		i915_modparams.guc_log_level = 0;
	}
	if (i915_modparams.guc_log_level > GUC_LOG_LEVEL_MAX) {
		DRM_WARN("Incompatible option detected: %s=%d, %s!\n",
			 "guc_log_level", i915_modparams.guc_log_level,
			 "verbosity too high");
		i915_modparams.guc_log_level = GUC_LOG_LEVEL_MAX;
	}
	DRM_DEBUG_DRIVER("guc_log_level=%d (enabled:%s, verbose:%s, verbosity:%d)\n",
			 i915_modparams.guc_log_level,
			 yesno(i915_modparams.guc_log_level),
			 yesno(GUC_LOG_LEVEL_IS_VERBOSE(i915_modparams.guc_log_level)),
			 GUC_LOG_LEVEL_TO_VERBOSITY(i915_modparams.guc_log_level));
	GEM_BUG_ON(i915_modparams.enable_guc < 0);
	GEM_BUG_ON(i915_modparams.guc_log_level < 0);
}
static void sanitize_options_early ( struct drm_i915_private * i915 ) { struct intel_uc_fw * guc_fw = & i915 -> guc . fw ; struct intel_uc_fw * huc_fw = & i915 -> huc . fw ; if ( i915_modparams . enable_guc < 0 ) i915_modparams . enable_guc = __get_platform_enable_guc ( i915 ) ; DRM_DEBUG_DRIVER ( " \n " , i915_modparams . enable_guc , yesno ( intel_uc_is_using_guc_submission ( ) ) , yesno ( intel_uc_is_using_huc ( ) ) ) ; if ( intel_uc_is_using_guc ( ) && ! intel_uc_fw_is_selected ( guc_fw ) ) { DRM_WARN ( " \n " , " " , i915_modparams . enable_guc , ! HAS_GUC ( i915 ) ? " " : " " ) ; } if ( intel_uc_is_using_huc ( ) && ! intel_uc_fw_is_selected ( huc_fw ) ) { DRM_WARN ( " \n " , " " , i915_modparams . enable_guc , ! HAS_HUC ( i915 ) ? " " : " " ) ; } if ( i915_modparams . guc_log_level < 0 ) i915_modparams . guc_log_level = __get_default_guc_log_level ( i915 ) ; if ( i915_modparams . guc_log_level > 0 && ! intel_uc_is_using_guc ( ) ) { DRM_WARN ( " \n " , " " , i915_modparams . guc_log_level , ! HAS_GUC ( i915 ) ? " " : " " ) ; i915_modparams . guc_log_level = 0 ; } if ( i915_modparams . guc_log_level > GUC_LOG_LEVEL_MAX ) { DRM_WARN ( " \n " , " " , i915_modparams . guc_log_level , " " ) ; i915_modparams . guc_log_level = GUC_LOG_LEVEL_MAX ; } DRM_DEBUG_DRIVER ( " \n " , i915_modparams . guc_log_level , yesno ( i915_modparams . guc_log_level ) , yesno ( GUC_LOG_LEVEL_IS_VERBOSE ( i915_modparams . guc_log_level ) ) , GUC_LOG_LEVEL_TO_VERBOSITY ( i915_modparams . guc_log_level ) ) ; GEM_BUG_ON ( i915_modparams . enable_guc < 0 ) ; GEM_BUG_ON ( i915_modparams . guc_log_level < 0 ) ; }
sanitize_options_early - sanitize uC related modparam options
 @i915: device private
sanitize_options_early - sanitize uC related modparam options @i915 : device private
/* A negative value means "use platform default" */ /* Verify GuC firmware availability */ /* Verify HuC firmware availability */ /* A negative value means "use platform/config default" */ /* Make sure that sanitization was done */