Skip to content

Commit 43c8546

Browse files
Andrey Grodzovskyalexdeucher
authored andcommitted
drm/amdgpu: Add a UAPI flag for user to call mem_sync
When this flag is set in the CS IB flags, it causes a memory cache flush of the GFX. v2: Move new flag to drm_amdgpu_cs_chunk_ib.flags Bump up UAPI version Remove condition on job != null to emit mem_sync Signed-off-by: Andrey Grodzovsky <[email protected]> Reviewed-by: Luben Tuikov <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent d35745b commit 43c8546

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@
8686
* - 3.35.0 - Add drm_amdgpu_info_device::tcc_disabled_mask
8787
* - 3.36.0 - Allow reading more status registers on si/cik
8888
* - 3.37.0 - L2 is invalidated before SDMA IBs, needed for correctness
89+
* - 3.38.0 - Add AMDGPU_IB_FLAG_EMIT_MEM_SYNC
8990
*/
9091
#define KMS_DRIVER_MAJOR 3
91-
#define KMS_DRIVER_MINOR 37
92+
#define KMS_DRIVER_MINOR 38
9293
#define KMS_DRIVER_PATCHLEVEL 0
9394

9495
int amdgpu_vram_limit = 0;

drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
189189
dma_fence_put(tmp);
190190
}
191191

192+
if ((ib->flags & AMDGPU_IB_FLAG_EMIT_MEM_SYNC) && ring->funcs->emit_mem_sync)
193+
ring->funcs->emit_mem_sync(ring);
194+
192195
if (ring->funcs->insert_start)
193196
ring->funcs->insert_start(ring);
194197

include/uapi/drm/amdgpu_drm.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,10 @@ union drm_amdgpu_cs {
602602
*/
603603
#define AMDGPU_IB_FLAGS_SECURE (1 << 5)
604604

605+
/* Tell KMD to flush and invalidate caches
606+
*/
607+
#define AMDGPU_IB_FLAG_EMIT_MEM_SYNC (1 << 6)
608+
605609
struct drm_amdgpu_cs_chunk_ib {
606610
__u32 _pad;
607611
/** AMDGPU_IB_FLAG_* */

0 commit comments

Comments
 (0)