Skip to content

Commit c34f986

Browse files
committed
drm/xe: Update workaround documentation
Bring it up to reality, better documenting the existing batch buffers, OOB rules and fixing some typos. Bspec: 60122 Reviewed-by: Stuart Summers <stuart.summers@intel.com> Link: https://lore.kernel.org/r/20250911-wa-bb-cmds-v4-1-c8f7e48f7eae@intel.com Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
1 parent 4e1d3b5 commit c34f986

File tree

1 file changed

+32
-13
lines changed

1 file changed

+32
-13
lines changed

drivers/gpu/drm/xe/xe_wa.c

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
* Register Immediate commands) once when initializing the device and saved in
4040
* the default context. That default context is then used on every context
4141
* creation to have a "primed golden context", i.e. a context image that
42-
* already contains the changes needed to all the registers.
42+
* already contains the changes needed to all the registers. See
43+
* drivers/gpu/drm/xe/xe_lrc.c for default context handling.
4344
*
4445
* - Engine workarounds: the list of these WAs is applied whenever the specific
4546
* engine is reset. It's also possible that a set of engine classes share a
@@ -48,10 +49,10 @@
4849
* them need to keeep the workaround programming: the approach taken in the
4950
* driver is to tie those workarounds to the first compute/render engine that
5051
* is registered. When executing with GuC submission, engine resets are
51-
* outside of kernel driver control, hence the list of registers involved in
52+
* outside of kernel driver control, hence the list of registers involved is
5253
* written once, on engine initialization, and then passed to GuC, that
5354
* saves/restores their values before/after the reset takes place. See
54-
* ``drivers/gpu/drm/xe/xe_guc_ads.c`` for reference.
55+
* drivers/gpu/drm/xe/xe_guc_ads.c for reference.
5556
*
5657
* - GT workarounds: the list of these WAs is applied whenever these registers
5758
* revert to their default values: on GPU reset, suspend/resume [1]_, etc.
@@ -66,21 +67,39 @@
6667
* hardware on every HW context restore. These buffers are created and
6768
* programmed in the default context so the hardware always go through those
6869
* programming sequences when switching contexts. The support for workaround
69-
* batchbuffers is enabled these hardware mechanisms:
70+
* batchbuffers is enabled via these hardware mechanisms:
7071
*
71-
* #. INDIRECT_CTX: A batchbuffer and an offset are provided in the default
72-
* context, pointing the hardware to jump to that location when that offset
73-
* is reached in the context restore. Workaround batchbuffer in the driver
74-
* currently uses this mechanism for all platforms.
72+
* #. INDIRECT_CTX (also known as **mid context restore bb**): A batchbuffer
73+
* and an offset are provided in the default context, pointing the hardware
74+
* to jump to that location when that offset is reached in the context
75+
* restore. When a context is being restored, this is executed after the
76+
* ring context, in the middle (or beginning) of the engine context image.
7577
*
76-
* #. BB_PER_CTX_PTR: A batchbuffer is provided in the default context,
77-
* pointing the hardware to a buffer to continue executing after the
78-
* engine registers are restored in a context restore sequence. This is
79-
* currently not used in the driver.
78+
* #. BB_PER_CTX_PTR (also known as **post context restore bb**): A
79+
* batchbuffer is provided in the default context, pointing the hardware to
80+
* a buffer to continue executing after the engine registers are restored
81+
* in a context restore sequence.
82+
*
83+
* Below is the timeline for a context restore sequence:
84+
*
85+
* .. code::
86+
*
87+
* INDIRECT_CTX_OFFSET
88+
* |----------->|
89+
* .------------.------------.-------------.------------.--------------.-----------.
90+
* |Ring | Engine | Mid-context | Engine | Post-context | Ring |
91+
* |Restore | Restore (1)| BB Restore | Restore (2)| BB Restore | Execution |
92+
* `------------'------------'-------------'------------'--------------'-----------'
8093
*
8194
* - Other/OOB: There are WAs that, due to their nature, cannot be applied from
8295
* a central place. Those are peppered around the rest of the code, as needed.
83-
* Workarounds related to the display IP are the main example.
96+
* There's a central place to control which workarounds are enabled:
97+
* drivers/gpu/drm/xe/xe_wa_oob.rules for GT workarounds and
98+
* drivers/gpu/drm/xe/xe_device_wa_oob.rules for device/SoC workarounds.
99+
* These files only record which workarounds are enabled: during early device
100+
* initialization those rules are evaluated and recorded by the driver. Then
101+
* later the driver checks with ``XE_GT_WA()`` and ``XE_DEVICE_WA()`` to
102+
* implement them.
84103
*
85104
* .. [1] Technically, some registers are powercontext saved & restored, so they
86105
* survive a suspend/resume. In practice, writing them again is not too

0 commit comments

Comments
 (0)