[Intel-gfx] [PATCH 7/8] drm/i915/get_params: Add GuC status to getparams
Rodrigo Vivi
rodrigo.vivi at gmail.com
Wed Oct 5 20:51:14 UTC 2016
Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
On Mon, Oct 03, 2016 at 11:43:01AM -0700, Anusha Srivatsa wrote:
> From: Peter Antoine <peter.antoine at intel.com>
>
> This patch returns the GuC status to the caller. It is used so
> that the userspace knows if the GuC has been loaded.
>
> v4: rebase.
> v5: rebased.
>
> Signed-off-by: Anusha Srivatsa <anusha.srivatsa at intel.com>
> 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 | 18 ++++++++++++++++++
> include/uapi/drm/i915_drm.h | 1 +
> 4 files changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 7af7bd6..ff1c18d 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;
>
> @@ -339,6 +340,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
> */
> value = 1;
> break;
> + case I915_PARAM_HAS_GUC:
> + value = intel_is_guc_valid(dev_priv);
> + 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 af76ffe..3a7fa7e 100644
> --- a/drivers/gpu/drm/i915/intel_guc.h
> +++ b/drivers/gpu/drm/i915/intel_guc.h
> @@ -168,5 +168,5 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv);
> int i915_guc_wq_reserve(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_i915_private *dev_priv);
> #endif
> diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c
> index 31a2b0a..5d2a703 100644
> --- a/drivers/gpu/drm/i915/intel_guc_loader.c
> +++ b/drivers/gpu/drm/i915/intel_guc_loader.c
> @@ -801,3 +801,21 @@ 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_i915_private *dev_priv)
> +{
> + struct intel_uc_fw *guc_fw = &dev_priv->guc.guc_fw;
> +
> + if (guc_fw->load_status == UC_FIRMWARE_SUCCESS)
> + return 1;
> + else
> + return 0;
> +}
> +
> diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
> index 03725fe..629fb5e 100644
> --- a/include/uapi/drm/i915_drm.h
> +++ b/include/uapi/drm/i915_drm.h
> @@ -388,6 +388,7 @@ typedef struct drm_i915_irq_wait {
> #define I915_PARAM_HAS_POOLED_EU 38
> #define I915_PARAM_MIN_EU_IN_POOL 39
> #define I915_PARAM_MMAP_GTT_VERSION 40
> +#define I915_PARAM_HAS_GUC 41
>
> typedef struct drm_i915_getparam {
> __s32 param;
> --
> 2.7.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
More information about the Intel-gfx
mailing list