xref: /linux/drivers/gpu/drm/i915/gt/intel_mocs.h (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
124f90d66SChris Wilson /* SPDX-License-Identifier: MIT */
2112ed2d3SChris Wilson /*
324f90d66SChris Wilson  * Copyright © 2015 Intel Corporation
4112ed2d3SChris Wilson  */
5112ed2d3SChris Wilson 
6112ed2d3SChris Wilson #ifndef INTEL_MOCS_H
7112ed2d3SChris Wilson #define INTEL_MOCS_H
8112ed2d3SChris Wilson 
9112ed2d3SChris Wilson /**
10112ed2d3SChris Wilson  * DOC: Memory Objects Control State (MOCS)
11112ed2d3SChris Wilson  *
12112ed2d3SChris Wilson  * Motivation:
13112ed2d3SChris Wilson  * In previous Gens the MOCS settings was a value that was set by user land as
14112ed2d3SChris Wilson  * part of the batch. In Gen9 this has changed to be a single table (per ring)
15112ed2d3SChris Wilson  * that all batches now reference by index instead of programming the MOCS
16112ed2d3SChris Wilson  * directly.
17112ed2d3SChris Wilson  *
18112ed2d3SChris Wilson  * The one wrinkle in this is that only PART of the MOCS tables are included
19112ed2d3SChris Wilson  * in context (The GFX_MOCS_0 - GFX_MOCS_64 and the LNCFCMOCS0 - LNCFCMOCS32
20112ed2d3SChris Wilson  * registers). The rest are not (the settings for the other rings).
21112ed2d3SChris Wilson  *
22112ed2d3SChris Wilson  * This table needs to be set at system start-up because the way the table
23112ed2d3SChris Wilson  * interacts with the contexts and the GmmLib interface.
24112ed2d3SChris Wilson  *
25112ed2d3SChris Wilson  *
26112ed2d3SChris Wilson  * Implementation:
27112ed2d3SChris Wilson  *
28112ed2d3SChris Wilson  * The tables (one per supported platform) are defined in intel_mocs.c
29112ed2d3SChris Wilson  * and are programmed in the first batch after the context is loaded
30112ed2d3SChris Wilson  * (with the hardware workarounds). This will then let the usual
31112ed2d3SChris Wilson  * context handling keep the MOCS in step.
32112ed2d3SChris Wilson  */
33112ed2d3SChris Wilson 
34112ed2d3SChris Wilson struct intel_engine_cs;
3520a7f2fcSTvrtko Ursulin struct intel_gt;
36112ed2d3SChris Wilson 
371b6c3c6dSTvrtko Ursulin void intel_mocs_init(struct intel_gt *gt);
38112ed2d3SChris Wilson void intel_mocs_init_engine(struct intel_engine_cs *engine);
39*53718bffSAyaz A Siddiqui void intel_set_mocs_index(struct intel_gt *gt);
40112ed2d3SChris Wilson 
41112ed2d3SChris Wilson #endif
42