<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c, branch v6.14</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.14</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.14'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2025-02-25T17:23:48Z</updated>
<entry>
<title>drm/amdgpu/mes: keep enforce isolation up to date</title>
<updated>2025-02-25T17:23:48Z</updated>
<author>
<name>Alex Deucher</name>
<email>alexander.deucher@amd.com</email>
</author>
<published>2025-02-14T17:32:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=748a1f51bb74453f1fe22d3ca68a717cb31f02e5'/>
<id>urn:sha1:748a1f51bb74453f1fe22d3ca68a717cb31f02e5</id>
<content type='text'>
Re-send the mes message on resume to make sure the
mes state is up to date.

Fixes: 8521e3c5f058 ("drm/amd/amdgpu: limit single process inside MES")
Acked-by: Srinivasan Shanmugam &lt;srinivasan.shanmugam@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Cc: Shaoyun Liu &lt;shaoyun.liu@amd.com&gt;
Cc: Srinivasan Shanmugam &lt;srinivasan.shanmugam@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
(cherry picked from commit 27b791514789844e80da990c456c2465325e0851)
</content>
</entry>
<entry>
<title>drm/amd: Add the capability to mark certain firmware as "required"</title>
<updated>2024-12-10T15:26:51Z</updated>
<author>
<name>Mario Limonciello</name>
<email>mario.limonciello@amd.com</email>
</author>
<published>2024-12-03T17:28:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ea5d49349894a7a74ce8dba242e3a487d24b6c0e'/>
<id>urn:sha1:ea5d49349894a7a74ce8dba242e3a487d24b6c0e</id>
<content type='text'>
Some of the firmware that is loaded by amdgpu is not actually required.
For example the ISP firmware on some SoCs is optional, and if it's not
present the ISP IP block just won't be initialized.

The firmware loader core however will show a warning when this happens
like this:
```
Direct firmware load for amdgpu/isp_4_1_0.bin failed with error -2
```

To avoid confusion for non-required firmware, adjust the amd-ucode helper
to take an extra argument indicating if the firmware is required or
optional.

On optional firmware use firmware_request_nowarn() instead of
request_firmware() to avoid the warnings.

Reviewed-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Link: https://lore.kernel.org/amd-gfx/df71d375-7abd-4b32-97ce-15e57846eed8@amd.com/T/#t
Signed-off-by: Mario Limonciello &lt;mario.limonciello@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amd/amdgpu: limit single process inside MES</title>
<updated>2024-11-12T22:02:04Z</updated>
<author>
<name>Shaoyun Liu</name>
<email>shaoyun.liu@amd.com</email>
</author>
<published>2024-10-23T15:12:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8521e3c5f0585cad3e73e4ba73535dc274e7eba6'/>
<id>urn:sha1:8521e3c5f0585cad3e73e4ba73535dc274e7eba6</id>
<content type='text'>
This is for MES to limit only one process for the user queues

Signed-off-by: Shaoyun Liu &lt;shaoyun.liu@amd.com&gt;
Reviewed-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amd/amdgpu: Increase MES log buffer to dump mes scratch data</title>
<updated>2024-11-11T16:55:49Z</updated>
<author>
<name>shaoyunl</name>
<email>shaoyun.liu@amd.com</email>
</author>
<published>2024-10-17T14:35:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=92fd1714ee3cef8ad9c466ced354ab0581ee3782'/>
<id>urn:sha1:92fd1714ee3cef8ad9c466ced354ab0581ee3782</id>
<content type='text'>
MES internal scratch data is useful for mes debug, it can only located
in VRAM, change the allocation type and increase size for mes 11

Signed-off-by: shaoyunl &lt;shaoyun.liu@amd.com&gt;
Acked-by: Feifei Xu &lt;Feifei.Xu@amd.com&gt;
Acked-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amdgpu: fix return random value when multiple threads read registers via mes.</title>
<updated>2024-11-08T16:07:50Z</updated>
<author>
<name>chongli2</name>
<email>chongli2@amd.com</email>
</author>
<published>2024-11-06T03:43:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f4a3246a2c7a595161f1ba11db53639b7f580104'/>
<id>urn:sha1:f4a3246a2c7a595161f1ba11db53639b7f580104</id>
<content type='text'>
The currect code use the address "adev-&gt;mes.read_val_ptr" to
store the value read from register via mes.
So when multiple threads read register,
multiple threads have to share the one address,
and overwrite the value each other.

Assign an address by "amdgpu_device_wb_get" to store register value.
each thread will has an address to store register value.

Signed-off-by: chongli2 &lt;chongli2@amd.com&gt;
Reviewed-by: Emily Deng &lt;Emily.Deng@amd.com&gt;
Reviewed-by: Christian König &lt;christian.koenig@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amdgpu/mes: fetch fw version from firmware header</title>
<updated>2024-11-05T15:33:39Z</updated>
<author>
<name>Alex Deucher</name>
<email>alexander.deucher@amd.com</email>
</author>
<published>2024-10-31T02:54:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e89bd3615bc0883adc90209c1aac6d4bac7d221f'/>
<id>urn:sha1:e89bd3615bc0883adc90209c1aac6d4bac7d221f</id>
<content type='text'>
We need this prior to the firmware being loaded so fetch
from the header.

