[Intel-gfx] [PATCH] drm/i915/perf: Invalidate OA TLB on when closing perf stream

Lionel Landwerlin lionel.g.landwerlin at intel.com
Tue Mar 10 09:03:55 UTC 2020


On 09/03/2020 23:10, Umesh Nerlige Ramappa wrote:
> On running several back to back perf capture sessions involving closing
> and opening the perf stream, invalid OA reports are seen in the
> beginning of the OA buffer in some sessions. Fix this by invalidating OA
> TLB when the perf stream is closed or disabled on gen12.
>
> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
> ---
>   drivers/gpu/drm/i915/i915_perf.c | 8 ++++++++
>   drivers/gpu/drm/i915/i915_reg.h  | 2 ++
>   2 files changed, 10 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
> index 1b074bb4a7fe..551be589d6f4 100644
> --- a/drivers/gpu/drm/i915/i915_perf.c
> +++ b/drivers/gpu/drm/i915/i915_perf.c
> @@ -2700,6 +2700,14 @@ static void gen12_oa_disable(struct i915_perf_stream *stream)
>   				    50))
>   		drm_err(&stream->perf->i915->drm,
>   			"wait for OA to be disabled timed out\n");
> +
> +	intel_uncore_write(uncore, GEN12_OA_TLB_INV_CR, 1);
> +	if (intel_wait_for_register(uncore,
> +				    GEN12_OA_TLB_INV_CR,
> +				    1, 0,
> +				    50))
> +		drm_err(&stream->perf->i915->drm,
> +			"wait for OA tlb invalidate timed out\n");
>   }
>   
>   /**
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 79ae9654dac9..95725e61d9f1 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -693,6 +693,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
>   #define OABUFFER_SIZE_8M    (6 << 3)
>   #define OABUFFER_SIZE_16M   (7 << 3)
>   
> +#define GEN12_OA_TLB_INV_CR _MMIO(0xceec)
> +
>   /* Gen12 OAR unit */
>   #define GEN12_OAR_OACONTROL _MMIO(0x2960)
>   #define  GEN12_OAR_OACONTROL_COUNTER_FORMAT_SHIFT 1




More information about the Intel-gfx mailing list