drm/i915: split out stepping info to a new file
authorJani Nikula <jani.nikula@intel.com>
Fri, 26 Mar 2021 13:21:32 +0000 (15:21 +0200)
committerJani Nikula <jani.nikula@intel.com>
Mon, 29 Mar 2021 11:55:59 +0000 (14:55 +0300)
gt/intel_workarounds.c is decidedly the wrong place for handling
stepping info. Add new intel_step.[ch] for the data, and move the
stepping arrays there. No functional changes.

v2: Rename stepping->step

Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/f69baf82819a8a35815fca25a520de5c38a7e1b5.1616764798.git.jani.nikula@intel.com
drivers/gpu/drm/i915/Makefile
drivers/gpu/drm/i915/gt/intel_workarounds.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_step.c [new file with mode: 0644]
drivers/gpu/drm/i915/intel_step.h [new file with mode: 0644]

index 19d1833..aaa051b 100644 (file)
@@ -52,6 +52,7 @@ i915-y += i915_drv.o \
          intel_pm.o \
          intel_runtime_pm.o \
          intel_sideband.o \
+         intel_step.o \
          intel_uncore.o \
          intel_wakeref.o \
          vlv_suspend.o
index 8c0c050..fd89a20 100644 (file)
  * - Public functions to init or apply the given workaround type.
  */
 
