[PATCH 09/10] drm/i915/tgl:Added DC3CO counter in i915_dmc_info.

Anshuman Gupta
2019-06-28T13:12:58Z

This patch exposes DC3CO counter in i915_dmc_info debugfs.
Which will be useful for DC3CO validation.
DMC firmware is using DMC_DEBUG3 register as DC3CO counter.

Cc: jani.nikula@intel.com
Cc: imre.deak@intel.com
Cc: animesh.manna@intel.com
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
---
drivers/gpu/drm/i915/i915_debugfs.c | 15 ++++++++++++++-
drivers/gpu/drm/i915/i915_reg.h | 3 +++
2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 072464a18050..76e425cc19c2 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2719,9 +2719,22 @@ static int i915_dmc_info(struct seq_file *m, void *unused)
seq_printf(m, "version: %d.%d\n", CSR_VERSION_MAJOR(csr->version),
CSR_VERSION_MINOR(csr->version));

- if (WARN_ON(INTEL_GEN(dev_priv) > 11))
+ if (WARN_ON(INTEL_GEN(dev_priv) > 12))
goto out;

+ /*
+ * B.Spes specify that DMC_DEBUG3 is general debug register
+ * DMC folks uses this register for DC3CO counter for TGL
+ */
+ /*
+ * It requires TGL plaform enabling pacthes to be merged in order to use
+ * IS_TIGERLAKE() macro. Using INTEL_GEN instead of IS_TIGERLAKE in
+ * order to avoid compilation errors.
+ */
+ //if (IS_TIGERLAKE(dev_priv))
+ if (INTEL_GEN(dev_priv) == 12)
+ seq_printf(m, "DC3CO count: %d\n", I915_READ(DMC_DEBUG3));
+
seq_printf(m, "DC3 -> DC5 count: %d\n",
I915_READ(IS_BROXTON(dev_priv) ? BXT_CSR_DC3_DC5_COUNT :
SKL_CSR_DC3_DC5_COUNT));
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index bf59ff40719f..3febd29df5d3 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -7221,6 +7221,9 @@ enum {
#define SKL_CSR_DC5_DC6_COUNT _MMIO(0x8002C)
#define BXT_CSR_DC3_DC5_COUNT _MMIO(0x80038)

+/* DMC DEBUG COUNTERS for TGL*/
+#define DMC_DEBUG3 _MMIO(0x101090) /*DC3CO debug counter*/
+
/* interrupts */
#define DE_MASTER_IRQ_CONTROL (1 << 31)
#define DE_SPRITEB_FLIP_DONE (1 << 29)