[Intel-gfx] [PATCH v2 1/2] drm/i915/get_params: Add GuC status to getparams

Chris Wilson chris at chris-wilson.co.uk
Wed Aug 17 12:11:51 UTC 2016


On Wed, Aug 17, 2016 at 01:06:04PM +0100, Peter Antoine wrote:
> This patch returns the GuC status to the caller. It is used so
> that the userspace knows if the GuC has been loaded.
> 
> Signed-off-by: Peter Antoine <peter.antoine at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.c         |  4 ++++
>  drivers/gpu/drm/i915/intel_guc.h        |  2 +-
>  drivers/gpu/drm/i915/intel_guc_loader.c | 19 +++++++++++++++++++
>  include/uapi/drm/i915_drm.h             |  1 +
>  4 files changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 499a6ff..c8fc3d0 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -49,6 +49,7 @@
>  #include "i915_trace.h"
>  #include "i915_vgpu.h"
>  #include "intel_drv.h"
> +#include "intel_guc.h"
>  
>  static struct drm_driver driver;
>  
> @@ -354,6 +355,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
>  	case I915_PARAM_MIN_EU_IN_POOL:
>  		value = INTEL_INFO(dev)->min_eu_in_pool;
>  		break;
> +	case I915_PARAM_HAS_GUC:
> +		value = intel_is_guc_valid(dev);
> +		break;
>  	default:
>  		DRM_DEBUG("Unknown parameter %d\n", param->param);
>  		return -EINVAL;
> diff --git a/drivers/gpu/drm/i915/intel_guc.h b/drivers/gpu/drm/i915/intel_guc.h
> index efddaed..5e8bb1e 100644
> --- a/drivers/gpu/drm/i915/intel_guc.h
> +++ b/drivers/gpu/drm/i915/intel_guc.h
> @@ -166,5 +166,5 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv);
>  int i915_guc_wq_check_space(struct drm_i915_gem_request *rq);
>  void i915_guc_submission_disable(struct drm_i915_private *dev_priv);
>  void i915_guc_submission_fini(struct drm_i915_private *dev_priv);
> -
> +int intel_is_guc_valid(struct drm_device *dev);
>  #endif
> diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c
> index e24847f..e99278f 100644
> --- a/drivers/gpu/drm/i915/intel_guc_loader.c
> +++ b/drivers/gpu/drm/i915/intel_guc_loader.c
> @@ -782,3 +782,22 @@ void intel_guc_fini(struct drm_device *dev)
>  
>  	guc_fw->fetch_status = UC_FIRMWARE_NONE;
>  }
> +
> +/**
> + * intel_is_guc_valid() - Check to see if the GuC is fully loaded.
> + * @dev:	drm dedvice to check.
> + *
> + * This function will return true if the guc has been loaded and
> + * has valid firmware.
> + */
> +int intel_is_guc_valid(struct drm_device *dev)
> +{
> +	struct drm_i915_private *dev_priv = to_i915(dev);
> +	struct intel_uc_fw *guc_fw = &dev_priv->guc.guc_fw;
> +
> +	if (guc_fw->load_status == UC_FIRMWARE_SUCCESS)
> +		return 1;
> +	else
> +		return 0;

Same suggestions as for intel_is_huc_valid.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list