-/*
- * KBL revision ID ordering is bizarre; higher revision ID's map to lower
- * steppings in some cases.  So rather than test against the revision ID
- * directly, let's map that into our own range of increasing ID's that we
- * can test against in a regular manner.
- */
-
-const struct i915_rev_steppings kbl_revids[] = {
-       [0] = { .gt_stepping = KBL_REVID_A0, .disp_stepping = KBL_REVID_A0 },
-       [1] = { .gt_stepping = KBL_REVID_B0, .disp_stepping = KBL_REVID_B0 },
-       [2] = { .gt_stepping = KBL_REVID_C0, .disp_stepping = KBL_REVID_B0 },
-       [3] = { .gt_stepping = KBL_REVID_D0, .disp_stepping = KBL_REVID_B0 },
-       [4] = { .gt_stepping = KBL_REVID_F0, .disp_stepping = KBL_REVID_C0 },
-       [5] = { .gt_stepping = KBL_REVID_C0, .disp_stepping = KBL_REVID_B1 },
-       [6] = { .gt_stepping = KBL_REVID_D1, .disp_stepping = KBL_REVID_B1 },
-       [7] = { .gt_stepping = KBL_REVID_G0, .disp_stepping = KBL_REVID_C0 },
-};
-
-const struct i915_rev_steppings tgl_uy_revid_step_tbl[] = {
-       [0] = { .gt_stepping = STEP_A0, .disp_stepping = STEP_A0 },
-       [1] = { .gt_stepping = STEP_B0, .disp_stepping = STEP_C0 },
-       [2] = { .gt_stepping = STEP_B1, .disp_stepping = STEP_C0 },
-       [3] = { .gt_stepping = STEP_C0, .disp_stepping = STEP_D0 },
-};
-
-/* Same GT stepping between tgl_uy_revids and tgl_revids don't mean the same HW */
-const struct i915_rev_steppings tgl_revid_step_tbl[] = {
-       [0] = { .gt_stepping = STEP_A0, .disp_stepping = STEP_B0 },
-       [1] = { .gt_stepping = STEP_B0, .disp_stepping = STEP_D0 },
-};
-
-const struct i915_rev_steppings adls_revid_step_tbl[] = {
-       [0x0] = { .gt_stepping = STEP_A0, .disp_stepping = STEP_A0 },
-       [0x1] = { .gt_stepping = STEP_A0, .disp_stepping = STEP_A2 },
-       [0x4] = { .gt_stepping = STEP_B0, .disp_stepping = STEP_B0 },
-       [0x8] = { .gt_stepping = STEP_C0, .disp_stepping = STEP_B0 },
-       [0xC] = { .gt_stepping = STEP_D0, .disp_stepping = STEP_C0 },
-};
-
 static void wa_init_start(struct i915_wa_list *wal, const char *name, const char *engine_name)
 {
        wal->name = name;
index 807f373..0c7fdb5 100644 (file)
 #include "gt/uc/intel_uc.h"
 
 #include "intel_device_info.h"
+#include "intel_memory_region.h"
 #include "intel_pch.h"
 #include "intel_runtime_pm.h"
-#include "intel_memory_region.h"
+#include "intel_step.h"
 #include "intel_uncore.h"
 #include "intel_wakeref.h"
 #include "intel_wopcm.h"
@@ -1467,14 +1468,6 @@ enum {
        KBL_REVID_G0,
 };
 
-struct i915_rev_steppings {
-       u8 gt_stepping;
-       u8 disp_stepping;
-};
-
-/* Defined in intel_workarounds.c */
-extern const struct i915_rev_steppings kbl_revids[];
-
 #define IS_KBL_GT_REVID(dev_priv, since, until) \
        (IS_KABYLAKE(dev_priv) && \
         kbl_revids[INTEL_REVID(dev_priv)].gt_stepping >= since && \
@@ -1523,14 +1516,6 @@ enum {
        STEP_D0,
 };
 
-#define TGL_UY_REVID_STEP_TBL_SIZE     4
-#define TGL_REVID_STEP_TBL_SIZE                2
-#define ADLS_REVID_STEP_TBL_SIZE       13
-
-extern const struct i915_rev_steppings tgl_uy_revid_step_tbl[TGL_UY_REVID_STEP_TBL_SIZE];
-extern const struct i915_rev_steppings tgl_revid_step_tbl[TGL_REVID_STEP_TBL_SIZE];
-extern const struct i915_rev_steppings adls_revid_step_tbl[ADLS_REVID_STEP_TBL_SIZE];
-
 static inline const struct i915_rev_steppings *
 tgl_stepping_get(struct drm_i915_private *dev_priv)
 {
diff --git a/drivers/gpu/drm/i915/intel_step.c b/drivers/gpu/drm/i915/intel_step.c
new file mode 100644 (file)
index 0000000..e19820c
--- /dev/null
@@ -0,0 +1,46 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2020,2021 Intel Corporation
+ */
+
+#include "i915_drv.h"
+#include "intel_step.h"
+
+/*
+ * KBL revision ID ordering is bizarre; higher revision ID's map to lower
+ * steppings in some cases.  So rather than test against the revision ID
+ * directly, let's map that into our own range of increasing ID's that we
+ * can test against in a regular manner.
+ */
+
+const struct i915_rev_steppings kbl_revids[] = {
+       [0] = { .gt_stepping = KBL_REVID_A0, .disp_stepping = KBL_REVID_A0 },
+       [1] = { .gt_stepping = KBL_REVID_B0, .disp_stepping = KBL_REVID_B0 },
+       [2] = { .gt_stepping = KBL_REVID_C0, .disp_stepping = KBL_REVID_B0 },
+       [3] = { .gt_stepping = KBL_REVID_D0, .disp_stepping = KBL_REVID_B0 },
+       [4] = { .gt_stepping = KBL_REVID_F0, .disp_stepping = KBL_REVID_C0 },
+       [5] = { .gt_stepping = KBL_REVID_C0, .disp_stepping = KBL_REVID_B1 },
+       [6] = { .gt_stepping = KBL_REVID_D1, .disp_stepping = KBL_REVID_B1 },
+       [7] = { .gt_stepping = KBL_REVID_G0, .disp_stepping = KBL_REVID_C0 },
+};
+
+const struct i915_rev_steppings tgl_uy_revid_step_tbl[] = {
+       [0] = { .gt_stepping = STEP_A0, .disp_stepping = STEP_A0 },
+       [1] = { .gt_stepping = STEP_B0, .disp_stepping = STEP_C0 },
+       [2] = { .gt_stepping = STEP_B1, .disp_stepping = STEP_C0 },
+       [3] = { .gt_stepping = STEP_C0, .disp_stepping = STEP_D0 },
+};
+
+/* Same GT stepping between tgl_uy_revids and tgl_revids don't mean the same HW */
+const struct i915_rev_steppings tgl_revid_step_tbl[] = {
+       [0] = { .gt_stepping = STEP_A0, .disp_stepping = STEP_B0 },
+       [1] = { .gt_stepping = STEP_B0, .disp_stepping = STEP_D0 },
+};
+
+const struct i915_rev_steppings adls_revid_step_tbl[] = {
+       [0x0] = { .gt_stepping = STEP_A0, .disp_stepping = STEP_A0 },
+       [0x1] = { .gt_stepping = STEP_A0, .disp_stepping = STEP_A2 },
+       [0x4] = { .gt_stepping = STEP_B0, .disp_stepping = STEP_B0 },
+       [0x8] = { .gt_stepping = STEP_C0, .disp_stepping = STEP_B0 },
+       [0xC] = { .gt_stepping = STEP_D0, .disp_stepping = STEP_C0 },
+};
diff --git a/drivers/gpu/drm/i915/intel_step.h b/drivers/gpu/drm/i915/intel_step.h
new file mode 100644 (file)
index 0000000..af922ae
--- /dev/null
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2020,2021 Intel Corporation
+ */
+
+#ifndef __INTEL_STEP_H__
+#define __INTEL_STEP_H__
+
+#include <linux/types.h>
+
+struct i915_rev_steppings {
+       u8 gt_stepping;
+       u8 disp_stepping;
+};
+
+#define TGL_UY_REVID_STEP_TBL_SIZE     4
+#define TGL_REVID_STEP_TBL_SIZE                2
+#define ADLS_REVID_STEP_TBL_SIZE       13
+
+extern const struct i915_rev_steppings kbl_revids[];
+extern const struct i915_rev_steppings tgl_uy_revid_step_tbl[TGL_UY_REVID_STEP_TBL_SIZE];
+extern const struct i915_rev_steppings tgl_revid_step_tbl[TGL_REVID_STEP_TBL_SIZE];
+extern const struct i915_rev_steppings adls_revid_step_tbl[ADLS_REVID_STEP_TBL_SIZE];
+
+#endif /* __INTEL_STEP_H__ */