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

drm/i915/uc: Fetch uC firmware in init_early

We were fetching uC firmwares in separate uc_init_fw step, while
there is no reason why we can't fetch them during init_early.
This will also simplify upcoming patches, as size of the firmware
may be used for register initialization.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Michal Winiarski <michal.winiarski@intel.com>
Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20180323123451.59244-2-michal.wajdeczko@intel.com

authored by

Michal Wajdeczko and committed by
Chris Wilson
8c650aef a0de908d

+28 -36
+2 -6
drivers/gpu/drm/i915/i915_drv.c
··· 692 692 if (ret) 693 693 goto cleanup_irq; 694 694 695 - intel_uc_init_fw(dev_priv); 696 - 697 695 ret = i915_gem_init(dev_priv); 698 696 if (ret) 699 - goto cleanup_uc; 697 + goto cleanup_irq; 700 698 701 699 intel_setup_overlay(dev_priv); 702 700 ··· 714 716 if (i915_gem_suspend(dev_priv)) 715 717 DRM_ERROR("failed to idle hardware; continuing to unload!\n"); 716 718 i915_gem_fini(dev_priv); 717 - cleanup_uc: 718 - intel_uc_fini_fw(dev_priv); 719 719 cleanup_irq: 720 720 drm_irq_uninstall(dev); 721 721 intel_teardown_gmbus(dev_priv); ··· 958 962 static void i915_driver_cleanup_early(struct drm_i915_private *dev_priv) 959 963 { 960 964 intel_irq_fini(dev_priv); 965 + intel_uc_cleanup_early(dev_priv); 961 966 i915_gem_cleanup_early(dev_priv); 962 967 i915_workqueues_cleanup(dev_priv); 963 968 i915_engines_cleanup(dev_priv); ··· 1454 1457 i915_reset_error_state(dev_priv); 1455 1458 1456 1459 i915_gem_fini(dev_priv); 1457 - intel_uc_fini_fw(dev_priv); 1458 1460 intel_fbc_cleanup_cfb(dev_priv); 1459 1461 1460 1462 intel_power_domains_fini(dev_priv);
+2 -3
drivers/gpu/drm/i915/intel_guc_fw.c
··· 275 275 * Called from intel_uc_init_hw() during driver load, resume from sleep and 276 276 * after a GPU reset. 277 277 * 278 - * The firmware image should have already been fetched into memory by the 279 - * earlier call to intel_uc_init_fw(), so here we need to only check that 280 - * fetch succeeded, and then transfer the image to the h/w. 278 + * The firmware image should have already been fetched into memory, so only 279 + * check that fetch succeeded, and then transfer the image to the h/w. 281 280 * 282 281 * Return: non-zero code on error 283 282 */
+2 -3
drivers/gpu/drm/i915/intel_huc_fw.c
··· 155 155 * Called from intel_uc_init_hw() during driver load, resume from sleep and 156 156 * after a GPU reset. Note that HuC must be loaded before GuC. 157 157 * 158 - * The firmware image should have already been fetched into memory by the 159 - * earlier call to intel_uc_init_fw(), so here we need to only check that 160 - * fetch succeeded, and then transfer the image to the h/w. 158 + * The firmware image should have already been fetched into memory, so only 159 + * check that fetch succeeded, and then transfer the image to the h/w. 161 160 * 162 161 * Return: non-zero code on error 163 162 */
+21 -22
drivers/gpu/drm/i915/intel_uc.c
··· 162 162 GEM_BUG_ON(i915_modparams.guc_log_level < 0); 163 163 } 164 164 165 - void intel_uc_init_early(struct drm_i915_private *dev_priv) 165 + void intel_uc_init_early(struct drm_i915_private *i915) 166 166 { 167 - intel_guc_init_early(&dev_priv->guc); 168 - intel_huc_init_early(&dev_priv->huc); 167 + struct intel_guc *guc = &i915->guc; 168 + struct intel_huc *huc = &i915->huc; 169 169 170 - sanitize_options_early(dev_priv); 170 + intel_guc_init_early(guc); 171 + intel_huc_init_early(huc); 172 + 173 + sanitize_options_early(i915); 174 + 175 + if (USES_GUC(i915)) 176 + intel_uc_fw_fetch(i915, &guc->fw); 177 + 178 + if (USES_HUC(i915)) 179 + intel_uc_fw_fetch(i915, &huc->fw); 171 180 } 172 181 173 - void intel_uc_init_fw(struct drm_i915_private *dev_priv) 182 + void intel_uc_cleanup_early(struct drm_i915_private *i915) 174 183 { 175 - if (!USES_GUC(dev_priv)) 176 - return; 184 + struct intel_guc *guc = &i915->guc; 185 + struct intel_huc *huc = &i915->huc; 177 186 178 - if (USES_HUC(dev_priv)) 179 - intel_uc_fw_fetch(dev_priv, &dev_priv->huc.fw); 187 + if (USES_HUC(i915)) 188 + intel_uc_fw_fini(&huc->fw); 180 189 181 - intel_uc_fw_fetch(dev_priv, &dev_priv->guc.fw); 182 - } 190 + if (USES_GUC(i915)) 191 + intel_uc_fw_fini(&guc->fw); 183 192 184 - void intel_uc_fini_fw(struct drm_i915_private *dev_priv) 185 - { 186 - if (!USES_GUC(dev_priv)) 187 - return; 188 - 189 - intel_uc_fw_fini(&dev_priv->guc.fw); 190 - 191 - if (USES_HUC(dev_priv)) 192 - intel_uc_fw_fini(&dev_priv->huc.fw); 193 - 194 - guc_free_load_err_log(&dev_priv->guc); 193 + guc_free_load_err_log(guc); 195 194 } 196 195 197 196 /**
+1 -2
drivers/gpu/drm/i915/intel_uc.h
··· 29 29 #include "i915_params.h" 30 30 31 31 void intel_uc_init_early(struct drm_i915_private *dev_priv); 32 + void intel_uc_cleanup_early(struct drm_i915_private *dev_priv); 32 33 void intel_uc_init_mmio(struct drm_i915_private *dev_priv); 33 - void intel_uc_init_fw(struct drm_i915_private *dev_priv); 34 - void intel_uc_fini_fw(struct drm_i915_private *dev_priv); 35 34 int intel_uc_init_misc(struct drm_i915_private *dev_priv); 36 35 void intel_uc_fini_misc(struct drm_i915_private *dev_priv); 37 36 void intel_uc_sanitize(struct drm_i915_private *dev_priv);