Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Documentation/gpu: Add an intro about MES

MES is an important firmware that lacks some essential documentation.
This commit introduces an overview of it and how it works.

Reviewed-by: Bagas Sanjaya <bagasdotme@gmail.com>
Signed-off-by: Rodrigo Siqueira <siqueira@igalia.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Rodrigo Siqueira and committed by
Alex Deucher
74f0ff36 e7aaa5fb

+46 -1
+2
Documentation/gpu/amdgpu/driver-core.rst
··· 77 77 decode. It's exposed to userspace for user mode drivers (VA-API, 78 78 OpenMAX, etc.) 79 79 80 + .. _pipes-and-queues-description: 81 + 80 82 GFX, Compute, and SDMA Overall Behavior 81 83 ======================================= 82 84
+6 -1
Documentation/gpu/amdgpu/gc/index.rst
··· 38 38 GFX/compute engine. 39 39 40 40 MES (MicroEngine Scheduler) 41 - This is the engine for managing queues. 41 + This is the engine for managing queues. For more details check 42 + :ref:`MicroEngine Scheduler (MES) <amdgpu-mes>`. 42 43 43 44 RLC (RunList Controller) 44 45 This is another microcontroller in the GFX/Compute engine. It handles 45 46 power management related functionality within the GFX/Compute engine. 46 47 The name is a vestige of old hardware where it was originally added 47 48 and doesn't really have much relation to what the engine does now. 49 + 50 + .. toctree:: 51 + 52 + mes.rst
+38
Documentation/gpu/amdgpu/gc/mes.rst
··· 1 + .. _amdgpu-mes: 2 + 3 + ============================= 4 + MicroEngine Scheduler (MES) 5 + ============================= 6 + 7 + .. note:: 8 + Queue and ring buffer are used as a synonymous. 9 + 10 + .. note:: 11 + This section assumes that you are familiar with the concept of Pipes, Queues, and GC. 12 + If not, check :ref:`GFX, Compute, and SDMA Overall Behavior<pipes-and-queues-description>` 13 + and :ref:`drm/amdgpu - Graphics and Compute (GC) <amdgpu-gc>`. 14 + 15 + Every GFX has a pipe component with one or more hardware queues. Pipes can 16 + switch between queues depending on certain conditions, and one of the 17 + components that can request a queue switch to a pipe is the MicroEngine 18 + Scheduler (MES). Whenever the driver is initialized, it creates one MQD per 19 + hardware queue, and then the MQDs are handed to the MES firmware for mapping 20 + to: 21 + 22 + 1. Kernel Queues (legacy): This queue is statically mapped to HQDs and never 23 + preempted. Even though this is a legacy feature, it is the current default, and 24 + most existing hardware supports it. When an application submits work to the 25 + kernel driver, it submits all of the application command buffers to the kernel 26 + queues. The CS IOCTL takes the command buffer from the applications and 27 + schedules them on the kernel queue. 28 + 29 + 2. User Queues: These queues are dynamically mapped to the HQDs. Regarding the 30 + utilization of User Queues, the userspace application will create its user 31 + queues and submit work directly to its user queues with no need to IOCTL for 32 + each submission and no need to share a single kernel queue. 33 + 34 + In terms of User Queues, MES can dynamically map them to the HQD. If there are 35 + more MQDs than HQDs, the MES firmware will preempt other user queues to make 36 + sure each queues get a time slice; in other words, MES is a microcontroller 37 + that handles the mapping and unmapping of MQDs into HQDs, as well as the 38 + priorities and oversubscription of MQDs.