/* Defines for the tables (GLOB_MOCS_0 - GLOB_MOCS_16) */ #define _L4_CACHEABILITY(value) ((value) << 2) #define IG_PAT(value) ((value) << 8)
/* Defines for the tables (LNCFMOCS0 - LNCFMOCS31) - two entries per word */ #define L3_ESC(value) ((value) << 0) #define L3_SCC(value) ((value) << 1) #define _L3_CACHEABILITY(value) ((value) << 4) #define L3_GLBGO(value) ((value) << 6) #define L3_LKUP(value) ((value) << 7)
/* Helper defines */ #define GEN9_NUM_MOCS_ENTRIES 64 /* 63-64 are reserved, but configured. */ #define MTL_NUM_MOCS_ENTRIES 16
/* (e)LLC caching options */ /* * Note: LE_0_PAGETABLE works only up to Gen11; for newer gens it means * the same as LE_UC
*/ #define LE_0_PAGETABLE _LE_CACHEABILITY(0) #define LE_1_UC _LE_CACHEABILITY(1) #define LE_2_WT _LE_CACHEABILITY(2) #define LE_3_WB _LE_CACHEABILITY(3)
/* * MOCS tables * * These are the MOCS tables that are programmed across all the rings. * The control value is programmed to all the rings that support the * MOCS registers. While the l3cc_values are only programmed to the * LNCFCMOCS0 - LNCFCMOCS32 registers. * * These tables are intended to be kept reasonably consistent across * 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 Gen < 12 * they will be initialized to PTE. Gen >= 12 don't have a setting for * PTE and those platforms except TGL/RKL will be initialized L3 WB to * catch accidental use of reserved and unused mocs indexes. * * The last few 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. * * NOTE1: 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, for specific hardware platform, existing * entries will remain constant and the table will only be updated by * adding new entries, filling unused positions. * * NOTE2: For GEN >= 12 except TGL and RKL, reserved and unspecified MOCS * indices have been set to L3 WB. These reserved entries should never * be used, they may be changed to low performant variants with better * coherency in the future if more entries are needed. * For TGL/RKL, all the unspecified MOCS indexes are mapped to L3 UC.
*/ #define GEN9_MOCS_ENTRIES \
MOCS_ENTRY(I915_MOCS_UNCACHED, \
LE_1_UC | LE_TC_2_LLC_ELLC, \
L3_1_UC), \
MOCS_ENTRY(I915_MOCS_PTE, \
LE_0_PAGETABLE | LE_TC_0_PAGETABLE | LE_LRUM(3), \
L3_3_WB)
/* * mocs:63 * - used by the L3 for all of its evictions. * Thus it is expected to allow LLC cacheability to enable coherent * flows to be maintained. * - used to force L3 uncachable cycles. * Thus it is expected to make the surface L3 uncacheable.
*/
MOCS_ENTRY(63,
LE_3_WB | LE_TC_1_LLC | LE_LRUM(3),
L3_1_UC)
};
/* NOTE: the LE_TGT_CACHE is not used on Broxton */ staticconststruct drm_i915_mocs_entry broxton_mocs_table[] = {
GEN9_MOCS_ENTRIES,
MOCS_ENTRY(I915_MOCS_CACHED,
LE_1_UC | LE_TC_2_LLC_ELLC | LE_LRUM(3),
L3_3_WB)
};
staticconststruct drm_i915_mocs_entry tgl_mocs_table[] = { /* * NOTE: * Reserved and unspecified MOCS indices have been set to (L3 + LCC). * These reserved entries should never be used, they may be changed * to low performant variants with better coherency in the future if * more entries are needed. We are programming index I915_MOCS_PTE(1) * only, __init_mocs_table() take care to program unused index with * this entry.
*/
MOCS_ENTRY(I915_MOCS_PTE,
LE_0_PAGETABLE | LE_TC_0_PAGETABLE,
L3_1_UC),
GEN11_MOCS_ENTRIES,
if (GEM_DEBUG_WARN_ON(table->size > table->n_entries)) return 0;
/* WaDisableSkipCaching:skl,bxt,kbl,glk */ if (GRAPHICS_VER(i915) == 9) { int i;
for (i = 0; i < table->size; i++) if (GEM_DEBUG_WARN_ON(table->table[i].l3cc_value &
(L3_ESC(1) | L3_SCC(0x7)))) return 0;
}
flags = 0; if (has_mocs(i915)) { if (has_global_mocs(i915))
flags |= HAS_GLOBAL_MOCS; else
flags |= HAS_ENGINE_MOCS;
} if (has_l3cc(i915))
flags |= HAS_RENDER_L3CC;
return flags;
}
/* * Get control_value from MOCS entry taking into account when it's not used * then if unused_entries_index is non-zero then its value will be returned * otherwise I915_MOCS_PTE's value is returned in this case.
*/ static u32 get_entry_control(conststruct drm_i915_mocs_table *table, unsignedint index)
{ if (index < table->size && table->table[index].used) return table->table[index].control_value; return table->table[table->unused_entries_index].control_value;
}
#define for_each_mocs(mocs, t, i) \ for (i = 0; \
i < (t)->n_entries ? (mocs = get_entry_control((t), i)), 1 : 0;\
i++)
drm_WARN_ONCE(&uncore->i915->drm, !table->unused_entries_index, "Unused entries index should have been defined\n");
for_each_mocs(mocs, table, i)
intel_uncore_write_fw(uncore, _MMIO(addr + i * 4), mocs);
}
/* * Get l3cc_value from MOCS entry taking into account when it's not used * then if unused_entries_index is not zero then its value will be returned * otherwise I915_MOCS_PTE's value is returned in this case.
*/ static u16 get_entry_l3cc(conststruct drm_i915_mocs_table *table, unsignedint index)
{ if (index < table->size && table->table[index].used) return table->table[index].l3cc_value; return table->table[table->unused_entries_index].l3cc_value;
}
/* * LLC and eDRAM control values are not applicable to dgfx
*/
flags = get_mocs_settings(gt->i915, &table); if (flags & HAS_GLOBAL_MOCS)
__init_mocs_table(gt->uncore, &table, global_mocs_offset());
/* * Initialize the L3CC table as part of mocs initialization to make * sure the LNCFCMOCSx registers are programmed for the subsequent * memory transactions including guc transactions
*/ if (flags & HAS_RENDER_L3CC)
init_l3cc_table(gt, &table);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.