Disable Clock gating in EU when gathering the events so that EU events
are not lost.

v2: Fix checkpatch issues

Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.rama...@intel.com>
Reviewed-by: Ashutosh Dixit <ashutosh.di...@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_gt_regs.h |  1 +
 drivers/gpu/drm/i915/i915_perf.c        | 23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/i915/gt/intel_gt_regs.h 
b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
index 2275ee47da95..8bb1694035a6 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
+++ b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
@@ -1131,6 +1131,7 @@
 #define   GEN12_DISABLE_EARLY_READ             REG_BIT(14)
 #define   GEN12_ENABLE_LARGE_GRF_MODE          REG_BIT(12)
 #define   GEN12_PUSH_CONST_DEREF_HOLD_DIS      REG_BIT(8)
+#define   GEN12_DISABLE_DOP_GATING              REG_BIT(0)
 
 #define RT_CTRL                                        _MMIO(0xe530)
 #define   DIS_NULL_QUERY                       REG_BIT(10)
diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index ad74fa5847f7..ccc0bd9f2969 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -2773,6 +2773,18 @@ gen12_enable_metric_set(struct i915_perf_stream *stream,
        u32 sqcnt1;
        int ret;
 
+       /*
+        * Wa_1508761755:xehpsdv, dg2
+        * EU NOA signals behave incorrectly if EU clock gating is enabled.
+        * Disable thread stall DOP gating and EU DOP gating.
+        */
+       if (IS_XEHPSDV(i915) || IS_DG2(i915)) {
+               intel_uncore_write(uncore, GEN8_ROW_CHICKEN,
+                                  
_MASKED_BIT_ENABLE(STALL_DOP_GATING_DISABLE));
+               intel_uncore_write(uncore, GEN7_ROW_CHICKEN2,
+                                  
_MASKED_BIT_ENABLE(GEN12_DISABLE_DOP_GATING));
+       }
+
        intel_uncore_write(uncore, GEN12_OAG_OA_DEBUG,
                           /* Disable clk ratio reports, like previous Gens. */
                           
_MASKED_BIT_ENABLE(GEN12_OAG_OA_DEBUG_DISABLE_CLK_RATIO_REPORTS |
@@ -2851,6 +2863,17 @@ static void gen12_disable_metric_set(struct 
i915_perf_stream *stream)
        struct drm_i915_private *i915 = stream->perf->i915;
        u32 sqcnt1;
 
+       /*
+        * Wa_1508761755:xehpsdv, dg2
+        * Enable thread stall DOP gating and EU DOP gating.
+        */
+       if (IS_XEHPSDV(i915) || IS_DG2(i915)) {
+               intel_uncore_write(uncore, GEN8_ROW_CHICKEN,
+                                  
_MASKED_BIT_DISABLE(STALL_DOP_GATING_DISABLE));
+               intel_uncore_write(uncore, GEN7_ROW_CHICKEN2,
+                                  
_MASKED_BIT_DISABLE(GEN12_DISABLE_DOP_GATING));
+       }
+
        /* Reset all contexts' slices/subslices configurations. */
        gen12_configure_all_contexts(stream, NULL, NULL);
 
-- 
2.25.1

Reply via email to