Skip to contentSkip to conversation

drm/i915/icl: Define MOCS table for Icelake

PATCH Superseded Tomasz Lis 7 participants 18 messages Oct 19, 2018 – Oct 31, 2018

Subsystems (3)
lore
Share & tools
lore

Tomasz Lis

author
#0 lore raw

PATCH 1/1 drm/i915/icl: Define MOCS table for Icelake

The table has been unified across OSes to minimize virtualization overhead.

The MOCS table is now versioned; the patch includes version 1 entries.

BSpec: 34007
BSpec: 560

Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Zhenyu Wang <[email protected]>
---
 drivers/gpu/drm/i915/intel_mocs.c | 246 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 244 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_mocs.c +244 -2
index 77e9871..b76d6db 100644
@@ -44,6 +44,8 @@ struct drm_i915_mocs_table {
 #define LE_SCC(value)		((value) << 8)
 #define LE_PFM(value)		((value) << 11)
 #define LE_SCF(value)		((value) << 14)
+#define LE_CoS(value)		((value) << 15)
+#define LE_SSE(value)		((value) << 17)
 
 /* Defines for the tables (LNCFMOCS0 - LNCFMOCS31) - two entries per word */
 #define L3_ESC(value)		((value) << 0)
@@ -96,6 +98,243 @@ struct drm_i915_mocs_table {
  *       may only be updated incrementally by adding entries at the
  *       end.
  */
+static const struct drm_i915_mocs_entry icelake_mocs_table[] = {
+	[0] = {
+	  /* Base - Uncached (Deprecated) */
+	  .control_value = LE_CACHEABILITY(LE_UC) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[1] = {
+	  /* Base - L3 + LeCC:PAT (Deprecated) */
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[2] = {
+	  /* Base - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[3] = {
+	  /* Base - Uncached */
+	  .control_value = LE_CACHEABILITY(LE_UC) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[4] = {
+	  /* Base - L3 */
+	  .control_value = LE_CACHEABILITY(LE_UC) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[5] = {
+	  /* Base - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[6] = {
+	  /* Age 0 - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[7] = {
+	  /* Age 0 - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[8] = {
+	  /* Age: Don't Chg. - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[9] = {
+	  /* Age: Don't Chg. - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[10] = {
+	  /* No AOM - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[11] = {
+	  /* No AOM - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[12] = {
+	  /* No AOM; Age 0 - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[13] = {
+	  /* No AOM; Age 0 - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[14] = {
+	  /* No AOM; Age:DC - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[15] = {
+	  /* No AOM; Age:DC - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[16] = {
+	  /* Reserved - For future use */
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+			   LE_TGT_CACHE(LE_TC_PAGETABLE) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_DIRECT),
+	},
+	[17] = {
+	  /* Reserved - For future use */
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+			   LE_TGT_CACHE(LE_TC_PAGETABLE) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_DIRECT),
+	},
+	[18] = {
+	  /* Self-Snoop - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(3),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[19] = {
+	  /* Skip Caching - L3 + LLC(12.5%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[20] = {
+	  /* Skip Caching - L3 + LLC(25%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[21] = {
+	  /* Skip Caching - L3 + LLC(50%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[22] = {
+	  /* Skip Caching - L3 + LLC(75%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(1) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[23] = {
+	  /* Skip Caching - L3 + LLC(87.5%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(1) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[62] = {
+	  /* HW Reserved - SW program but never use */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[63] = {
+	  /* HW Reserved - SW program but never use */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+};
+
 static const struct drm_i915_mocs_entry skylake_mocs_table[] = {
 	[I915_MOCS_UNCACHED] = {
 	  /* 0x00000009 */
@@ -178,8 +417,11 @@ static bool get_mocs_settings(struct drm_i915_private *dev_priv,
 {
 	bool result = false;
 
-	if (IS_GEN9_BC(dev_priv) || IS_CANNONLAKE(dev_priv) ||
-	    IS_ICELAKE(dev_priv)) {
+	if (IS_ICELAKE(dev_priv)) {
+		table->size  = ARRAY_SIZE(icelake_mocs_table);
+		table->table = icelake_mocs_table;
+		result = true;
+	} else if (IS_GEN9_BC(dev_priv) || IS_CANNONLAKE(dev_priv)) {
 		table->size  = ARRAY_SIZE(skylake_mocs_table);
 		table->table = skylake_mocs_table;
 		result = true;
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 3 lines · Tomasz Lis

The table has been unified across OSes to minimize virtualization overhead.

The MOCS table is now versioned; the patch includes version 1 entries.

A bit more explanation is required here. We need to make clear the fact that existing entries in the table for a given gen will not change in new versions of the table and only new entries might be added. Also the fact that since the table is in the specs we expect the users to know what each entry of the table means and we're therefore deprecating exposing the entries in the uapi with an enum. Might also be worth mentioning that the first 3 entries are compatible with the legacy i915 entries for previous gen but that this is not guaranteed on future gens so userland drivers need to use the ICL timeframe to transition.

Lastly, we need a way to query what version of the table the kernel is programming in HW.

Quoted 8 lines

BSpec: 34007
BSpec: 560

Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Zhenyu Wang <[email protected]>

CC some mesa people here? not sure who the right contact would be for this

Quoted 188 lines
---
  drivers/gpu/drm/i915/intel_mocs.c | 246 +++++++++++++++++++++++++++++++++++++-
  1 file changed, 244 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_mocs.c +169 -0
index 77e9871..b76d6db 100644
@@ -44,6 +44,8 @@ struct drm_i915_mocs_table {
  #define LE_SCC(value)		((value) << 8)
  #define LE_PFM(value)		((value) << 11)
  #define LE_SCF(value)		((value) << 14)
+#define LE_CoS(value)		((value) << 15)
+#define LE_SSE(value)		((value) << 17)
 
  /* Defines for the tables (LNCFMOCS0 - LNCFMOCS31) - two entries per word */
  #define L3_ESC(value)		((value) << 0)
@@ -96,6 +98,243 @@ struct drm_i915_mocs_table {
   *       may only be updated incrementally by adding entries at the
   *       end.
   */
+static const struct drm_i915_mocs_entry icelake_mocs_table[] = {
+	[0] = {
+	  /* Base - Uncached (Deprecated) */
+	  .control_value = LE_CACHEABILITY(LE_UC) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[1] = {
+	  /* Base - L3 + LeCC:PAT (Deprecated) */
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[2] = {
+	  /* Base - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[3] = {
+	  /* Base - Uncached */
+	  .control_value = LE_CACHEABILITY(LE_UC) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[4] = {
+	  /* Base - L3 */
+	  .control_value = LE_CACHEABILITY(LE_UC) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[5] = {
+	  /* Base - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[6] = {
+	  /* Age 0 - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[7] = {
+	  /* Age 0 - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[8] = {
+	  /* Age: Don't Chg. - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[9] = {
+	  /* Age: Don't Chg. - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[10] = {
+	  /* No AOM - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[11] = {
+	  /* No AOM - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[12] = {
+	  /* No AOM; Age 0 - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[13] = {
+	  /* No AOM; Age 0 - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[14] = {
+	  /* No AOM; Age:DC - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[15] = {
+	  /* No AOM; Age:DC - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[16] = {
+	  /* Reserved - For future use */
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+			   LE_TGT_CACHE(LE_TC_PAGETABLE) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_DIRECT),
+	},
+	[17] = {
+	  /* Reserved - For future use */
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+			   LE_TGT_CACHE(LE_TC_PAGETABLE) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_DIRECT),
+	},
+	[18] = {
+	  /* Self-Snoop - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |

drivers/gpu/drm/i915/intel_mocs.c struct drm_i915_mocs_table { · line 277

Quoted 10 lines
drivers/gpu/drm/i915/intel_mocs.c +10 -0
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(3),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[19] = {
+	  /* Skip Caching - L3 + LLC(12.5%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |

The spec have LE_SCC(7) here

drivers/gpu/drm/i915/intel_mocs.c struct drm_i915_mocs_table { · line 286

Quoted 9 lines
drivers/gpu/drm/i915/intel_mocs.c +9 -0
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[20] = {
+	  /* Skip Caching - L3 + LLC(25%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |

LE_SCC(3) here

drivers/gpu/drm/i915/intel_mocs.c struct drm_i915_mocs_table { · line 295

Quoted 9 lines
drivers/gpu/drm/i915/intel_mocs.c +9 -0
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[21] = {
+	  /* Skip Caching - L3 + LLC(50%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |

LE_SCC(1) here

drivers/gpu/drm/i915/intel_mocs.c struct drm_i915_mocs_table { · line 304

Quoted 9 lines
drivers/gpu/drm/i915/intel_mocs.c +9 -0
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[22] = {
+	  /* Skip Caching - L3 + LLC(75%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(1) | LE_SCC(0) |

LE_SCC(3) here

drivers/gpu/drm/i915/intel_mocs.c struct drm_i915_mocs_table { · line 313

Quoted 9 lines
drivers/gpu/drm/i915/intel_mocs.c +9 -0
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[23] = {
+	  /* Skip Caching - L3 + LLC(87.5%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(1) | LE_SCC(0) |

LE_SCC(7) here

Thanks,
Daniele

Quoted 32 lines
drivers/gpu/drm/i915/intel_mocs.c +24 -0
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[62] = {
+	  /* HW Reserved - SW program but never use */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[63] = {
+	  /* HW Reserved - SW program but never use */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+};
+
  static const struct drm_i915_mocs_entry skylake_mocs_table[] = {
  	[I915_MOCS_UNCACHED] = {
  	  /* 0x00000009 */
@@ -178,8 +417,11 @@ static bool get_mocs_settings(struct drm_i915_private *dev_priv,
  {
  	bool result = false;
 

drivers/gpu/drm/i915/intel_mocs.c static bool get_mocs_settings(struct drm_i915_private *dev_priv, · line 427

Quoted 10 lines
drivers/gpu/drm/i915/intel_mocs.c +5 -2
-	if (IS_GEN9_BC(dev_priv) || IS_CANNONLAKE(dev_priv) ||
-	    IS_ICELAKE(dev_priv)) {
+	if (IS_ICELAKE(dev_priv)) {
+		table->size  = ARRAY_SIZE(icelake_mocs_table);
+		table->table = icelake_mocs_table;
+		result = true;
+	} else if (IS_GEN9_BC(dev_priv) || IS_CANNONLAKE(dev_priv)) {
  		table->size  = ARRAY_SIZE(skylake_mocs_table);
  		table->table = skylake_mocs_table;
  		result = true;

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

✓ Fi.CI.BAT: success for drm/i915/icl: Define MOCS table for Icelake

In reply to Tomasz Lis
== Series Details ==

== Series Details ==

Series: drm/i915/icl: Define MOCS table for Icelake
URL : https://patchwork.freedesktop.org/series/51258/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_5016 -> Patchwork_10516 =

== Summary - WARNING ==

Minor unknown changes coming with Patchwork_10516 need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_10516, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/51258/revisions/1/mbox/

== Possible new issues ==

Here are the unknown changes that may have been introduced in Patchwork_10516:

=== IGT changes ===

    ==== Warnings ====

    igt@drv_selftest@live_guc:
      fi-apl-guc:         PASS -> SKIP

== Known issues ==

Here are the changes found in Patchwork_10516 that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@drv_selftest@live_execlists:
      fi-apl-guc:         PASS -> INCOMPLETE (fdo#106693)

    igt@kms_flip@basic-flip-vs-dpms:
      fi-skl-6700hq:      PASS -> DMESG-WARN (fdo#105998)

    igt@kms_pipe_crc_basic@hang-read-crc-pipe-b:
      fi-byt-clapper:     PASS -> FAIL (fdo#103191, fdo#107362)

    igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a:
      fi-byt-clapper:     PASS -> FAIL (fdo#107362)

    igt@kms_pipe_crc_basic@read-crc-pipe-a:
      fi-ilk-650:         PASS -> DMESG-WARN (fdo#106387)

    
    ==== Possible fixes ====

    igt@kms_pipe_crc_basic@read-crc-pipe-b:
      fi-byt-clapper:     FAIL (fdo#107362) -> PASS

fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#105998 https://bugs.freedesktop.org/show_bug.cgi?id=105998
fdo#106387 https://bugs.freedesktop.org/show_bug.cgi?id=106387
fdo#106693 https://bugs.freedesktop.org/show_bug.cgi?id=106693
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362

== Participating hosts (51 -> 44) ==

Additional (1): fi-cfl-8109u
Missing (8): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-snb-2520m fi-ctg-p8600 fi-icl-u

== Build changes ==

* Linux: CI_DRM_5016 -> Patchwork_10516

CI_DRM_5016: dd5831c406bfcbb9662ff8b6e874f8d455c097e1 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4685: 78619fde4008424c472906041edb1d204e014f7c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10516: 9b800d19a4bbb0350ee102fcf519c2ff6a908cae @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

9b800d19a4bb drm/i915/icl: Define MOCS table for Icelake

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10516/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

✓ Fi.CI.IGT: success for drm/i915/icl: Define MOCS table for Icelake

In reply to Tomasz Lis
== Series Details ==

== Series Details ==

Series: drm/i915/icl: Define MOCS table for Icelake
URL : https://patchwork.freedesktop.org/series/51258/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_5016_full -> Patchwork_10516_full =

== Summary - WARNING ==

Minor unknown changes coming with Patchwork_10516_full need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_10516_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

== Possible new issues ==

Here are the unknown changes that may have been introduced in Patchwork_10516_full:

=== IGT changes ===

    ==== Warnings ====

    igt@pm_rc6_residency@rc6-accuracy:
      shard-snb:          PASS -> SKIP

== Known issues ==

Here are the changes found in Patchwork_10516_full that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-b:
      shard-snb:          PASS -> DMESG-WARN (fdo#107956)

    igt@kms_ccs@pipe-a-crc-sprite-planes-basic:
      shard-glk:          PASS -> FAIL (fdo#108145)

    igt@kms_cursor_crc@cursor-64x21-onscreen:
      shard-apl:          PASS -> FAIL (fdo#103232)

    igt@kms_frontbuffer_tracking@fbc-2p-primscrn-pri-shrfb-draw-mmap-wc:
      shard-glk:          PASS -> FAIL (fdo#103167) +3

    igt@kms_plane@pixel-format-pipe-a-planes:
      shard-skl:          NOTRUN -> DMESG-FAIL (fdo#106885, fdo#103166)

    igt@kms_plane@plane-position-covered-pipe-a-planes:
      shard-glk:          PASS -> FAIL (fdo#103166)

    igt@kms_plane_alpha_blend@pipe-a-constant-alpha-max:
      shard-skl:          NOTRUN -> FAIL (fdo#108145) +1

    igt@kms_plane_alpha_blend@pipe-c-alpha-basic:
      shard-skl:          NOTRUN -> FAIL (fdo#108145, fdo#107815)

    igt@kms_setmode@basic:
      shard-apl:          PASS -> FAIL (fdo#99912)

    igt@perf_pmu@interrupts-sync:
      shard-glk:          PASS -> INCOMPLETE (k.org#198133, fdo#103359)

    igt@pm_rps@reset:
      shard-glk:          PASS -> FAIL (fdo#102250)

    igt@syncobj_wait@wait-all-for-submit-delayed-submit:
      shard-skl:          NOTRUN -> INCOMPLETE (fdo#108490)

    
    ==== Possible fixes ====

    igt@kms_color@pipe-a-legacy-gamma:
      shard-skl:          FAIL (fdo#108145, fdo#104782) -> PASS

    igt@kms_cursor_crc@cursor-size-change:
      shard-apl:          FAIL (fdo#103232) -> PASS

    igt@kms_draw_crc@draw-method-rgb565-blt-xtiled:
      shard-skl:          FAIL (fdo#103184) -> PASS

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-pri-indfb-draw-mmap-gtt:
      shard-skl:          FAIL (fdo#105682) -> PASS +1

    igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-onoff:
      shard-glk:          FAIL (fdo#103167) -> PASS +2

    igt@kms_frontbuffer_tracking@psr-1p-offscren-pri-indfb-draw-render:
      shard-skl:          FAIL (fdo#103167) -> PASS +1

    igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes:
      shard-skl:          FAIL (fdo#103166) -> PASS

    igt@kms_plane_alpha_blend@pipe-a-coverage-7efc:
      shard-skl:          FAIL (fdo#108145, fdo#107815) -> PASS

    igt@kms_plane_alpha_blend@pipe-b-constant-alpha-max:
      shard-apl:          FAIL (fdo#108145) -> PASS

    
    ==== Warnings ====

    igt@kms_fbcon_fbt@psr-suspend:
      shard-skl:          INCOMPLETE (fdo#104108) -> FAIL (fdo#107882)

fdo#102250 https://bugs.freedesktop.org/show_bug.cgi?id=102250
fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103184 https://bugs.freedesktop.org/show_bug.cgi?id=103184
fdo#103232 https://bugs.freedesktop.org/show_bug.cgi?id=103232
fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108
fdo#104782 https://bugs.freedesktop.org/show_bug.cgi?id=104782
fdo#105682 https://bugs.freedesktop.org/show_bug.cgi?id=105682
fdo#106885 https://bugs.freedesktop.org/show_bug.cgi?id=106885
fdo#107815 https://bugs.freedesktop.org/show_bug.cgi?id=107815
fdo#107882 https://bugs.freedesktop.org/show_bug.cgi?id=107882
fdo#107956 https://bugs.freedesktop.org/show_bug.cgi?id=107956
fdo#108145 https://bugs.freedesktop.org/show_bug.cgi?id=108145
fdo#108490 https://bugs.freedesktop.org/show_bug.cgi?id=108490
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133

== Participating hosts (6 -> 6) ==

No changes in participating hosts

== Build changes ==

* Linux: CI_DRM_5016 -> Patchwork_10516

CI_DRM_5016: dd5831c406bfcbb9662ff8b6e874f8d455c097e1 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4685: 78619fde4008424c472906041edb1d204e014f7c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10516: 9b800d19a4bbb0350ee102fcf519c2ff6a908cae @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10516/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author
#5 lore raw

PATCH v2 1/2 drm/i915/icl: Define MOCS table for Icelake

In reply to Tomasz Lis

The table has been unified across OSes to minimize virtualization overhead.

The MOCS table is now published as part of bspec, and versioned. Entries are supposed to never be modified, but new ones can be added. Adding entries increases table version. The patch includes version 1 entries.

Meaning of each entry is now explained in bspec, and user mode clients are expected to know what each entry means. The 3 entries used for previous platforms are still compatible with their legacy definitions, but that is not guaranteed to be true for future platforms.

BSpec: 34007
BSpec: 560

Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Zhenyu Wang <[email protected]>
Cc Zhi A Wang <[email protected]>
Cc Anuj Phogat <[email protected]>
---
 drivers/gpu/drm/i915/intel_mocs.c | 246 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 244 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_mocs.c +244 -2
index 77e9871..dc34e83 100644
@@ -44,6 +44,8 @@ struct drm_i915_mocs_table {
 #define LE_SCC(value)		((value) << 8)
 #define LE_PFM(value)		((value) << 11)
 #define LE_SCF(value)		((value) << 14)
+#define LE_CoS(value)		((value) << 15)
+#define LE_SSE(value)		((value) << 17)
 
 /* Defines for the tables (LNCFMOCS0 - LNCFMOCS31) - two entries per word */
 #define L3_ESC(value)		((value) << 0)
@@ -96,6 +98,243 @@ struct drm_i915_mocs_table {
  *       may only be updated incrementally by adding entries at the
  *       end.
  */
+static const struct drm_i915_mocs_entry icelake_mocs_table[] = {
+	[0] = {
+	  /* Base - Uncached (Deprecated) */
+	  .control_value = LE_CACHEABILITY(LE_UC) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[1] = {
+	  /* Base - L3 + LeCC:PAT (Deprecated) */
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[2] = {
+	  /* Base - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[3] = {
+	  /* Base - Uncached */
+	  .control_value = LE_CACHEABILITY(LE_UC) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[4] = {
+	  /* Base - L3 */
+	  .control_value = LE_CACHEABILITY(LE_UC) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[5] = {
+	  /* Base - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[6] = {
+	  /* Age 0 - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[7] = {
+	  /* Age 0 - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[8] = {
+	  /* Age: Don't Chg. - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[9] = {
+	  /* Age: Don't Chg. - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[10] = {
+	  /* No AOM - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[11] = {
+	  /* No AOM - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[12] = {
+	  /* No AOM; Age 0 - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[13] = {
+	  /* No AOM; Age 0 - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[14] = {
+	  /* No AOM; Age:DC - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[15] = {
+	  /* No AOM; Age:DC - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[16] = {
+	  /* Reserved - For future use */
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+			   LE_TGT_CACHE(LE_TC_PAGETABLE) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_DIRECT),
+	},
+	[17] = {
+	  /* Reserved - For future use */
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+			   LE_TGT_CACHE(LE_TC_PAGETABLE) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_DIRECT),
+	},
+	[18] = {
+	  /* Self-Snoop - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(3),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[19] = {
+	  /* Skip Caching - L3 + LLC(12.5%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(7) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[20] = {
+	  /* Skip Caching - L3 + LLC(25%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(3) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[21] = {
+	  /* Skip Caching - L3 + LLC(50%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(1) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[22] = {
+	  /* Skip Caching - L3 + LLC(75%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(1) | LE_SCC(3) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[23] = {
+	  /* Skip Caching - L3 + LLC(87.5%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(1) | LE_SCC(7) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[62] = {
+	  /* HW Reserved - SW program but never use */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[63] = {
+	  /* HW Reserved - SW program but never use */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+};
+
 static const struct drm_i915_mocs_entry skylake_mocs_table[] = {
 	[I915_MOCS_UNCACHED] = {
 	  /* 0x00000009 */
@@ -178,8 +417,11 @@ static bool get_mocs_settings(struct drm_i915_private *dev_priv,
 {
 	bool result = false;
 
-	if (IS_GEN9_BC(dev_priv) || IS_CANNONLAKE(dev_priv) ||
-	    IS_ICELAKE(dev_priv)) {
+	if (IS_ICELAKE(dev_priv)) {
+		table->size  = ARRAY_SIZE(icelake_mocs_table);
+		table->table = icelake_mocs_table;
+		result = true;
+	} else if (IS_GEN9_BC(dev_priv) || IS_CANNONLAKE(dev_priv)) {
 		table->size  = ARRAY_SIZE(skylake_mocs_table);
 		table->table = skylake_mocs_table;
 		result = true;
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#6 lore raw

PATCH v2 2/2 drm/i915/icl: Add IOCTL for getting MOCS table version

For Icelake and above, MOCS table for each platform is published within bspec. The table is versioned, and new entries are assigned a version number. Existing entries do not change and their version is constant.

This introduces a parameter which allows getting max version number of the MOCS entries currently supported, ie. value of 2 would mean only version 1 and version 2 entries are initialized and can be used by the user mode clients.

BSpec: 34007

Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Zhenyu Wang <[email protected]>
Cc Zhi A Wang <[email protected]>
Cc Anuj Phogat <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.c   |  6 ++++++
 drivers/gpu/drm/i915/intel_mocs.c | 12 ++++++++++++
 drivers/gpu/drm/i915/intel_mocs.h |  1 +
 include/uapi/drm/i915_drm.h       | 11 +++++++++++
 4 files changed, 30 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +6 -0
index baac35f..92fa8fd 100644
@@ -53,6 +53,7 @@
 #include "i915_vgpu.h"
 #include "intel_drv.h"
 #include "intel_uc.h"
+#include "intel_mocs.h"
 
 static struct drm_driver driver;
 
@@ -444,6 +445,11 @@ static int i915_getparam_ioctl(struct drm_device *dev, void *data,
 	case I915_PARAM_MMAP_GTT_COHERENT:
 		value = INTEL_INFO(dev_priv)->has_coherent_ggtt;
 		break;
+	case I915_PARAM_MOCS_TABLE_VERSION:
+		value = intel_mocs_table_version(dev_priv);
+		if (!value)
+			return -ENODEV;
+		break;
 	default:
 		DRM_DEBUG("Unknown parameter %d\n", param->param);
 		return -EINVAL;
drivers/gpu/drm/i915/intel_mocs.c +12 -0
index dc34e83..fc1e98b 100644
@@ -469,6 +469,18 @@ static i915_reg_t mocs_register(enum intel_engine_id engine_id, int index)
 }
 
 /**
+ * intel_mocs_table_version() - get version of mocs table implementation
+ * @i915: i915 device struct.
+ */
+int intel_mocs_table_version(struct drm_i915_private *i915)
+{
+	if (IS_ICELAKE(i915))
+		return 1;
+	else
+		return 0;
+}
+
+/**
  * intel_mocs_init_engine() - emit the mocs control table
  * @engine:	The engine for whom to emit the registers.
  *
drivers/gpu/drm/i915/intel_mocs.h +1 -0
index d89080d..dc1d64a 100644
@@ -55,5 +55,6 @@
 int intel_rcs_context_init_mocs(struct i915_request *rq);
 void intel_mocs_init_l3cc_table(struct drm_i915_private *dev_priv);
 void intel_mocs_init_engine(struct intel_engine_cs *engine);
+int intel_mocs_table_version(struct drm_i915_private *i915);
 
 #endif
include/uapi/drm/i915_drm.h +11 -0
index 298b2e1..16aafc4 100644
@@ -559,6 +559,17 @@ typedef struct drm_i915_irq_wait {
  */
 #define I915_PARAM_MMAP_GTT_COHERENT	52
 
+/*
+ * Query MOCS table version used during hardware initialization.
+ *
+ * The MOCS table for each platform is published as part of bspec. Entries in
+ * the table are supposed to never be modified, but new enties are added, making
+ * more indexes in the table valid. This parameter informs which version
+ * of the table was used to initialize the currently used graphics hardware,
+ * and therefore which MOCS indexes are useable.
+ */
+#define I915_PARAM_MOCS_TABLE_VERSION	53
+
 typedef struct drm_i915_getparam {
 	__s32 param;
 	/*
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

Re: [PATCH v2 2/2] drm/i915/icl: Add IOCTL for getting MOCS table version

Quoted 39 lines · Tomasz Lis

For Icelake and above, MOCS table for each platform is published within bspec. The table is versioned, and new entries are assigned a version number. Existing entries do not change and their version is constant.

This introduces a parameter which allows getting max version number of the MOCS entries currently supported, ie. value of 2 would mean only version 1 and version 2 entries are initialized and can be used by the user mode clients.

BSpec: 34007

Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Zhenyu Wang <[email protected]>
Cc Zhi A Wang <[email protected]>
Cc Anuj Phogat <[email protected]>
---
  drivers/gpu/drm/i915/i915_drv.c   |  6 ++++++
  drivers/gpu/drm/i915/intel_mocs.c | 12 ++++++++++++
  drivers/gpu/drm/i915/intel_mocs.h |  1 +
  include/uapi/drm/i915_drm.h       | 11 +++++++++++
  4 files changed, 30 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +1 -0
index baac35f..92fa8fd 100644
@@ -53,6 +53,7 @@
  #include "i915_vgpu.h"
  #include "intel_drv.h"
  #include "intel_uc.h"
+#include "intel_mocs.h"
 
  static struct drm_driver driver;
 

drivers/gpu/drm/i915/i915_drv.c static int i915_getparam_ioctl(struct drm_device *dev, void *data, · line 451

Quoted 7 lines
drivers/gpu/drm/i915/i915_drv.c +4 -0
@@ -444,6 +445,11 @@ static int i915_getparam_ioctl(struct drm_device *dev, void *data,
  	case I915_PARAM_MMAP_GTT_COHERENT:
  		value = INTEL_INFO(dev_priv)->has_coherent_ggtt;
  		break;
+	case I915_PARAM_MOCS_TABLE_VERSION:
+		value = intel_mocs_table_version(dev_priv);
+		if (!value)
+			return -ENODEV;

Do we really want to return -ENODEV for platforms that do have a MOCS table programmed, but the table is not one versioned in the specs (i.e. Gen9-10)? I think returning "0" for those to indicate "kernel-defined table" would be ok and we could limit -ENODEV for platforms that don't have a table at all. But what wins is what the callers of the ioctl would like to get from the kernel ;)

Quoted 9 lines
drivers/gpu/drm/i915/i915_drv.c +1 -0
+		break;
  	default:
  		DRM_DEBUG("Unknown parameter %d\n", param->param);
  		return -EINVAL;
drivers/gpu/drm/i915/intel_mocs.c +0 -0
index dc34e83..fc1e98b 100644

drivers/gpu/drm/i915/intel_mocs.c static i915_reg_t mocs_register(enum intel_engine_id engine_id, int index) · line 478

Quoted 10 lines
drivers/gpu/drm/i915/intel_mocs.c +7 -0
@@ -469,6 +469,18 @@ static i915_reg_t mocs_register(enum intel_engine_id engine_id, int index)
  }
 
  /**
+ * intel_mocs_table_version() - get version of mocs table implementation
+ * @i915: i915 device struct.
+ */
+int intel_mocs_table_version(struct drm_i915_private *i915)
+{
+	if (IS_ICELAKE(i915))
+		return 1;

Can we add this version value as a define above the table, to keep them close to each other?

If we agree on my suggestion above to differentiate between no table at all (< 0), kernel-defined table (= 0) and spec-defined versioned table (> 0), it might also be useful to store the version with the table info in drm_i915_mocs_table and then have intel_mocs_table_version call get_mocs_settings(), e.g:

int intel_mocs_table_version(struct drm_i915_private *i915)

{
	struct drm_i915_mocs_table table;

	if (!get_mocs_settings(i915, &table))
		return -ENODEV;

	return table->version;
}

Thanks,
Daniele

Quoted 32 lines
drivers/gpu/drm/i915/intel_mocs.c +5 -0
+	else
+		return 0;
+}
+
+/**
   * intel_mocs_init_engine() - emit the mocs control table
   * @engine:	The engine for whom to emit the registers.
   *
drivers/gpu/drm/i915/intel_mocs.h +1 -0
index d89080d..dc1d64a 100644
@@ -55,5 +55,6 @@
  int intel_rcs_context_init_mocs(struct i915_request *rq);
  void intel_mocs_init_l3cc_table(struct drm_i915_private *dev_priv);
  void intel_mocs_init_engine(struct intel_engine_cs *engine);
+int intel_mocs_table_version(struct drm_i915_private *i915);
 
  #endif
include/uapi/drm/i915_drm.h +4 -0
index 298b2e1..16aafc4 100644
@@ -559,6 +559,17 @@ typedef struct drm_i915_irq_wait {
   */
  #define I915_PARAM_MMAP_GTT_COHERENT	52
 
+/*
+ * Query MOCS table version used during hardware initialization.
+ *
+ * The MOCS table for each platform is published as part of bspec. Entries in

include/uapi/drm/i915_drm.h typedef struct drm_i915_irq_wait { · line 575

Quoted 10 lines
include/uapi/drm/i915_drm.h +7 -0
+ * the table are supposed to never be modified, but new enties are added, making
+ * more indexes in the table valid. This parameter informs which version
+ * of the table was used to initialize the currently used graphics hardware,
+ * and therefore which MOCS indexes are useable.
+ */
+#define I915_PARAM_MOCS_TABLE_VERSION	53
+
  typedef struct drm_i915_getparam {
  	__s32 param;
  	/*

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw

Re: [PATCH v2 2/2] drm/i915/icl: Add IOCTL for getting MOCS table version

Quoted 79 lines · Daniele Ceraolo Spurio
Quoted 37 lines · Tomasz Lis

For Icelake and above, MOCS table for each platform is published within bspec. The table is versioned, and new entries are assigned a version number. Existing entries do not change and their version is constant.

This introduces a parameter which allows getting max version number of the MOCS entries currently supported, ie. value of 2 would mean only version 1 and version 2 entries are initialized and can be used by the user mode clients.

BSpec: 34007

Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Zhenyu Wang <[email protected]>
Cc Zhi A Wang <[email protected]>
Cc Anuj Phogat <[email protected]>

---
  drivers/gpu/drm/i915/i915_drv.c   |  6 ++++++ drivers/gpu/drm/i915/intel_mocs.c | 12 ++++++++++++ drivers/gpu/drm/i915/intel_mocs.h |  1 + include/uapi/drm/i915_drm.h       | 11 +++++++++++

  4 files changed, 30 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +1 -0
index baac35f..92fa8fd 100644
@@ -53,6 +53,7 @@
   #include "i915_vgpu.h"
   #include "intel_drv.h"
   #include "intel_uc.h"
+#include "intel_mocs.h"
     static struct drm_driver driver;
   @@ -444,6 +445,11 @@ static int i915_getparam_ioctl(struct drm_device *dev, void *data,
Quoted 7 lines

      case I915_PARAM_MMAP_GTT_COHERENT:
          value = INTEL_INFO(dev_priv)->has_coherent_ggtt; break;
+    case I915_PARAM_MOCS_TABLE_VERSION:
+        value = intel_mocs_table_version(dev_priv); +        if (!value)
+            return -ENODEV;

Do we really want to return -ENODEV for platforms that do have a MOCS table programmed, but the table is not one versioned in the specs (i.e. Gen9-10)? I think returning "0" for those to indicate "kernel-defined table" would be ok and we could limit -ENODEV for platforms that don't have a table at all. But what wins is what the callers of the ioctl would like to get from the kernel ;)

Quoted 16 lines

+        break;
      default:
          DRM_DEBUG("Unknown parameter %d\n", param->param); return -EINVAL;

drivers/gpu/drm/i915/intel_mocs.c +1 -0
index dc34e83..fc1e98b 100644
@@ -469,6 +469,18 @@ static i915_reg_t mocs_register(enum 
 intel_engine_id engine_id, int index)
   }
     /**
+ * intel_mocs_table_version() - get version of mocs table 

implementation
+ * @i915: i915 device struct.
+ */

drivers/gpu/drm/i915/intel_mocs.c static i915_reg_t mocs_register(enum intel_engine_id engine_id, int index) · line 478

Quoted 4 lines
drivers/gpu/drm/i915/intel_mocs.c +4 -0
+int intel_mocs_table_version(struct drm_i915_private *i915)
+{
+    if (IS_ICELAKE(i915))
+        return 1;

Can we add this version value as a define above the table, to keep them close to each other?

If we agree on my suggestion above to differentiate between no table at all (< 0), kernel-defined table (= 0) and spec-defined versioned table (> 0), it might also be useful to store the version with the table info in drm_i915_mocs_table and then have intel_mocs_table_version call get_mocs_settings(), e.g:

int intel_mocs_table_version(struct drm_i915_private *i915) {
    struct drm_i915_mocs_table table;

Quoted 8 lines

    if (!get_mocs_settings(i915, &table))
        return -ENODEV;

    return table->version;
}

Thanks,
Daniele

That does sound reasonable. And I agree we should really ask userland what exactly they want.
Right now there is no request from any UMD for such interface; we will get back to this patch when it is requested.
Joonas also mentioned there is no need for an interface which always returns "1", and is expected to return only that value for future platforms as well. That's a good argument.

I will remove this patch from the current series.

-Tomasz

Quoted 37 lines
Quoted 37 lines

+    else
+        return 0;

drivers/gpu/drm/i915/intel_mocs.c +3 -0
+}
+
+/**

   * intel_mocs_init_engine() - emit the mocs control table
   * @engine:    The engine for whom to emit the registers. *

drivers/gpu/drm/i915/intel_mocs.h +1 -0
index d89080d..dc1d64a 100644
@@ -55,5 +55,6 @@
   int intel_rcs_context_init_mocs(struct i915_request *rq);
   void intel_mocs_init_l3cc_table(struct drm_i915_private *dev_priv);
   void intel_mocs_init_engine(struct intel_engine_cs *engine);
+int intel_mocs_table_version(struct drm_i915_private *i915);
     #endif
include/uapi/drm/i915_drm.h +0 -0
index 298b2e1..16aafc4 100644
@@ -559,6 +559,17 @@ typedef struct drm_i915_irq_wait {
    */
   #define I915_PARAM_MMAP_GTT_COHERENT    52

  +/*
+ * Query MOCS table version used during hardware initialization.
+ *
+ * The MOCS table for each platform is published as part of bspec. Entries in
+ * the table are supposed to never be modified, but new enties are added, making
+ * more indexes in the table valid. This parameter informs which version
+ * of the table was used to initialize the currently used graphics hardware,

Quoted 8 lines
Quoted 8 lines

+ * and therefore which MOCS indexes are useable.
+ */

include/uapi/drm/i915_drm.h +2 -0
+#define I915_PARAM_MOCS_TABLE_VERSION    53
+

  typedef struct drm_i915_getparam {
      __s32 param;
      /*

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer
#9 lore raw

Re: [PATCH v2 2/2] drm/i915/icl: Add IOCTL for getting MOCS table version

In reply to Tomasz Lis

Quoting Tomasz Lis (2018-10-22 20:13:15)

Quoted 11 lines

For Icelake and above, MOCS table for each platform is published within bspec. The table is versioned, and new entries are assigned a version number. Existing entries do not change and their version is constant.

This introduces a parameter which allows getting max version number of the MOCS entries currently supported, ie. value of 2 would mean only version 1 and version 2 entries are initialized and can be used by the user mode clients.

BSpec: 34007

Quoted 8 lines
Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Zhenyu Wang <[email protected]>
Cc Zhi A Wang <[email protected]>
Cc Anuj Phogat <[email protected]>

As a heads-up, as this adds to the uAPI, this needs Acked-by from the respective userspace that will use the information, a link to the userspace change series and IGT test series all linked from the patch text.

But as we're hoping to stay at version 1, I also would see that we only need to add this IOCTL if we get a version 2 of the tables. So there should be no need for this interface before we have some variance.

Regards, Joonas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v2 1/2
#10 lore raw
In reply to Tomasz Lis
Quoted 39 lines · Tomasz Lis

The table has been unified across OSes to minimize virtualization overhead.

The MOCS table is now published as part of bspec, and versioned. Entries are supposed to never be modified, but new ones can be added. Adding entries increases table version. The patch includes version 1 entries.

Meaning of each entry is now explained in bspec, and user mode clients are expected to know what each entry means. The 3 entries used for previous platforms are still compatible with their legacy definitions, but that is not guaranteed to be true for future platforms.

BSpec: 34007
BSpec: 560

Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Zhenyu Wang <[email protected]>
Cc Zhi A Wang <[email protected]>
Cc Anuj Phogat <[email protected]>
---
  drivers/gpu/drm/i915/intel_mocs.c | 246 +++++++++++++++++++++++++++++++++++++-
  1 file changed, 244 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_mocs.c +2 -0
index 77e9871..dc34e83 100644
@@ -44,6 +44,8 @@ struct drm_i915_mocs_table {
  #define LE_SCC(value)		((value) << 8)
  #define LE_PFM(value)		((value) << 11)
  #define LE_SCF(value)		((value) << 14)
+#define LE_CoS(value)		((value) << 15)
+#define LE_SSE(value)		((value) << 17)
 
  /* Defines for the tables (LNCFMOCS0 - LNCFMOCS31) - two entries per word */
  #define L3_ESC(value)		((value) << 0)

drivers/gpu/drm/i915/intel_mocs.c struct drm_i915_mocs_table { · line 100

Quoted 3 lines
drivers/gpu/drm/i915/intel_mocs.c +0 -0
@@ -96,6 +98,243 @@ struct drm_i915_mocs_table {
   *       may only be updated incrementally by adding entries at the
   *       end.
   */

This comment needs to be updated as some of the expectations are not true anymore, e.g. we're now defining entries 62 and 63 in SW, usage of mocs 0 is changing. Also could be useful to add some of the info you have in the commit message here, like the fact that the table is versioned in the specs for gen11+, so it is close to the table.

From a POV of following the specs, with the updated comments this is:

But please get acks from the relevant interested parties to make sure there are no concerns with the new approach. Also having someone else double-check the table as well would be nice since I might have missed something and it's going to be hard to catch issues in testing if the only impact is a very small performance delta.

Thanks,
Daniele

Quoted 245 lines
drivers/gpu/drm/i915/intel_mocs.c +237 -0
+static const struct drm_i915_mocs_entry icelake_mocs_table[] = {
+	[0] = {
+	  /* Base - Uncached (Deprecated) */
+	  .control_value = LE_CACHEABILITY(LE_UC) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[1] = {
+	  /* Base - L3 + LeCC:PAT (Deprecated) */
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[2] = {
+	  /* Base - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[3] = {
+	  /* Base - Uncached */
+	  .control_value = LE_CACHEABILITY(LE_UC) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[4] = {
+	  /* Base - L3 */
+	  .control_value = LE_CACHEABILITY(LE_UC) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[5] = {
+	  /* Base - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[6] = {
+	  /* Age 0 - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[7] = {
+	  /* Age 0 - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[8] = {
+	  /* Age: Don't Chg. - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[9] = {
+	  /* Age: Don't Chg. - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[10] = {
+	  /* No AOM - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[11] = {
+	  /* No AOM - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[12] = {
+	  /* No AOM; Age 0 - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[13] = {
+	  /* No AOM; Age 0 - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[14] = {
+	  /* No AOM; Age:DC - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[15] = {
+	  /* No AOM; Age:DC - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[16] = {
+	  /* Reserved - For future use */
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+			   LE_TGT_CACHE(LE_TC_PAGETABLE) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_DIRECT),
+	},
+	[17] = {
+	  /* Reserved - For future use */
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+			   LE_TGT_CACHE(LE_TC_PAGETABLE) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_DIRECT),
+	},
+	[18] = {
+	  /* Self-Snoop - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(3),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[19] = {
+	  /* Skip Caching - L3 + LLC(12.5%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(7) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[20] = {
+	  /* Skip Caching - L3 + LLC(25%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(3) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[21] = {
+	  /* Skip Caching - L3 + LLC(50%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(1) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[22] = {
+	  /* Skip Caching - L3 + LLC(75%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(1) | LE_SCC(3) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[23] = {
+	  /* Skip Caching - L3 + LLC(87.5%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(1) | LE_SCC(7) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[62] = {
+	  /* HW Reserved - SW program but never use */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[63] = {
+	  /* HW Reserved - SW program but never use */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+};
+
  static const struct drm_i915_mocs_entry skylake_mocs_table[] = {
  	[I915_MOCS_UNCACHED] = {
  	  /* 0x00000009 */
@@ -178,8 +417,11 @@ static bool get_mocs_settings(struct drm_i915_private *dev_priv,
  {
  	bool result = false;
 

drivers/gpu/drm/i915/intel_mocs.c static bool get_mocs_settings(struct drm_i915_private *dev_priv, · line 427

Quoted 10 lines
drivers/gpu/drm/i915/intel_mocs.c +5 -2
-	if (IS_GEN9_BC(dev_priv) || IS_CANNONLAKE(dev_priv) ||
-	    IS_ICELAKE(dev_priv)) {
+	if (IS_ICELAKE(dev_priv)) {
+		table->size  = ARRAY_SIZE(icelake_mocs_table);
+		table->table = icelake_mocs_table;
+		result = true;
+	} else if (IS_GEN9_BC(dev_priv) || IS_CANNONLAKE(dev_priv)) {
  		table->size  = ARRAY_SIZE(skylake_mocs_table);
  		table->table = skylake_mocs_table;
  		result = true;

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#11 lore raw
Quoted 48 lines · Daniele Ceraolo Spurio
Quoted 39 lines · Tomasz Lis

The table has been unified across OSes to minimize virtualization overhead.

The MOCS table is now published as part of bspec, and versioned. Entries are supposed to never be modified, but new ones can be added. Adding entries increases table version. The patch includes version 1 entries.

Meaning of each entry is now explained in bspec, and user mode clients are expected to know what each entry means. The 3 entries used for previous platforms are still compatible with their legacy definitions, but that is not guaranteed to be true for future platforms.

BSpec: 34007
BSpec: 560

Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Zhenyu Wang <[email protected]>
Cc Zhi A Wang <[email protected]>
Cc Anuj Phogat <[email protected]>

---
  drivers/gpu/drm/i915/intel_mocs.c | 246
+++++++++++++++++++++++++++++++++++++-

  1 file changed, 244 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_mocs.c +2 -0
index 77e9871..dc34e83 100644
@@ -44,6 +44,8 @@ struct drm_i915_mocs_table {
   #define LE_SCC(value)        ((value) << 8)
   #define LE_PFM(value)        ((value) << 11)
   #define LE_SCF(value)        ((value) << 14)
+#define LE_CoS(value)        ((value) << 15)
+#define LE_SSE(value)        ((value) << 17)
     /* Defines for the tables (LNCFMOCS0 - LNCFMOCS31) - two entries per word */
   #define L3_ESC(value)        ((value) << 0)

drivers/gpu/drm/i915/intel_mocs.c struct drm_i915_mocs_table { · line 100

Quoted 3 lines
drivers/gpu/drm/i915/intel_mocs.c +0 -0
@@ -96,6 +98,243 @@ struct drm_i915_mocs_table {
    *       may only be updated incrementally by adding entries at the
    *       end.
    */

This comment needs to be updated as some of the expectations are not true anymore, e.g. we're now defining entries 62 and 63 in SW, usage of mocs 0 is changing. Also could be useful to add some of the info you have in the commit message here, like the fact that the table is versioned in the specs for gen11+, so it is close to the table.

Quoted 5 lines

From a POV of following the specs, with the updated comments this is:

But please get acks from the relevant interested parties to make sure there are no concerns with the new approach.

I believe all parties are informed; will add some more cc's to v3.

Quoted 4 lines

Also having someone else double-check the table as well would be nice since I might have missed something and it's going to be hard to catch issues in testing if the only impact is a very small performance delta.

Thanks,
Daniele

The IGT test for MOCS settings compares explicitly content of the registers with expected values hard-coded into that test; since someone else than me will be updating that test for correct Icelake values, we can count that as second verification. -Tomasz

Quoted 250 lines
Quoted 250 lines
drivers/gpu/drm/i915/intel_mocs.c +237 -0
+static const struct drm_i915_mocs_entry icelake_mocs_table[] = {
+    [0] = {
+      /* Base - Uncached (Deprecated) */
+      .control_value = LE_CACHEABILITY(LE_UC) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+    },
+    [1] = {
+      /* Base - L3 + LeCC:PAT (Deprecated) */
+      .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+    },
+    [2] = {
+      /* Base - L3 + LLC */
+      .control_value = LE_CACHEABILITY(LE_WB) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+    },
+    [3] = {
+      /* Base - Uncached */
+      .control_value = LE_CACHEABILITY(LE_UC) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+    },
+    [4] = {
+      /* Base - L3 */
+      .control_value = LE_CACHEABILITY(LE_UC) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+    },
+    [5] = {
+      /* Base - LLC */
+      .control_value = LE_CACHEABILITY(LE_WB) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+    },
+    [6] = {
+      /* Age 0 - LLC */
+      .control_value = LE_CACHEABILITY(LE_WB) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(1) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+    },
+    [7] = {
+      /* Age 0 - L3 + LLC */
+      .control_value = LE_CACHEABILITY(LE_WB) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(1) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+    },
+    [8] = {
+      /* Age: Don't Chg. - LLC */
+      .control_value = LE_CACHEABILITY(LE_WB) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(2) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+    },
+    [9] = {
+      /* Age: Don't Chg. - L3 + LLC */
+      .control_value = LE_CACHEABILITY(LE_WB) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(2) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+    },
+    [10] = {
+      /* No AOM - LLC */
+      .control_value = LE_CACHEABILITY(LE_WB) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(3) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+    },
+    [11] = {
+      /* No AOM - L3 + LLC */
+      .control_value = LE_CACHEABILITY(LE_WB) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(3) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+    },
+    [12] = {
+      /* No AOM; Age 0 - LLC */
+      .control_value = LE_CACHEABILITY(LE_WB) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(1) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+    },
+    [13] = {
+      /* No AOM; Age 0 - L3 + LLC */
+      .control_value = LE_CACHEABILITY(LE_WB) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(1) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+    },
+    [14] = {
+      /* No AOM; Age:DC - LLC */
+      .control_value = LE_CACHEABILITY(LE_WB) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(2) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+    },
+    [15] = {
+      /* No AOM; Age:DC - L3 + LLC */
+      .control_value = LE_CACHEABILITY(LE_WB) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(2) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+    },
+    [16] = {
+      /* Reserved - For future use */
+      .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+               LE_TGT_CACHE(LE_TC_PAGETABLE) |
+               LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | 
 L3_CACHEABILITY(L3_DIRECT),
+    },
+    [17] = {
+      /* Reserved - For future use */
+      .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+               LE_TGT_CACHE(LE_TC_PAGETABLE) |
+               LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | 
 L3_CACHEABILITY(L3_DIRECT),
+    },
+    [18] = {
+      /* Self-Snoop - L3 + LLC */
+      .control_value = LE_CACHEABILITY(LE_WB) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(3),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+    },
+    [19] = {
+      /* Skip Caching - L3 + LLC(12.5%) */
+      .control_value = LE_CACHEABILITY(LE_WB) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(7) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+    },
+    [20] = {
+      /* Skip Caching - L3 + LLC(25%) */
+      .control_value = LE_CACHEABILITY(LE_WB) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(3) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+    },
+    [21] = {
+      /* Skip Caching - L3 + LLC(50%) */
+      .control_value = LE_CACHEABILITY(LE_WB) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(1) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+    },
+    [22] = {
+      /* Skip Caching - L3 + LLC(75%) */
+      .control_value = LE_CACHEABILITY(LE_WB) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(3) | LE_AOM(0) | LE_RSC(1) | LE_SCC(3) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+    },
+    [23] = {
+      /* Skip Caching - L3 + LLC(87.5%) */
+      .control_value = LE_CACHEABILITY(LE_WB) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(3) | LE_AOM(0) | LE_RSC(1) | LE_SCC(7) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+    },
+    [62] = {
+      /* HW Reserved - SW program but never use */
+      .control_value = LE_CACHEABILITY(LE_WB) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+    },
+    [63] = {
+      /* HW Reserved - SW program but never use */
+      .control_value = LE_CACHEABILITY(LE_WB) |
+               LE_TGT_CACHE(LE_TC_LLC) |
+               LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+               LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+      .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+    },
+};
+
   static const struct drm_i915_mocs_entry skylake_mocs_table[] = {

      [I915_MOCS_UNCACHED] = {
        /* 0x00000009 */

drivers/gpu/drm/i915/intel_mocs.c +0 -0
@@ -178,8 +417,11 @@ static bool get_mocs_settings(struct 
 drm_i915_private *dev_priv,
   {
       bool result = false;

  -    if (IS_GEN9_BC(dev_priv) || IS_CANNONLAKE(dev_priv) || -        IS_ICELAKE(dev_priv)) {
+    if (IS_ICELAKE(dev_priv)) {

Quoted 8 lines
Quoted 8 lines

+        table->size  = ARRAY_SIZE(icelake_mocs_table); +        table->table = icelake_mocs_table;
+        result = true;
+    } else if (IS_GEN9_BC(dev_priv) || IS_CANNONLAKE(dev_priv)) { table->size  = ARRAY_SIZE(skylake_mocs_table); table->table = skylake_mocs_table;
          result = true;

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author
#12 lore raw

PATCH v3 1/1 drm/i915/icl: Define MOCS table for Icelake

In reply to Tomasz Lis

The table has been unified across OSes to minimize virtualization overhead.

The MOCS table is now published as part of bspec, and versioned. Entries are supposed to never be modified, but new ones can be added. Adding entries increases table version. The patch includes version 1 entries.

Meaning of each entry is now explained in bspec, and user mode clients are expected to know what each entry means. The 3 entries used for previous platforms are still compatible with their legacy definitions, but that is not guaranteed to be true for future platforms.

v2: Fixed SCC values, improved commit comment (Daniele)
v3: Improved MOCS table comment (Daniele)

BSpec: 34007
BSpec: 560

Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Zhenyu Wang <[email protected]>
Cc Zhi A Wang <[email protected]>
Cc Anuj Phogat <[email protected]>
Cc Adam Cetnerowski <[email protected]>
Cc Piotr Rozenfeld <[email protected]>
---
 drivers/gpu/drm/i915/intel_mocs.c | 270 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 256 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/intel_mocs.c +256 -14
index 77e9871..b7f96cb 100644
@@ -44,6 +44,8 @@ struct drm_i915_mocs_table {
 #define LE_SCC(value)		((value) << 8)
 #define LE_PFM(value)		((value) << 11)
 #define LE_SCF(value)		((value) << 14)
+#define LE_CoS(value)		((value) << 15)
+#define LE_SSE(value)		((value) << 17)
 
 /* Defines for the tables (LNCFMOCS0 - LNCFMOCS31) - two entries per word */
 #define L3_ESC(value)		((value) << 0)
@@ -80,22 +82,259 @@ struct drm_i915_mocs_table {
  * LNCFCMOCS0 - LNCFCMOCS32 registers.
  *
  * These tables are intended to be kept reasonably consistent across
- * platforms. However some of the fields are not applicable to all of
- * them.
+ * HW platforms, and for ICL+, be identical across OSes. To achieve
+ * that, for Icelake and above, list of entries is published as part
+ * of bspec.
  *
  * Entries not part of the following tables are undefined as far as
- * userspace is concerned and shouldn't be relied upon.  For the time
- * being they will be implicitly initialized to the strictest caching
- * configuration (uncached) to guarantee forwards compatibility with
- * userspace programs written against more recent kernels providing
- * additional MOCS entries.
+ * userspace is concerned and shouldn't be relied upon.
  *
- * NOTE: These tables MUST start with being uncached and the length
- *       MUST be less than 63 as the last two registers are reserved
- *       by the hardware.  These tables are part of the kernel ABI and
- *       may only be updated incrementally by adding entries at the
- *       end.
+ * The last two entries are reserved by the hardware. For ICL+ they
+ * should be initialized according to bspec and never used, for older
+ * platforms they should never be written to.
+ *
+ * NOTE: These tables are part of bspec and defined as part of hardware
+ *       interface for ICL+. For older platforms, they are part of kernel
+ *       ABI. It is expected that existing entries will remain constant
+ *       and the tables will only be updated by adding new entries.
  */
+static const struct drm_i915_mocs_entry icelake_mocs_table[] = {
+	[0] = {
+	  /* Base - Uncached (Deprecated) */
+	  .control_value = LE_CACHEABILITY(LE_UC) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[1] = {
+	  /* Base - L3 + LeCC:PAT (Deprecated) */
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[2] = {
+	  /* Base - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[3] = {
+	  /* Base - Uncached */
+	  .control_value = LE_CACHEABILITY(LE_UC) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[4] = {
+	  /* Base - L3 */
+	  .control_value = LE_CACHEABILITY(LE_UC) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[5] = {
+	  /* Base - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[6] = {
+	  /* Age 0 - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[7] = {
+	  /* Age 0 - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[8] = {
+	  /* Age: Don't Chg. - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[9] = {
+	  /* Age: Don't Chg. - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[10] = {
+	  /* No AOM - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[11] = {
+	  /* No AOM - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[12] = {
+	  /* No AOM; Age 0 - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[13] = {
+	  /* No AOM; Age 0 - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[14] = {
+	  /* No AOM; Age:DC - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[15] = {
+	  /* No AOM; Age:DC - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[16] = {
+	  /* Reserved - For future use */
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+			   LE_TGT_CACHE(LE_TC_PAGETABLE) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_DIRECT),
+	},
+	[17] = {
+	  /* Reserved - For future use */
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+			   LE_TGT_CACHE(LE_TC_PAGETABLE) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_DIRECT),
+	},
+	[18] = {
+	  /* Self-Snoop - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(3),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[19] = {
+	  /* Skip Caching - L3 + LLC(12.5%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(7) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[20] = {
+	  /* Skip Caching - L3 + LLC(25%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(3) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[21] = {
+	  /* Skip Caching - L3 + LLC(50%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(1) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[22] = {
+	  /* Skip Caching - L3 + LLC(75%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(1) | LE_SCC(3) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[23] = {
+	  /* Skip Caching - L3 + LLC(87.5%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(1) | LE_SCC(7) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[62] = {
+	  /* HW Reserved - SW program but never use */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[63] = {
+	  /* HW Reserved - SW program but never use */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+};
+
 static const struct drm_i915_mocs_entry skylake_mocs_table[] = {
 	[I915_MOCS_UNCACHED] = {
 	  /* 0x00000009 */
@@ -178,8 +417,11 @@ static bool get_mocs_settings(struct drm_i915_private *dev_priv,
 {
 	bool result = false;
 
-	if (IS_GEN9_BC(dev_priv) || IS_CANNONLAKE(dev_priv) ||
-	    IS_ICELAKE(dev_priv)) {
+	if (IS_ICELAKE(dev_priv)) {
+		table->size  = ARRAY_SIZE(icelake_mocs_table);
+		table->table = icelake_mocs_table;
+		result = true;
+	} else if (IS_GEN9_BC(dev_priv) || IS_CANNONLAKE(dev_priv)) {
 		table->size  = ARRAY_SIZE(skylake_mocs_table);
 		table->table = skylake_mocs_table;
 		result = true;
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#13 lore raw

✗ Fi.CI.BAT: failure for drm/i915/icl: Define MOCS table for Icelake (rev4)

In reply to Tomasz Lis
== Series Details ==

== Series Details ==

Series: drm/i915/icl: Define MOCS table for Icelake (rev4)
URL : https://patchwork.freedesktop.org/series/51258/
State : failure

== Summary ==

= CI Bug Log - changes from CI_DRM_5020 -> Patchwork_10544 =

== Summary - FAILURE ==

Serious unknown changes coming with Patchwork_10544 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_10544, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/51258/revisions/4/mbox/

== Possible new issues ==

Here are the unknown changes that may have been introduced in Patchwork_10544:

=== IGT changes ===

    ==== Possible regressions ====

    igt@pm_rpm@module-reload:
      fi-apl-guc:         PASS -> DMESG-WARN +4

    
    ==== Warnings ====

    igt@pm_rpm@basic-pci-d3-state:
      fi-apl-guc:         PASS -> SKIP +4

== Known issues ==

Here are the changes found in Patchwork_10544 that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@drv_selftest@live_hangcheck:
      fi-kbl-7560u:       PASS -> INCOMPLETE (fdo#108044)

    igt@kms_flip@basic-flip-vs-modeset:
      fi-skl-6700hq:      PASS -> DMESG-WARN (fdo#105998)

    
    ==== Possible fixes ====

    igt@kms_frontbuffer_tracking@basic:
      fi-hsw-peppy:       DMESG-WARN (fdo#102614) -> PASS

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-byt-clapper:     FAIL (fdo#107362, fdo#103191) -> PASS +1

    igt@prime_vgem@basic-fence-flip:
      fi-cfl-8700k:       FAIL (fdo#104008) -> PASS

fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008
fdo#105998 https://bugs.freedesktop.org/show_bug.cgi?id=105998
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
fdo#108044 https://bugs.freedesktop.org/show_bug.cgi?id=108044

== Participating hosts (47 -> 43) ==

Additional (1): fi-cfl-8109u
Missing (5): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600

== Build changes ==

* Linux: CI_DRM_5020 -> Patchwork_10544

CI_DRM_5020: 95151c25e0433a2fe771b8bc272f3f8fb54a7e27 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4686: 741bf7064c467df725c14cc0b3b8b50436f9ee09 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10544: e4898ee712c0087f302391891e6ad493718ae1ae @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

e4898ee712c0 drm/i915/icl: Define MOCS table for Icelake

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10544/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author
#14 lore raw

PATCH v4 1/2 drm/i915/skl: Rework MOCS tables to keep common part in a define

In reply to Tomasz Lis

The MOCS tables are going to be very similar across platforms.

To reduce the amount of copied code, this patch rips the common part and puts it into a definition valid for all gen9 platforms.

Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Lucas De Marchi <[email protected]>
---
 drivers/gpu/drm/i915/intel_mocs.c | 61 ++++++++++++++-------------------------
 1 file changed, 22 insertions(+), 39 deletions(-)
drivers/gpu/drm/i915/intel_mocs.c +22 -39
index 77e9871..76aed59 100644
@@ -96,26 +96,29 @@ struct drm_i915_mocs_table {
  *       may only be updated incrementally by adding entries at the
  *       end.
  */
-static const struct drm_i915_mocs_entry skylake_mocs_table[] = {
-	[I915_MOCS_UNCACHED] = {
-	  /* 0x00000009 */
-	  .control_value = LE_CACHEABILITY(LE_UC) |
-			   LE_TGT_CACHE(LE_TC_LLC_ELLC) |
-			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
-			   LE_PFM(0) | LE_SCF(0),
 
-	  /* 0x0010 */
-	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
-	},
-	[I915_MOCS_PTE] = {
-	  /* 0x00000038 */
-	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
-			   LE_TGT_CACHE(LE_TC_LLC_ELLC) |
-			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
-			   LE_PFM(0) | LE_SCF(0),
-	  /* 0x0030 */
-	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+#define GEN9_MOCS_TABLE \
+	[I915_MOCS_UNCACHED] = { \
+	  /* 0x00000009 */ \
+	  .control_value = LE_CACHEABILITY(LE_UC) | \
+			   LE_TGT_CACHE(LE_TC_LLC_ELLC) | \
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0), \
+	  /* 0x0010 */ \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC), \
+	}, \
+	[I915_MOCS_PTE] = { \
+	  /* 0x00000038 */ \
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) | \
+			   LE_TGT_CACHE(LE_TC_LLC_ELLC) | \
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0), \
+	  /* 0x0030 */ \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB), \
 	},
+
+static const struct drm_i915_mocs_entry skylake_mocs_table[] = {
+	GEN9_MOCS_TABLE
 	[I915_MOCS_CACHED] = {
 	  /* 0x0000003b */
 	  .control_value = LE_CACHEABILITY(LE_WB) |
@@ -129,33 +132,13 @@ static const struct drm_i915_mocs_entry skylake_mocs_table[] = {
 
 /* NOTE: the LE_TGT_CACHE is not used on Broxton */
 static const struct drm_i915_mocs_entry broxton_mocs_table[] = {
-	[I915_MOCS_UNCACHED] = {
-	  /* 0x00000009 */
-	  .control_value = LE_CACHEABILITY(LE_UC) |
-			   LE_TGT_CACHE(LE_TC_LLC_ELLC) |
-			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
-			   LE_PFM(0) | LE_SCF(0),
-
-	  /* 0x0010 */
-	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
-	},
-	[I915_MOCS_PTE] = {
-	  /* 0x00000038 */
-	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
-			   LE_TGT_CACHE(LE_TC_LLC_ELLC) |
-			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
-			   LE_PFM(0) | LE_SCF(0),
-
-	  /* 0x0030 */
-	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
-	},
+	GEN9_MOCS_TABLE
 	[I915_MOCS_CACHED] = {
 	  /* 0x00000039 */
 	  .control_value = LE_CACHEABILITY(LE_UC) |
 			   LE_TGT_CACHE(LE_TC_LLC_ELLC) |
 			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
 			   LE_PFM(0) | LE_SCF(0),
-
 	  /* 0x0030 */
 	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
 	},
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#15 lore raw

PATCH v4 2/2 drm/i915/icl: Define MOCS table for Icelake

The table has been unified across OSes to minimize virtualization overhead.

The MOCS table is now published as part of bspec, and versioned. Entries are supposed to never be modified, but new ones can be added. Adding entries increases table version. The patch includes version 1 entries.

Meaning of each entry is now explained in bspec, and user mode clients are expected to know what each entry means. The 3 entries used for previous platforms are still compatible with their legacy definitions, but that is not guaranteed to be true for future platforms.

v2: Fixed SCC values, improved commit comment (Daniele)
v3: Improved MOCS table comment (Daniele)
v4: Moved new entries below gen9 ones. Put common entries into
definition to be used in multiple arrays. (Lucas)

BSpec: 34007
BSpec: 560

Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Zhenyu Wang <[email protected]>
Cc Zhi A Wang <[email protected]>
Cc Anuj Phogat <[email protected]>
Cc Adam Cetnerowski <[email protected]>
Cc Piotr Rozenfeld <[email protected]>
Cc Lucas De Marchi <[email protected]>
---
 drivers/gpu/drm/i915/intel_mocs.c | 249 +++++++++++++++++++++++++++++++++++---
 1 file changed, 235 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/intel_mocs.c +235 -14
index 76aed59..2a1e5f0 100644
@@ -44,6 +44,8 @@ struct drm_i915_mocs_table {
 #define LE_SCC(value)		((value) << 8)
 #define LE_PFM(value)		((value) << 11)
 #define LE_SCF(value)		((value) << 14)
+#define LE_CoS(value)		((value) << 15)
+#define LE_SSE(value)		((value) << 17)
 
 /* Defines for the tables (LNCFMOCS0 - LNCFMOCS31) - two entries per word */
 #define L3_ESC(value)		((value) << 0)
@@ -80,21 +82,21 @@ struct drm_i915_mocs_table {
  * LNCFCMOCS0 - LNCFCMOCS32 registers.
  *
  * These tables are intended to be kept reasonably consistent across
- * platforms. However some of the fields are not applicable to all of
- * them.
+ * HW platforms, and for ICL+, be identical across OSes. To achieve
+ * that, for Icelake and above, list of entries is published as part
+ * of bspec.
  *
  * Entries not part of the following tables are undefined as far as
- * userspace is concerned and shouldn't be relied upon.  For the time
- * being they will be implicitly initialized to the strictest caching
- * configuration (uncached) to guarantee forwards compatibility with
- * userspace programs written against more recent kernels providing
- * additional MOCS entries.
+ * userspace is concerned and shouldn't be relied upon.
  *
- * NOTE: These tables MUST start with being uncached and the length
- *       MUST be less than 63 as the last two registers are reserved
- *       by the hardware.  These tables are part of the kernel ABI and
- *       may only be updated incrementally by adding entries at the
- *       end.
+ * The last two entries are reserved by the hardware. For ICL+ they
+ * should be initialized according to bspec and never used, for older
+ * platforms they should never be written to.
+ *
+ * NOTE: These tables are part of bspec and defined as part of hardware
+ *       interface for ICL+. For older platforms, they are part of kernel
+ *       ABI. It is expected that existing entries will remain constant
+ *       and the tables will only be updated by adding new entries.
  */
 
 #define GEN9_MOCS_TABLE \
@@ -144,6 +146,222 @@ static const struct drm_i915_mocs_entry broxton_mocs_table[] = {
 	},
 };
 
+#define GEN11_MOCS_TABLE \
+	[0] = { \
+	  /* Base - Uncached (Deprecated) */ \
+	  .control_value = LE_CACHEABILITY(LE_UC) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC), \
+	}, \
+	[1] = { \
+	  /* Base - L3 + LeCC:PAT (Deprecated) */ \
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB), \
+	}, \
+	[2] = { \
+	  /* Base - L3 + LLC */ \
+	  .control_value = LE_CACHEABILITY(LE_WB) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB), \
+	}, \
+	[3] = { \
+	  /* Base - Uncached */ \
+	  .control_value = LE_CACHEABILITY(LE_UC) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC), \
+	}, \
+	[4] = { \
+	  /* Base - L3 */ \
+	  .control_value = LE_CACHEABILITY(LE_UC) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB), \
+	}, \
+	[5] = { \
+	  /* Base - LLC */ \
+	  .control_value = LE_CACHEABILITY(LE_WB) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC), \
+	}, \
+	[6] = { \
+	  /* Age 0 - LLC */ \
+	  .control_value = LE_CACHEABILITY(LE_WB) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(1) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC), \
+	}, \
+	[7] = { \
+	  /* Age 0 - L3 + LLC */ \
+	  .control_value = LE_CACHEABILITY(LE_WB) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(1) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB), \
+	}, \
+	[8] = { \
+	  /* Age: Don't Chg. - LLC */ \
+	  .control_value = LE_CACHEABILITY(LE_WB) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(2) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC), \
+	}, \
+	[9] = { \
+	  /* Age: Don't Chg. - L3 + LLC */ \
+	  .control_value = LE_CACHEABILITY(LE_WB) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(2) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB), \
+	}, \
+	[10] = { \
+	  /* No AOM - LLC */ \
+	  .control_value = LE_CACHEABILITY(LE_WB) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(3) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC), \
+	}, \
+	[11] = { \
+	  /* No AOM - L3 + LLC */ \
+	  .control_value = LE_CACHEABILITY(LE_WB) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(3) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB), \
+	}, \
+	[12] = { \
+	  /* No AOM; Age 0 - LLC */ \
+	  .control_value = LE_CACHEABILITY(LE_WB) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(1) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC), \
+	}, \
+	[13] = { \
+	  /* No AOM; Age 0 - L3 + LLC */ \
+	  .control_value = LE_CACHEABILITY(LE_WB) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(1) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB), \
+	}, \
+	[14] = { \
+	  /* No AOM; Age:DC - LLC */ \
+	  .control_value = LE_CACHEABILITY(LE_WB) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(2) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC), \
+	}, \
+	[15] = { \
+	  /* No AOM; Age:DC - L3 + LLC */ \
+	  .control_value = LE_CACHEABILITY(LE_WB) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(2) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB), \
+	}, \
+	[18] = { \
+	  /* Self-Snoop - L3 + LLC */ \
+	  .control_value = LE_CACHEABILITY(LE_WB) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(3), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB), \
+	}, \
+	[19] = { \
+	  /* Skip Caching - L3 + LLC(12.5%) */ \
+	  .control_value = LE_CACHEABILITY(LE_WB) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(7) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB), \
+	}, \
+	[20] = { \
+	  /* Skip Caching - L3 + LLC(25%) */ \
+	  .control_value = LE_CACHEABILITY(LE_WB) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(3) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB), \
+	}, \
+	[21] = { \
+	  /* Skip Caching - L3 + LLC(50%) */ \
+	  .control_value = LE_CACHEABILITY(LE_WB) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(1) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB), \
+	}, \
+	[22] = { \
+	  /* Skip Caching - L3 + LLC(75%) */ \
+	  .control_value = LE_CACHEABILITY(LE_WB) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(1) | LE_SCC(3) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB), \
+	}, \
+	[23] = { \
+	  /* Skip Caching - L3 + LLC(87.5%) */ \
+	  .control_value = LE_CACHEABILITY(LE_WB) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(1) | LE_SCC(7) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB), \
+	}, \
+	[62] = { \
+	  /* HW Reserved - SW program but never use */ \
+	  .control_value = LE_CACHEABILITY(LE_WB) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC), \
+	}, \
+	[63] = { \
+	  /* HW Reserved - SW program but never use */ \
+	  .control_value = LE_CACHEABILITY(LE_WB) | \
+			   LE_TGT_CACHE(LE_TC_LLC) | \
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0), \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC), \
+	},
+
+static const struct drm_i915_mocs_entry icelake_mocs_table[] = {
+	GEN11_MOCS_TABLE
+	[16] = {
+	  /* Reserved - For future use */
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+			   LE_TGT_CACHE(LE_TC_PAGETABLE) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_DIRECT),
+	},
+	[17] = {
+	  /* Reserved - For future use */
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+			   LE_TGT_CACHE(LE_TC_PAGETABLE) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_DIRECT),
+	},
+};
+
 /**
  * get_mocs_settings()
  * @dev_priv:	i915 device.
@@ -161,8 +379,11 @@ static bool get_mocs_settings(struct drm_i915_private *dev_priv,
 {
 	bool result = false;
 
-	if (IS_GEN9_BC(dev_priv) || IS_CANNONLAKE(dev_priv) ||
-	    IS_ICELAKE(dev_priv)) {
+	if (IS_ICELAKE(dev_priv)) {
+		table->size  = ARRAY_SIZE(icelake_mocs_table);
+		table->table = icelake_mocs_table;
+		result = true;
+	} else if (IS_GEN9_BC(dev_priv) || IS_CANNONLAKE(dev_priv)) {
 		table->size  = ARRAY_SIZE(skylake_mocs_table);
 		table->table = skylake_mocs_table;
 		result = true;
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v4 1/2
#16 lore raw

Re: [PATCH v4 1/2] drm/i915/skl: Rework MOCS tables to keep common part in a define

In reply to Tomasz Lis
Quoted 11 lines · Tomasz Lis

The MOCS tables are going to be very similar across platforms.

To reduce the amount of copied code, this patch rips the common part and puts it into a definition valid for all gen9 platforms.

Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Lucas De Marchi <[email protected]>

yeah, this is what I was suggesting.

Not sure if in future this will blow out of proportion - we need to remember that each table is 64 entries of this struct in the ro section. If this happens, then maybe we will need to change the approach and move the idx inside the entry rather than 64-entry arrays. I think this can be left for later if/when there's need.

Right now this improves the status quo IMO.

thanks
Lucas De Marchi

Quoted 94 lines
---
 drivers/gpu/drm/i915/intel_mocs.c | 61 ++++++++++++++-------------------------
 1 file changed, 22 insertions(+), 39 deletions(-)
drivers/gpu/drm/i915/intel_mocs.c +22 -39
index 77e9871..76aed59 100644
@@ -96,26 +96,29 @@ struct drm_i915_mocs_table {
  *       may only be updated incrementally by adding entries at the
  *       end.
  */
-static const struct drm_i915_mocs_entry skylake_mocs_table[] = {
-	[I915_MOCS_UNCACHED] = {
-	  /* 0x00000009 */
-	  .control_value = LE_CACHEABILITY(LE_UC) |
-			   LE_TGT_CACHE(LE_TC_LLC_ELLC) |
-			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
-			   LE_PFM(0) | LE_SCF(0),
 
-	  /* 0x0010 */
-	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
-	},
-	[I915_MOCS_PTE] = {
-	  /* 0x00000038 */
-	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
-			   LE_TGT_CACHE(LE_TC_LLC_ELLC) |
-			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
-			   LE_PFM(0) | LE_SCF(0),
-	  /* 0x0030 */
-	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+#define GEN9_MOCS_TABLE \
+	[I915_MOCS_UNCACHED] = { \
+	  /* 0x00000009 */ \
+	  .control_value = LE_CACHEABILITY(LE_UC) | \
+			   LE_TGT_CACHE(LE_TC_LLC_ELLC) | \
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0), \
+	  /* 0x0010 */ \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC), \
+	}, \
+	[I915_MOCS_PTE] = { \
+	  /* 0x00000038 */ \
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) | \
+			   LE_TGT_CACHE(LE_TC_LLC_ELLC) | \
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) | \
+			   LE_PFM(0) | LE_SCF(0), \
+	  /* 0x0030 */ \
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB), \
 	},
+
+static const struct drm_i915_mocs_entry skylake_mocs_table[] = {
+	GEN9_MOCS_TABLE
 	[I915_MOCS_CACHED] = {
 	  /* 0x0000003b */
 	  .control_value = LE_CACHEABILITY(LE_WB) |
@@ -129,33 +132,13 @@ static const struct drm_i915_mocs_entry skylake_mocs_table[] = {
 
 /* NOTE: the LE_TGT_CACHE is not used on Broxton */
 static const struct drm_i915_mocs_entry broxton_mocs_table[] = {
-	[I915_MOCS_UNCACHED] = {
-	  /* 0x00000009 */
-	  .control_value = LE_CACHEABILITY(LE_UC) |
-			   LE_TGT_CACHE(LE_TC_LLC_ELLC) |
-			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
-			   LE_PFM(0) | LE_SCF(0),
-
-	  /* 0x0010 */
-	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
-	},
-	[I915_MOCS_PTE] = {
-	  /* 0x00000038 */
-	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
-			   LE_TGT_CACHE(LE_TC_LLC_ELLC) |
-			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
-			   LE_PFM(0) | LE_SCF(0),
-
-	  /* 0x0030 */
-	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
-	},
+	GEN9_MOCS_TABLE
 	[I915_MOCS_CACHED] = {
 	  /* 0x00000039 */
 	  .control_value = LE_CACHEABILITY(LE_UC) |
 			   LE_TGT_CACHE(LE_TC_LLC_ELLC) |
 			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
 			   LE_PFM(0) | LE_SCF(0),
-
 	  /* 0x0030 */
 	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
 	},
Signature · 1 line
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#17 lore raw
In reply to Tomasz Lis
Quoted 4 lines · Tomasz Lis

The table has been unified across OSes to minimize virtualization overhead.

The MOCS table is now versioned; the patch includes version 1 entries.

Quoted 8 lines

BSpec: 34007
BSpec: 560

Cc Joonas Lahtinen <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Zhenyu Wang <[email protected]>

---

Can you please resubmit this series with only the patches not dropped? This currently fails CI as CI is adding/dropping patches:
https://patchwork.freedesktop.org/series/51258/

Lucas De Marchi

Quoted 281 lines
 drivers/gpu/drm/i915/intel_mocs.c | 246 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 244 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_mocs.c +244 -2
index 77e9871..b76d6db 100644
@@ -44,6 +44,8 @@ struct drm_i915_mocs_table {
 #define LE_SCC(value)		((value) << 8)
 #define LE_PFM(value)		((value) << 11)
 #define LE_SCF(value)		((value) << 14)
+#define LE_CoS(value)		((value) << 15)
+#define LE_SSE(value)		((value) << 17)
 
 /* Defines for the tables (LNCFMOCS0 - LNCFMOCS31) - two entries per word */
 #define L3_ESC(value)		((value) << 0)
@@ -96,6 +98,243 @@ struct drm_i915_mocs_table {
  *       may only be updated incrementally by adding entries at the
  *       end.
  */
+static const struct drm_i915_mocs_entry icelake_mocs_table[] = {
+	[0] = {
+	  /* Base - Uncached (Deprecated) */
+	  .control_value = LE_CACHEABILITY(LE_UC) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[1] = {
+	  /* Base - L3 + LeCC:PAT (Deprecated) */
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[2] = {
+	  /* Base - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[3] = {
+	  /* Base - Uncached */
+	  .control_value = LE_CACHEABILITY(LE_UC) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[4] = {
+	  /* Base - L3 */
+	  .control_value = LE_CACHEABILITY(LE_UC) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[5] = {
+	  /* Base - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[6] = {
+	  /* Age 0 - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[7] = {
+	  /* Age 0 - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[8] = {
+	  /* Age: Don't Chg. - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[9] = {
+	  /* Age: Don't Chg. - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[10] = {
+	  /* No AOM - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[11] = {
+	  /* No AOM - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[12] = {
+	  /* No AOM; Age 0 - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[13] = {
+	  /* No AOM; Age 0 - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(1) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[14] = {
+	  /* No AOM; Age:DC - LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[15] = {
+	  /* No AOM; Age:DC - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(2) | LE_AOM(1) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[16] = {
+	  /* Reserved - For future use */
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+			   LE_TGT_CACHE(LE_TC_PAGETABLE) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_DIRECT),
+	},
+	[17] = {
+	  /* Reserved - For future use */
+	  .control_value = LE_CACHEABILITY(LE_PAGETABLE) |
+			   LE_TGT_CACHE(LE_TC_PAGETABLE) |
+			   LE_LRUM(0) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_DIRECT),
+	},
+	[18] = {
+	  /* Self-Snoop - L3 + LLC */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(3),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[19] = {
+	  /* Skip Caching - L3 + LLC(12.5%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[20] = {
+	  /* Skip Caching - L3 + LLC(25%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[21] = {
+	  /* Skip Caching - L3 + LLC(50%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[22] = {
+	  /* Skip Caching - L3 + LLC(75%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(1) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[23] = {
+	  /* Skip Caching - L3 + LLC(87.5%) */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(1) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_WB),
+	},
+	[62] = {
+	  /* HW Reserved - SW program but never use */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+	[63] = {
+	  /* HW Reserved - SW program but never use */
+	  .control_value = LE_CACHEABILITY(LE_WB) |
+			   LE_TGT_CACHE(LE_TC_LLC) |
+			   LE_LRUM(3) | LE_AOM(0) | LE_RSC(0) | LE_SCC(0) |
+			   LE_PFM(0) | LE_SCF(0) | LE_CoS(0) | LE_SSE(0),
+
+	  .l3cc_value =    L3_ESC(0) | L3_SCC(0) | L3_CACHEABILITY(L3_UC),
+	},
+};
+
 static const struct drm_i915_mocs_entry skylake_mocs_table[] = {
 	[I915_MOCS_UNCACHED] = {
 	  /* 0x00000009 */
@@ -178,8 +417,11 @@ static bool get_mocs_settings(struct drm_i915_private *dev_priv,
 {
 	bool result = false;
 
-	if (IS_GEN9_BC(dev_priv) || IS_CANNONLAKE(dev_priv) ||
-	    IS_ICELAKE(dev_priv)) {
+	if (IS_ICELAKE(dev_priv)) {
+		table->size  = ARRAY_SIZE(icelake_mocs_table);
+		table->table = icelake_mocs_table;
+		result = true;
+	} else if (IS_GEN9_BC(dev_priv) || IS_CANNONLAKE(dev_priv)) {
 		table->size  = ARRAY_SIZE(skylake_mocs_table);
 		table->table = skylake_mocs_table;
 		result = true;
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx