Re: [PATCH 7/8] drm/i915/guc: Simplify intel_guc_init_hw()

Michal Wajdeczko
2017-02-17T14:03:22Z

On Fri, Feb 17, 2017 at 02:05:56PM +0100, Arkadiusz Hiler wrote:
> Current version of intel_guc_init_hw() does a lot:
> - cares about submission
> - loads huc
> - implement WA
>
> This change offloads some of the logic to intel_uc_load(), which now
> cares about the above.
>
> v2: rename guc_hw_reset and fix typo in define name (M. Wajdeczko)
>
> Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
> Cc: Michal Winiarski <michal.winiarski@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> ---

<SNIP>

> diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c
> index ef9dc72..2bb49b7 100644
> --- a/drivers/gpu/drm/i915/intel_uc.c
> +++ b/drivers/gpu/drm/i915/intel_uc.c
> @@ -29,6 +29,25 @@
> static void uc_fetch_fw(struct drm_i915_private *dev_priv,
> struct intel_uc_fw *uc_fw);
>
> +static int guc_hw_reset(struct drm_i915_private *dev_priv)

This function looks like and is guc specific.
Maybe we should revisit the idea of having separate intel_guc.c file
that will hold only guc specific functions. And use intel_uc.c file
only for functions that are common across Guc, Huc...

-Michal

> +{
> + int ret;
> + u32 guc_status;
> +
> + ret = intel_guc_reset(dev_priv);
> + if (ret) {
> + DRM_ERROR("GuC reset failed, ret = %d\n", ret);
> + return ret;
> + }
> +
> + guc_status = I915_READ(GUC_STATUS);
> + WARN(!(guc_status & GS_MIA_IN_RESET),
> + "GuC status: 0x%x, MIA core expected to be in reset\n",
> + guc_status);
> +
> + return ret;
> +}
> +
> void intel_uc_sanitize_params(struct drm_i915_private *dev_priv)
> {
> if (!HAS_GUC(dev_priv)) {