[Intel-gfx] [RFC PATCH 05/97] drm/i915/guc: use probe_error log for CT enablement failure

Michal Wajdeczko michal.wajdeczko at intel.com
Mon May 24 10:30:13 UTC 2021



On 06.05.2021 21:13, Matthew Brost wrote:
> From: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
> 
> We have a couple of failure injection points in the CT enablement path,
> so we need to use i915_probe_error() to select the appropriate log level.
> A new macro (CT_PROBE_ERROR) has been added to the set of CT logging
> macros to be used in this scenario and upcoming ones.
> 
> While adding the new macros, fix the underlying logging mechanics used
> by the existing ones (DRM_DEV_* -> drm_*) and move the inlines to
> before they're used inside the macros.
> 
> Signed-off-by: Matthew Brost <matthew.brost at intel.com>
> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
> ---
>  drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 48 ++++++++++++-----------
>  1 file changed, 25 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
> index fa9e048cc65f..25618649048f 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
> @@ -7,14 +7,36 @@
>  #include "intel_guc_ct.h"
>  #include "gt/intel_gt.h"
>  
> +static inline struct intel_guc *ct_to_guc(struct intel_guc_ct *ct)
> +{
> +	return container_of(ct, struct intel_guc, ct);
> +}
> +
> +static inline struct intel_gt *ct_to_gt(struct intel_guc_ct *ct)
> +{
> +	return guc_to_gt(ct_to_guc(ct));
> +}
> +
> +static inline struct drm_i915_private *ct_to_i915(struct intel_guc_ct *ct)
> +{
> +	return ct_to_gt(ct)->i915;
> +}
> +
> +static inline struct drm_device *ct_to_drm(struct intel_guc_ct *ct)
> +{
> +	return &ct_to_i915(ct)->drm;
> +}
> +
>  #define CT_ERROR(_ct, _fmt, ...) \
> -	DRM_DEV_ERROR(ct_to_dev(_ct), "CT: " _fmt, ##__VA_ARGS__)
> +	drm_err(ct_to_drm(_ct), "CT: " _fmt, ##__VA_ARGS__)
>  #ifdef CONFIG_DRM_I915_DEBUG_GUC
>  #define CT_DEBUG(_ct, _fmt, ...) \
> -	DRM_DEV_DEBUG_DRIVER(ct_to_dev(_ct), "CT: " _fmt, ##__VA_ARGS__)
> +	drm_dbg(ct_to_drm(_ct), "CT: " _fmt, ##__VA_ARGS__)
>  #else
>  #define CT_DEBUG(...)	do { } while (0)
>  #endif
> +#define CT_PROBE_ERROR(_ct, _fmt, ...) \
> +	i915_probe_error(ct_to_i915(ct), "CT: " _fmt, ##__VA_ARGS__);
>  
>  struct ct_request {
>  	struct list_head link;
> @@ -47,26 +69,6 @@ void intel_guc_ct_init_early(struct intel_guc_ct *ct)
>  	INIT_WORK(&ct->requests.worker, ct_incoming_request_worker_func);
>  }
>  
> -static inline struct intel_guc *ct_to_guc(struct intel_guc_ct *ct)
> -{
> -	return container_of(ct, struct intel_guc, ct);
> -}
> -
> -static inline struct intel_gt *ct_to_gt(struct intel_guc_ct *ct)
> -{
> -	return guc_to_gt(ct_to_guc(ct));
> -}
> -
> -static inline struct drm_i915_private *ct_to_i915(struct intel_guc_ct *ct)
> -{
> -	return ct_to_gt(ct)->i915;
> -}
> -
> -static inline struct device *ct_to_dev(struct intel_guc_ct *ct)
> -{
> -	return ct_to_i915(ct)->drm.dev;
> -}
> -
>  static inline const char *guc_ct_buffer_type_to_str(u32 type)
>  {
>  	switch (type) {
> @@ -264,7 +266,7 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct)
>  err_deregister:
>  	ct_deregister_buffer(ct, INTEL_GUC_CT_BUFFER_TYPE_RECV);
>  err_out:
> -	CT_ERROR(ct, "Failed to open open CT channel (err=%d)\n", err);
> +	CT_PROBE_ERROR(ct, "Failed to open channel (err=%d)\n", err);

nit: while here we can start using %pe to print error

Reviewed-by: Michal Wajdeczko <michal.wajdeczko at intel.com>

>  	return err;
>  }
>  
> 


More information about the Intel-gfx mailing list