1 // SPDX-License-Identifier: MIT
3 * Copyright © 2015 Intel Corporation
8 #include "intel_engine.h"
10 #include "intel_gt_mcr.h"
11 #include "intel_gt_regs.h"
12 #include "intel_mocs.h"
13 #include "intel_ring.h"
15 /* structures required */
16 struct drm_i915_mocs_entry {
22 struct drm_i915_mocs_table {
24 unsigned int n_entries;
25 const struct drm_i915_mocs_entry *table;
27 u8 wb_index; /* Only used on HAS_L3_CCS_READ() platforms */
28 u8 unused_entries_index;
31 /* Defines for the tables (XXX_MOCS_0 - XXX_MOCS_63) */
32 #define _LE_CACHEABILITY(value) ((value) << 0)
33 #define _LE_TGT_CACHE(value) ((value) << 2)
34 #define LE_LRUM(value) ((value) << 4)
35 #define LE_AOM(value) ((value) << 6)
36 #define LE_RSC(value) ((value) << 7)
37 #define LE_SCC(value) ((value) << 8)
38 #define LE_PFM(value) ((value) << 11)
39 #define LE_SCF(value) ((value) << 14)
40 #define LE_COS(value) ((value) << 15)
41 #define LE_SSE(value) ((value) << 17)
43 /* Defines for the tables (GLOB_MOCS_0 - GLOB_MOCS_16) */
44 #define _L4_CACHEABILITY(value) ((value) << 2)
45 #define IG_PAT(value) ((value) << 8)
47 /* Defines for the tables (LNCFMOCS0 - LNCFMOCS31) - two entries per word */
48 #define L3_ESC(value) ((value) << 0)
49 #define L3_SCC(value) ((value) << 1)
50 #define _L3_CACHEABILITY(value) ((value) << 4)
51 #define L3_GLBGO(value) ((value) << 6)
52 #define L3_LKUP(value) ((value) << 7)
55 #define GEN9_NUM_MOCS_ENTRIES 64 /* 63-64 are reserved, but configured. */
56 #define PVC_NUM_MOCS_ENTRIES 3
57 #define MTL_NUM_MOCS_ENTRIES 16
59 /* (e)LLC caching options */
61 * Note: LE_0_PAGETABLE works only up to Gen11; for newer gens it means
64 #define LE_0_PAGETABLE _LE_CACHEABILITY(0)
65 #define LE_1_UC _LE_CACHEABILITY(1)
66 #define LE_2_WT _LE_CACHEABILITY(2)
67 #define LE_3_WB _LE_CACHEABILITY(3)
70 #define LE_TC_0_PAGETABLE _LE_TGT_CACHE(0)
71 #define LE_TC_1_LLC _LE_TGT_CACHE(1)
72 #define LE_TC_2_LLC_ELLC _LE_TGT_CACHE(2)
73 #define LE_TC_3_LLC_ELLC_ALT _LE_TGT_CACHE(3)
75 /* L3 caching options */
76 #define L3_0_DIRECT _L3_CACHEABILITY(0)
77 #define L3_1_UC _L3_CACHEABILITY(1)
78 #define L3_2_RESERVED _L3_CACHEABILITY(2)
79 #define L3_3_WB _L3_CACHEABILITY(3)
81 /* L4 caching options */
82 #define L4_0_WB _L4_CACHEABILITY(0)
83 #define L4_1_WT _L4_CACHEABILITY(1)
84 #define L4_2_RESERVED _L4_CACHEABILITY(2)
85 #define L4_3_UC _L4_CACHEABILITY(3)
87 #define MOCS_ENTRY(__idx, __control_value, __l3cc_value) \
89 .control_value = __control_value, \
90 .l3cc_value = __l3cc_value, \
97 * These are the MOCS tables that are programmed across all the rings.
98 * The control value is programmed to all the rings that support the
99 * MOCS registers. While the l3cc_values are only programmed to the
100 * LNCFCMOCS0 - LNCFCMOCS32 registers.
102 * These tables are intended to be kept reasonably consistent across
103 * HW platforms, and for ICL+, be identical across OSes. To achieve
104 * that, for Icelake and above, list of entries is published as part
107 * Entries not part of the following tables are undefined as far as
108 * userspace is concerned and shouldn't be relied upon. For Gen < 12
109 * they will be initialized to PTE. Gen >= 12 don't have a setting for
110 * PTE and those platforms except TGL/RKL will be initialized L3 WB to
111 * catch accidental use of reserved and unused mocs indexes.
113 * The last few entries are reserved by the hardware. For ICL+ they
114 * should be initialized according to bspec and never used, for older
115 * platforms they should never be written to.
117 * NOTE1: These tables are part of bspec and defined as part of hardware
118 * interface for ICL+. For older platforms, they are part of kernel
119 * ABI. It is expected that, for specific hardware platform, existing
120 * entries will remain constant and the table will only be updated by
121 * adding new entries, filling unused positions.
123 * NOTE2: For GEN >= 12 except TGL and RKL, reserved and unspecified MOCS
124 * indices have been set to L3 WB. These reserved entries should never
125 * be used, they may be changed to low performant variants with better
126 * coherency in the future if more entries are needed.
127 * For TGL/RKL, all the unspecified MOCS indexes are mapped to L3 UC.
129 #define GEN9_MOCS_ENTRIES \
130 MOCS_ENTRY(I915_MOCS_UNCACHED, \
131 LE_1_UC | LE_TC_2_LLC_ELLC, \
133 MOCS_ENTRY(I915_MOCS_PTE, \
134 LE_0_PAGETABLE | LE_TC_0_PAGETABLE | LE_LRUM(3), \
137 static const struct drm_i915_mocs_entry skl_mocs_table[] = {
139 MOCS_ENTRY(I915_MOCS_CACHED,
140 LE_3_WB | LE_TC_2_LLC_ELLC | LE_LRUM(3),
145 * - used by the L3 for all of its evictions.
146 * Thus it is expected to allow LLC cacheability to enable coherent
147 * flows to be maintained.
148 * - used to force L3 uncachable cycles.
149 * Thus it is expected to make the surface L3 uncacheable.
152 LE_3_WB | LE_TC_1_LLC | LE_LRUM(3),
156 /* NOTE: the LE_TGT_CACHE is not used on Broxton */
157 static const struct drm_i915_mocs_entry broxton_mocs_table[] = {
159 MOCS_ENTRY(I915_MOCS_CACHED,
160 LE_1_UC | LE_TC_2_LLC_ELLC | LE_LRUM(3),
164 #define GEN11_MOCS_ENTRIES \
165 /* Entries 0 and 1 are defined per-platform */ \
166 /* Base - L3 + LLC */ \
168 LE_3_WB | LE_TC_1_LLC | LE_LRUM(3), \
170 /* Base - Uncached */ \
172 LE_1_UC | LE_TC_1_LLC, \
176 LE_1_UC | LE_TC_1_LLC, \
180 LE_3_WB | LE_TC_1_LLC | LE_LRUM(3), \
184 LE_3_WB | LE_TC_1_LLC | LE_LRUM(1), \
186 /* Age 0 - L3 + LLC */ \
188 LE_3_WB | LE_TC_1_LLC | LE_LRUM(1), \
190 /* Age: Don't Chg. - LLC */ \
192 LE_3_WB | LE_TC_1_LLC | LE_LRUM(2), \
194 /* Age: Don't Chg. - L3 + LLC */ \
196 LE_3_WB | LE_TC_1_LLC | LE_LRUM(2), \
200 LE_3_WB | LE_TC_1_LLC | LE_LRUM(3) | LE_AOM(1), \
202 /* No AOM - L3 + LLC */ \
204 LE_3_WB | LE_TC_1_LLC | LE_LRUM(3) | LE_AOM(1), \
206 /* No AOM; Age 0 - LLC */ \
208 LE_3_WB | LE_TC_1_LLC | LE_LRUM(1) | LE_AOM(1), \
210 /* No AOM; Age 0 - L3 + LLC */ \
212 LE_3_WB | LE_TC_1_LLC | LE_LRUM(1) | LE_AOM(1), \
214 /* No AOM; Age:DC - LLC */ \
216 LE_3_WB | LE_TC_1_LLC | LE_LRUM(2) | LE_AOM(1), \
218 /* No AOM; Age:DC - L3 + LLC */ \
220 LE_3_WB | LE_TC_1_LLC | LE_LRUM(2) | LE_AOM(1), \
222 /* Bypass LLC - Uncached (EHL+) */ \
224 LE_1_UC | LE_TC_1_LLC | LE_SCF(1), \
226 /* Bypass LLC - L3 (Read-Only) (EHL+) */ \
228 LE_1_UC | LE_TC_1_LLC | LE_SCF(1), \
230 /* Self-Snoop - L3 + LLC */ \
232 LE_3_WB | LE_TC_1_LLC | LE_LRUM(3) | LE_SSE(3), \
234 /* Skip Caching - L3 + LLC(12.5%) */ \
236 LE_3_WB | LE_TC_1_LLC | LE_LRUM(3) | LE_SCC(7), \
238 /* Skip Caching - L3 + LLC(25%) */ \
240 LE_3_WB | LE_TC_1_LLC | LE_LRUM(3) | LE_SCC(3), \
242 /* Skip Caching - L3 + LLC(50%) */ \
244 LE_3_WB | LE_TC_1_LLC | LE_LRUM(3) | LE_SCC(1), \
246 /* Skip Caching - L3 + LLC(75%) */ \
248 LE_3_WB | LE_TC_1_LLC | LE_LRUM(3) | LE_RSC(1) | LE_SCC(3), \
250 /* Skip Caching - L3 + LLC(87.5%) */ \
252 LE_3_WB | LE_TC_1_LLC | LE_LRUM(3) | LE_RSC(1) | LE_SCC(7), \
254 /* HW Reserved - SW program but never use */ \
256 LE_3_WB | LE_TC_1_LLC | LE_LRUM(3), \
258 /* HW Reserved - SW program but never use */ \
260 LE_3_WB | LE_TC_1_LLC | LE_LRUM(3), \
263 static const struct drm_i915_mocs_entry tgl_mocs_table[] = {
266 * Reserved and unspecified MOCS indices have been set to (L3 + LCC).
267 * These reserved entries should never be used, they may be changed
268 * to low performant variants with better coherency in the future if
269 * more entries are needed. We are programming index I915_MOCS_PTE(1)
270 * only, __init_mocs_table() take care to program unused index with
273 MOCS_ENTRY(I915_MOCS_PTE,
274 LE_0_PAGETABLE | LE_TC_0_PAGETABLE,
278 /* Implicitly enable L1 - HDC:L1 + L3 + LLC */
280 LE_3_WB | LE_TC_1_LLC | LE_LRUM(3),
282 /* Implicitly enable L1 - HDC:L1 + L3 */
284 LE_1_UC | LE_TC_1_LLC,
286 /* Implicitly enable L1 - HDC:L1 + LLC */
288 LE_3_WB | LE_TC_1_LLC | LE_LRUM(3),
290 /* Implicitly enable L1 - HDC:L1 */
292 LE_1_UC | LE_TC_1_LLC,
294 /* HW Special Case (CCS) */
296 LE_3_WB | LE_TC_1_LLC | LE_LRUM(3),
298 /* HW Special Case (Displayable) */
300 LE_1_UC | LE_TC_1_LLC,
304 static const struct drm_i915_mocs_entry icl_mocs_table[] = {
305 /* Base - Uncached (Deprecated) */
306 MOCS_ENTRY(I915_MOCS_UNCACHED,
307 LE_1_UC | LE_TC_1_LLC,
309 /* Base - L3 + LeCC:PAT (Deprecated) */
310 MOCS_ENTRY(I915_MOCS_PTE,
311 LE_0_PAGETABLE | LE_TC_0_PAGETABLE,
317 static const struct drm_i915_mocs_entry dg1_mocs_table[] = {
320 MOCS_ENTRY(1, 0, L3_1_UC),
322 MOCS_ENTRY(5, 0, L3_3_WB),
324 MOCS_ENTRY(6, 0, L3_ESC(1) | L3_SCC(1) | L3_3_WB),
326 MOCS_ENTRY(7, 0, L3_ESC(1) | L3_SCC(3) | L3_3_WB),
328 MOCS_ENTRY(8, 0, L3_ESC(1) | L3_SCC(7) | L3_3_WB),
331 MOCS_ENTRY(48, 0, L3_3_WB),
333 MOCS_ENTRY(49, 0, L3_1_UC),
336 MOCS_ENTRY(60, 0, L3_1_UC),
337 MOCS_ENTRY(61, 0, L3_1_UC),
338 MOCS_ENTRY(62, 0, L3_1_UC),
339 MOCS_ENTRY(63, 0, L3_1_UC),
342 static const struct drm_i915_mocs_entry gen12_mocs_table[] = {
344 /* Implicitly enable L1 - HDC:L1 + L3 + LLC */
346 LE_3_WB | LE_TC_1_LLC | LE_LRUM(3),
348 /* Implicitly enable L1 - HDC:L1 + L3 */
350 LE_1_UC | LE_TC_1_LLC,
352 /* Implicitly enable L1 - HDC:L1 + LLC */
354 LE_3_WB | LE_TC_1_LLC | LE_LRUM(3),
356 /* Implicitly enable L1 - HDC:L1 */
358 LE_1_UC | LE_TC_1_LLC,
360 /* HW Special Case (CCS) */
362 LE_3_WB | LE_TC_1_LLC | LE_LRUM(3),
364 /* HW Special Case (Displayable) */
366 LE_1_UC | LE_TC_1_LLC,
370 static const struct drm_i915_mocs_entry xehpsdv_mocs_table[] = {
372 MOCS_ENTRY(0, 0, L3_3_WB | L3_LKUP(1)),
374 /* UC - Coherent; GO:L3 */
375 MOCS_ENTRY(1, 0, L3_1_UC | L3_LKUP(1)),
376 /* UC - Coherent; GO:Memory */
377 MOCS_ENTRY(2, 0, L3_1_UC | L3_GLBGO(1) | L3_LKUP(1)),
378 /* UC - Non-Coherent; GO:Memory */
379 MOCS_ENTRY(3, 0, L3_1_UC | L3_GLBGO(1)),
380 /* UC - Non-Coherent; GO:L3 */
381 MOCS_ENTRY(4, 0, L3_1_UC),
384 MOCS_ENTRY(5, 0, L3_3_WB | L3_LKUP(1)),
386 /* HW Reserved - SW program but never use. */
387 MOCS_ENTRY(48, 0, L3_3_WB | L3_LKUP(1)),
388 MOCS_ENTRY(49, 0, L3_1_UC | L3_LKUP(1)),
389 MOCS_ENTRY(60, 0, L3_1_UC),
390 MOCS_ENTRY(61, 0, L3_1_UC),
391 MOCS_ENTRY(62, 0, L3_1_UC),
392 MOCS_ENTRY(63, 0, L3_1_UC),
395 static const struct drm_i915_mocs_entry dg2_mocs_table[] = {
396 /* UC - Coherent; GO:L3 */
397 MOCS_ENTRY(0, 0, L3_1_UC | L3_LKUP(1)),
398 /* UC - Coherent; GO:Memory */
399 MOCS_ENTRY(1, 0, L3_1_UC | L3_GLBGO(1) | L3_LKUP(1)),
400 /* UC - Non-Coherent; GO:Memory */
401 MOCS_ENTRY(2, 0, L3_1_UC | L3_GLBGO(1)),
404 MOCS_ENTRY(3, 0, L3_3_WB | L3_LKUP(1)),
407 static const struct drm_i915_mocs_entry pvc_mocs_table[] = {
409 MOCS_ENTRY(0, 0, L3_3_WB),
412 MOCS_ENTRY(1, 0, L3_1_UC),
415 MOCS_ENTRY(2, 0, L3_3_WB),
418 static const struct drm_i915_mocs_entry mtl_mocs_table[] = {
419 /* Error - Reserved for Non-Use */
422 L3_LKUP(1) | L3_3_WB),
423 /* Cached - L3 + L4 */
426 L3_LKUP(1) | L3_3_WB),
430 L3_LKUP(1) | L3_1_UC),
431 /* Uncached - GO:L3 */
434 L3_LKUP(1) | L3_1_UC),
438 L3_LKUP(1) | L3_GLBGO(1) | L3_1_UC),
439 /* Uncached - GO:Mem */
442 L3_LKUP(1) | L3_GLBGO(1) | L3_1_UC),
443 /* L4 - L3:NoLKUP; GO:L3 */
447 /* Uncached - L3:NoLKUP; GO:L3 */
451 /* L4 - L3:NoLKUP; GO:Mem */
454 L3_GLBGO(1) | L3_1_UC),
455 /* Uncached - L3:NoLKUP; GO:Mem */
458 L3_GLBGO(1) | L3_1_UC),
459 /* Display - L3; L4:WT */
462 L3_LKUP(1) | L3_3_WB),
463 /* CCS - Non-Displayable */
466 L3_GLBGO(1) | L3_1_UC),
470 HAS_GLOBAL_MOCS = BIT(0),
471 HAS_ENGINE_MOCS = BIT(1),
472 HAS_RENDER_L3CC = BIT(2),
475 static bool has_l3cc(const struct drm_i915_private *i915)
480 static bool has_global_mocs(const struct drm_i915_private *i915)
482 return HAS_GLOBAL_MOCS_REGISTERS(i915);
485 static bool has_mocs(const struct drm_i915_private *i915)
487 return !IS_DGFX(i915);
490 static unsigned int get_mocs_settings(struct drm_i915_private *i915,
491 struct drm_i915_mocs_table *table)
495 memset(table, 0, sizeof(struct drm_i915_mocs_table));
497 table->unused_entries_index = I915_MOCS_PTE;
498 if (IS_GFX_GT_IP_RANGE(to_gt(i915), IP_VER(12, 70), IP_VER(12, 74))) {
499 table->size = ARRAY_SIZE(mtl_mocs_table);
500 table->table = mtl_mocs_table;
501 table->n_entries = MTL_NUM_MOCS_ENTRIES;
503 table->unused_entries_index = 1;
504 } else if (IS_PONTEVECCHIO(i915)) {
505 table->size = ARRAY_SIZE(pvc_mocs_table);
506 table->table = pvc_mocs_table;
507 table->n_entries = PVC_NUM_MOCS_ENTRIES;
510 table->unused_entries_index = 2;
511 } else if (IS_DG2(i915)) {
512 table->size = ARRAY_SIZE(dg2_mocs_table);
513 table->table = dg2_mocs_table;
515 table->n_entries = GEN9_NUM_MOCS_ENTRIES;
516 table->unused_entries_index = 3;
517 } else if (IS_XEHPSDV(i915)) {
518 table->size = ARRAY_SIZE(xehpsdv_mocs_table);
519 table->table = xehpsdv_mocs_table;
521 table->n_entries = GEN9_NUM_MOCS_ENTRIES;
522 table->unused_entries_index = 5;
523 } else if (IS_DG1(i915)) {
524 table->size = ARRAY_SIZE(dg1_mocs_table);
525 table->table = dg1_mocs_table;
527 table->n_entries = GEN9_NUM_MOCS_ENTRIES;
529 table->unused_entries_index = 5;
530 } else if (IS_TIGERLAKE(i915) || IS_ROCKETLAKE(i915)) {
531 /* For TGL/RKL, Can't be changed now for ABI reasons */
532 table->size = ARRAY_SIZE(tgl_mocs_table);
533 table->table = tgl_mocs_table;
534 table->n_entries = GEN9_NUM_MOCS_ENTRIES;
536 } else if (GRAPHICS_VER(i915) >= 12) {
537 table->size = ARRAY_SIZE(gen12_mocs_table);
538 table->table = gen12_mocs_table;
539 table->n_entries = GEN9_NUM_MOCS_ENTRIES;
541 table->unused_entries_index = 2;
542 } else if (GRAPHICS_VER(i915) == 11) {
543 table->size = ARRAY_SIZE(icl_mocs_table);
544 table->table = icl_mocs_table;
545 table->n_entries = GEN9_NUM_MOCS_ENTRIES;
546 } else if (IS_GEN9_BC(i915)) {
547 table->size = ARRAY_SIZE(skl_mocs_table);
548 table->n_entries = GEN9_NUM_MOCS_ENTRIES;
549 table->table = skl_mocs_table;
550 } else if (IS_GEN9_LP(i915)) {
551 table->size = ARRAY_SIZE(broxton_mocs_table);
552 table->n_entries = GEN9_NUM_MOCS_ENTRIES;
553 table->table = broxton_mocs_table;
555 drm_WARN_ONCE(&i915->drm, GRAPHICS_VER(i915) >= 9,
556 "Platform that should have a MOCS table does not.\n");
560 if (GEM_DEBUG_WARN_ON(table->size > table->n_entries))
563 /* WaDisableSkipCaching:skl,bxt,kbl,glk */
564 if (GRAPHICS_VER(i915) == 9) {
567 for (i = 0; i < table->size; i++)
568 if (GEM_DEBUG_WARN_ON(table->table[i].l3cc_value &
569 (L3_ESC(1) | L3_SCC(0x7))))
574 if (has_mocs(i915)) {
575 if (has_global_mocs(i915))
576 flags |= HAS_GLOBAL_MOCS;
578 flags |= HAS_ENGINE_MOCS;
581 flags |= HAS_RENDER_L3CC;
587 * Get control_value from MOCS entry taking into account when it's not used
588 * then if unused_entries_index is non-zero then its value will be returned
589 * otherwise I915_MOCS_PTE's value is returned in this case.
591 static u32 get_entry_control(const struct drm_i915_mocs_table *table,
594 if (index < table->size && table->table[index].used)
595 return table->table[index].control_value;
596 return table->table[table->unused_entries_index].control_value;
599 #define for_each_mocs(mocs, t, i) \
601 i < (t)->n_entries ? (mocs = get_entry_control((t), i)), 1 : 0;\
604 static void __init_mocs_table(struct intel_uncore *uncore,
605 const struct drm_i915_mocs_table *table,
611 drm_WARN_ONCE(&uncore->i915->drm, !table->unused_entries_index,
612 "Unused entries index should have been defined\n");
613 for_each_mocs(mocs, table, i)
614 intel_uncore_write_fw(uncore, _MMIO(addr + i * 4), mocs);
617 static u32 mocs_offset(const struct intel_engine_cs *engine)
619 static const u32 offset[] = {
620 [RCS0] = __GEN9_RCS0_MOCS0,
621 [VCS0] = __GEN9_VCS0_MOCS0,
622 [VCS1] = __GEN9_VCS1_MOCS0,
623 [VECS0] = __GEN9_VECS0_MOCS0,
624 [BCS0] = __GEN9_BCS0_MOCS0,
625 [VCS2] = __GEN11_VCS2_MOCS0,
628 GEM_BUG_ON(engine->id >= ARRAY_SIZE(offset));
629 return offset[engine->id];
632 static void init_mocs_table(struct intel_engine_cs *engine,
633 const struct drm_i915_mocs_table *table)
635 __init_mocs_table(engine->uncore, table, mocs_offset(engine));
639 * Get l3cc_value from MOCS entry taking into account when it's not used
640 * then if unused_entries_index is not zero then its value will be returned
641 * otherwise I915_MOCS_PTE's value is returned in this case.
643 static u16 get_entry_l3cc(const struct drm_i915_mocs_table *table,
646 if (index < table->size && table->table[index].used)
647 return table->table[index].l3cc_value;
648 return table->table[table->unused_entries_index].l3cc_value;
651 static u32 l3cc_combine(u16 low, u16 high)
653 return low | (u32)high << 16;
656 #define for_each_l3cc(l3cc, t, i) \
658 i < ((t)->n_entries + 1) / 2 ? \
659 (l3cc = l3cc_combine(get_entry_l3cc((t), 2 * i), \
660 get_entry_l3cc((t), 2 * i + 1))), 1 : \
664 static void init_l3cc_table(struct intel_gt *gt,
665 const struct drm_i915_mocs_table *table)
671 intel_gt_mcr_lock(gt, &flags);
672 for_each_l3cc(l3cc, table, i)
673 if (GRAPHICS_VER_FULL(gt->i915) >= IP_VER(12, 50))
674 intel_gt_mcr_multicast_write_fw(gt, XEHP_LNCFCMOCS(i), l3cc);
676 intel_uncore_write_fw(gt->uncore, GEN9_LNCFCMOCS(i), l3cc);
677 intel_gt_mcr_unlock(gt, flags);
680 void intel_mocs_init_engine(struct intel_engine_cs *engine)
682 struct drm_i915_mocs_table table;
685 /* Called under a blanket forcewake */
686 assert_forcewakes_active(engine->uncore, FORCEWAKE_ALL);
688 flags = get_mocs_settings(engine->i915, &table);
692 /* Platforms with global MOCS do not need per-engine initialization. */
693 if (flags & HAS_ENGINE_MOCS)
694 init_mocs_table(engine, &table);
696 if (flags & HAS_RENDER_L3CC && engine->class == RENDER_CLASS)
697 init_l3cc_table(engine->gt, &table);
700 static u32 global_mocs_offset(void)
702 return i915_mmio_reg_offset(GEN12_GLOBAL_MOCS(0));
705 void intel_set_mocs_index(struct intel_gt *gt)
707 struct drm_i915_mocs_table table;
709 get_mocs_settings(gt->i915, &table);
710 gt->mocs.uc_index = table.uc_index;
711 if (HAS_L3_CCS_READ(gt->i915))
712 gt->mocs.wb_index = table.wb_index;
715 void intel_mocs_init(struct intel_gt *gt)
717 struct drm_i915_mocs_table table;
721 * LLC and eDRAM control values are not applicable to dgfx
723 flags = get_mocs_settings(gt->i915, &table);
724 if (flags & HAS_GLOBAL_MOCS)
725 __init_mocs_table(gt->uncore, &table, global_mocs_offset());
728 * Initialize the L3CC table as part of mocs initalization to make
729 * sure the LNCFCMOCSx registers are programmed for the subsequent
730 * memory transactions including guc transactions
732 if (flags & HAS_RENDER_L3CC)
733 init_l3cc_table(gt, &table);
736 #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
737 #include "selftest_mocs.c"