v2: fetch directly from the firmware
v3: store both fw versions

Reviewed-by: Srinivasan Shanmugam &lt;srinivasan.shanmugam@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amd/amdgpu: Fix double unlock in amdgpu_mes_add_ring</title>
<updated>2024-10-15T15:21:31Z</updated>
<author>
<name>Srinivasan Shanmugam</name>
<email>srinivasan.shanmugam@amd.com</email>
</author>
<published>2024-10-08T13:31:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bfaf1883605fd0c0dbabacd67ed49708470d5ea4'/>
<id>urn:sha1:bfaf1883605fd0c0dbabacd67ed49708470d5ea4</id>
<content type='text'>
This patch addresses a double unlock issue in the amdgpu_mes_add_ring
function. The mutex was being unlocked twice under certain error
conditions, which could lead to undefined behavior.

The fix ensures that the mutex is unlocked only once before jumping to
the clean_up_memory label. The unlock operation is moved to just before
the goto statement within the conditional block that checks the return
value of amdgpu_ring_init. This prevents the second unlock attempt after
the clean_up_memory label, which is no longer necessary as the mutex is
already unlocked by this point in the code flow.

This change resolves the potential double unlock and maintains the
correct mutex handling throughout the function.

Fixes below:
Commit d0c423b64765 ("drm/amdgpu/mes: use ring for kernel queue
submission"), leads to the following Smatch static checker warning:

	drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c:1240 amdgpu_mes_add_ring()
	warn: double unlock '&amp;adev-&gt;mes.mutex_hidden' (orig line 1213)

drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
    1143 int amdgpu_mes_add_ring(struct amdgpu_device *adev, int gang_id,
    1144                         int queue_type, int idx,
    1145                         struct amdgpu_mes_ctx_data *ctx_data,
    1146                         struct amdgpu_ring **out)
    1147 {
    1148         struct amdgpu_ring *ring;
    1149         struct amdgpu_mes_gang *gang;
    1150         struct amdgpu_mes_queue_properties qprops = {0};
    1151         int r, queue_id, pasid;
    1152
    1153         /*
    1154          * Avoid taking any other locks under MES lock to avoid circular
    1155          * lock dependencies.
    1156          */
    1157         amdgpu_mes_lock(&amp;adev-&gt;mes);
    1158         gang = idr_find(&amp;adev-&gt;mes.gang_id_idr, gang_id);
    1159         if (!gang) {
    1160                 DRM_ERROR("gang id %d doesn't exist\n", gang_id);
    1161                 amdgpu_mes_unlock(&amp;adev-&gt;mes);
    1162                 return -EINVAL;
    1163         }
    1164         pasid = gang-&gt;process-&gt;pasid;
    1165
    1166         ring = kzalloc(sizeof(struct amdgpu_ring), GFP_KERNEL);
    1167         if (!ring) {
    1168                 amdgpu_mes_unlock(&amp;adev-&gt;mes);
    1169                 return -ENOMEM;
    1170         }
    1171
    1172         ring-&gt;ring_obj = NULL;
    1173         ring-&gt;use_doorbell = true;
    1174         ring-&gt;is_mes_queue = true;
    1175         ring-&gt;mes_ctx = ctx_data;
    1176         ring-&gt;idx = idx;
    1177         ring-&gt;no_scheduler = true;
    1178
    1179         if (queue_type == AMDGPU_RING_TYPE_COMPUTE) {
    1180                 int offset = offsetof(struct amdgpu_mes_ctx_meta_data,
    1181                                       compute[ring-&gt;idx].mec_hpd);
    1182                 ring-&gt;eop_gpu_addr =
    1183                         amdgpu_mes_ctx_get_offs_gpu_addr(ring, offset);
    1184         }
    1185
    1186         switch (queue_type) {
    1187         case AMDGPU_RING_TYPE_GFX:
    1188                 ring-&gt;funcs = adev-&gt;gfx.gfx_ring[0].funcs;
    1189                 ring-&gt;me = adev-&gt;gfx.gfx_ring[0].me;
    1190                 ring-&gt;pipe = adev-&gt;gfx.gfx_ring[0].pipe;
    1191                 break;
    1192         case AMDGPU_RING_TYPE_COMPUTE:
    1193                 ring-&gt;funcs = adev-&gt;gfx.compute_ring[0].funcs;
    1194                 ring-&gt;me = adev-&gt;gfx.compute_ring[0].me;
    1195                 ring-&gt;pipe = adev-&gt;gfx.compute_ring[0].pipe;
    1196                 break;
    1197         case AMDGPU_RING_TYPE_SDMA:
    1198                 ring-&gt;funcs = adev-&gt;sdma.instance[0].ring.funcs;
    1199                 break;
    1200         default:
    1201                 BUG();
    1202         }
    1203
    1204         r = amdgpu_ring_init(adev, ring, 1024, NULL, 0,
    1205                              AMDGPU_RING_PRIO_DEFAULT, NULL);
    1206         if (r)
    1207                 goto clean_up_memory;
    1208
    1209         amdgpu_mes_ring_to_queue_props(adev, ring, &amp;qprops);
    1210
    1211         dma_fence_wait(gang-&gt;process-&gt;vm-&gt;last_update, false);
    1212         dma_fence_wait(ctx_data-&gt;meta_data_va-&gt;last_pt_update, false);
    1213         amdgpu_mes_unlock(&amp;adev-&gt;mes);
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    1214
    1215         r = amdgpu_mes_add_hw_queue(adev, gang_id, &amp;qprops, &amp;queue_id);
    1216         if (r)
    1217                 goto clean_up_ring;
                         ^^^^^^^^^^^^^^^^^^

    1218
    1219         ring-&gt;hw_queue_id = queue_id;
    1220         ring-&gt;doorbell_index = qprops.doorbell_off;
    1221
    1222         if (queue_type == AMDGPU_RING_TYPE_GFX)
    1223                 sprintf(ring-&gt;name, "gfx_%d.%d.%d", pasid, gang_id, queue_id);
    1224         else if (queue_type == AMDGPU_RING_TYPE_COMPUTE)
    1225                 sprintf(ring-&gt;name, "compute_%d.%d.%d", pasid, gang_id,
    1226                         queue_id);
    1227         else if (queue_type == AMDGPU_RING_TYPE_SDMA)
    1228                 sprintf(ring-&gt;name, "sdma_%d.%d.%d", pasid, gang_id,
    1229                         queue_id);
    1230         else
    1231                 BUG();
    1232
    1233         *out = ring;
    1234         return 0;
    1235
    1236 clean_up_ring:
    1237         amdgpu_ring_fini(ring);
    1238 clean_up_memory:
    1239         kfree(ring);
--&gt; 1240         amdgpu_mes_unlock(&amp;adev-&gt;mes);
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    1241         return r;
    1242 }

Fixes: d0c423b64765 ("drm/amdgpu/mes: use ring for kernel queue submission")
Cc: Christian König &lt;christian.koenig@amd.com&gt;
Cc: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Cc: Hawking Zhang &lt;Hawking.Zhang@amd.com&gt;
Suggested-by: Jack Xiao &lt;Jack.Xiao@amd.com&gt;
Reported by: Dan Carpenter &lt;dan.carpenter@linaro.org&gt;
Signed-off-by: Srinivasan Shanmugam &lt;srinivasan.shanmugam@amd.com&gt;
Reviewed-by: Jack Xiao &lt;Jack.Xiao@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amdgpu/mes11: update mes_reset_queue function to support sdma queue</title>
<updated>2024-09-26T21:06:16Z</updated>
<author>
<name>Jiadong Zhu</name>
<email>Jiadong.Zhu@amd.com</email>
</author>
<published>2024-09-09T06:19:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ced65debf4d8d17cba2a631392f29a0b3b006303'/>
<id>urn:sha1:ced65debf4d8d17cba2a631392f29a0b3b006303</id>
<content type='text'>
Reset sdma queue through mmio based on me_id and queue_id.

v2: simplify callflows and register calculation.

Signed-off-by: Jiadong Zhu &lt;Jiadong.Zhu@amd.com&gt;
Reviewed-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amdgpu: fix queue reset issue by mmio</title>
<updated>2024-09-06T21:54:54Z</updated>
<author>
<name>Jesse Zhang</name>
<email>jesse.zhang@amd.com</email>
</author>
<published>2024-09-04T09:47:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e8397d327e7b0d6132197c9d8fd7977f84f3dbd9'/>
<id>urn:sha1:e8397d327e7b0d6132197c9d8fd7977f84f3dbd9</id>
<content type='text'>
Initialize the queue type before resetting the queue using mmio.

Signed-off-by: Jesse Zhang &lt;jesse.zhang@amd.com&gt;
Acked-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
<entry>
<title>drm/amdgpu/mes: implement amdgpu_mes_reset_hw_queue_mmio</title>
<updated>2024-09-02T15:41:07Z</updated>
<author>
<name>Jiadong Zhu</name>
<email>Jiadong.Zhu@amd.com</email>
</author>
<published>2024-07-04T04:26:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=01b4ae38e5dc6798c6cd477be9c363c5ae45fa7f'/>
<id>urn:sha1:01b4ae38e5dc6798c6cd477be9c363c5ae45fa7f</id>
<content type='text'>
The reset_queue api could be used from kfd or kgd.

v2: add use_mmio parameter for mes_reset_legacy_queue.

Acked-by: Vitaly Prosyak &lt;vitaly.prosyak@amd.com&gt;
Signed-off-by: Jiadong Zhu &lt;Jiadong.Zhu@amd.com&gt;
Reviewed-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
</feed>
