Re: [PATCH 05/21] drm/i915: Make i915_clear_error_registers take uncore

Chris Wilson
2019-06-06T09:50:23Z

Quoting Tvrtko Ursulin (2019-06-06 10:36:23)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> The function mostly uses uncore so make the argument reflect that.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Suggested-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
> drivers/gpu/drm/i915/gt/intel_reset.c | 8 ++++----
> drivers/gpu/drm/i915/gt/intel_reset.h | 5 +++--
> drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +-
> 3 files changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/gt/intel_reset.c
> index a6ecfdc735c4..ca5c6dd28203 100644
> --- a/drivers/gpu/drm/i915/gt/intel_reset.c
> +++ b/drivers/gpu/drm/i915/gt/intel_reset.c
> @@ -1166,10 +1166,10 @@ static void gen8_clear_engine_error_register(struct intel_engine_cs *engine)
> GEN6_RING_FAULT_REG_POSTING_READ(engine);
> }
>
> -void i915_clear_error_registers(struct drm_i915_private *i915,
> - intel_engine_mask_t engine_mask)
> +void uncore_clear_error_registers(struct intel_uncore *uncore,
> + intel_engine_mask_t engine_mask)
> {
> - struct intel_uncore *uncore = &i915->uncore;
> + struct drm_i915_private *i915 = uncore_to_i915(uncore);
> u32 eir;
>
> if (!IS_GEN(i915, 2))
> @@ -1253,7 +1253,7 @@ void i915_handle_error(struct drm_i915_private *i915,
>
> if (flags & I915_ERROR_CAPTURE) {
> i915_capture_error_state(i915, engine_mask, msg);
> - i915_clear_error_registers(i915, engine_mask);
> + uncore_clear_error_registers(&i915->uncore, engine_mask);
> }
>
> /*
> diff --git a/drivers/gpu/drm/i915/gt/intel_reset.h b/drivers/gpu/drm/i915/gt/intel_reset.h
> index 4f3c1acac1a3..2c57dc6c26f7 100644
> --- a/drivers/gpu/drm/i915/gt/intel_reset.h
> +++ b/drivers/gpu/drm/i915/gt/intel_reset.h
> @@ -12,6 +12,7 @@
> #include <linux/srcu.h>
>
> #include "gt/intel_engine_types.h"
> +#include "intel_uncore.h"
>
> struct drm_i915_private;
> struct i915_request;
> @@ -25,8 +26,8 @@ void i915_handle_error(struct drm_i915_private *i915,
> const char *fmt, ...);
> #define I915_ERROR_CAPTURE BIT(0)
>
> -void i915_clear_error_registers(struct drm_i915_private *i915,
> - intel_engine_mask_t engine_mask);
> +void uncore_clear_error_registers(struct intel_uncore *uncore,
> + intel_engine_mask_t engine_mask);

intel_uncore_*

>
> void i915_reset(struct drm_i915_private *i915,
> intel_engine_mask_t stalled_mask,
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 84104e9cc507..0fe568cfabe0 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -2358,7 +2358,7 @@ void i915_check_and_clear_faults(struct drm_i915_private *dev_priv)
> else
> return;
>
> - i915_clear_error_registers(dev_priv, ALL_ENGINES);
> + uncore_clear_error_registers(&dev_priv->uncore, ALL_ENGINES);
> }

And honestly I would prefer just to move i915_check_and_clear_faults if
that seems reasonable.
-Chris