]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/perf: Invalidate OA TLB on when closing perf stream
authorUmesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Mon, 9 Mar 2020 21:10:57 +0000 (14:10 -0700)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Fri, 20 Mar 2020 14:04:44 +0000 (07:04 -0700)
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@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: c9202ec0380d ("drm/i915/tgl: Add perf support on TGL")
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200309211057.38575-1-umesh.nerlige.ramappa@intel.com
(cherry picked from commit a639b0c15065df930467695b76ef38d5edaed049)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/i915/i915_perf.c
drivers/gpu/drm/i915/i915_reg.h

index 1b074bb4a7fe71aba10c5f0243b3af15c76f2a7d..551be589d6f481449718e0d0d50991e957ccf4f5 100644 (file)
@@ -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");
 }
 
 /**
index 309cb7d96b353aaccbe1b6e15bd2c68267260625..59e64acc2c5680afd514b860a258c321728ea2d9 100644 (file)
@@ -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