[PATCH] drm/amdgpu/mes12: mes hw_fini fix for mode1 reset

2024-05-21 Thread Jack Xiao
Port mes11 hw_fini to mes12, fix for mode1 reset. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c index 45b70a4c4ada

[PATCH] drm/amdgpu/mes: fix mes12 to map legacy queue

2024-05-09 Thread Jack Xiao
Adjust mes12 initialization sequence to fix mapping legacy queue. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 71 - drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 10 ++-- 2 files changed, 53 insertions(+), 28 deletions(-) diff --git a/drivers/gpu

[PATCH] drm/amdgpu/mes11: fix kiq ring ready flag

2024-04-30 Thread Jack Xiao
kiq ring test has overwitten ready flag, need disable after gfx hw init. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c

[PATCH] drm/amdgpu/mes11: increase waiting time for engine ready

2024-04-29 Thread Jack Xiao
mes schq engine require more waiting time for engine ready before packet submission. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu

[PATCH 5/5] drm/amdgpu/gfx: enable mes to map legacy queue support

2024-04-25 Thread Jack Xiao
Enable mes to map legacy queue support. Signed-off-by: Jack Xiao Reviewed-by: Hawking Zhang --- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 39 + 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd

[PATCH 4/5] drm/amdgpu/mes11: adjust mes initialization sequence

2024-04-25 Thread Jack Xiao
Adjust mes queue initialization before kgq/kcq initialization to enable mes mapping legacy queue. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu

[PATCH 2/5] drm/amdgpu/mes11: update ADD_QUEUE interface

2024-04-25 Thread Jack Xiao
Update ADD_QUEUE interface for mes11 to support mes mapping legacy queue. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/include/mes_v11_api_def.h | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/include/mes_v11_api_def.h b/drivers

[PATCH 3/5] drm/amdgpu/mes11: add mes mapping legacy queue support

2024-04-25 Thread Jack Xiao
Add mes11 map legacy queue packet submission. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 26 ++ 1 file changed, 26 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c index 0d1407f25005

[PATCH 0/5] enable mes to map kgq/kcq

2024-04-25 Thread Jack Xiao
Jack Xiao (5): drm/amdgpu/mes: add mes mapping legacy queue support drm/amdgpu/mes11: update ADD_QUEUE interface drm/amdgpu/mes11: add mes mapping legacy queue support drm/amdgpu/mes11: adjust mes initialization sequence drm/amdgpu/gfx: enable mes to map legacy queue support drivers

[PATCH 1/5] drm/amdgpu/mes: add mes mapping legacy queue support

2024-04-25 Thread Jack Xiao
Add mes mapping legacy queue framework support. Signed-off-by: Jack Xiao Reviewed-by: Hawking Zhang --- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 22 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 14 ++ 2 files changed, 36 insertions(+) diff --git a/drivers/gpu

[PATCH v2] drm/amdgpu/mes: fix use-after-free issue

2024-04-22 Thread Jack Xiao
Delete fence fallback timer to fix the ramdom use-after-free issue. v2: move to amdgpu_mes.c Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu

[PATCH] drm/amdgpu: fix use-after-free issue

2024-04-22 Thread Jack Xiao
Delete fence fallback timer to fix the ramdom use-after-free issue. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c index 06f0a6534a94

[PATCH v2] drm/amdgpu/gfx11: need acquire mutex before access CP_VMID_RESET v2

2023-12-21 Thread Jack Xiao
It's required to take the gfx mutex before access to CP_VMID_RESET, for there is a race condition with CP firmware to write the register. v2: add extra code to ensure the mutex releasing is successful. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 48

[PATCH] drm/amdgpu/gfx11: need acquire mutex before access CP_VMID_RESET

2023-12-19 Thread Jack Xiao
It's required to take the gfx mutex before access to CP_VMID_RESET, for there is a race condition with CP firmware to write the register. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 20 1 file changed, 20 insertions(+) diff --git a/drivers/gpu/drm

[PATCH] drm/amdgpu: fix S3 issue if MQD in VRAM

2023-05-17 Thread Jack Xiao
1. Need flush HDP for MQD putting in vram 2. Zero out mes MQD Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 4 drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 3 +++ drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 3 +++ 3 files changed, 10 insertions(+) diff --git a/drivers

[PATCH] drm/amdgpu: fix S3 issue if MQD in VRAM

2023-05-12 Thread Jack Xiao
Make the preemption optimization effect only for SRIOV, for it caused failure to resume from S3. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 3 ++- drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 7 +-- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 7 +-- 3 files

[PATCH] drm/amdgpu: fix memory leak in mes self test

2023-04-21 Thread Jack Xiao
The fences associated with mes queue have to be freed up during amdgpu_ring_fini. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c

[PATCH] drm/amd/amdgpu: introduce gc_*_mes_2.bin

2023-03-29 Thread Jack Xiao
To avoid new mes fw running with old driver, rename mes schq fw to gc_*_mes_2.bin. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 26 + 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b

[PATCH] drm/amd/amdgpu: fix warining during suspend

2023-02-13 Thread Jack Xiao
Freeing memory was warned during suspend. Move the self test out of suspend. Link: https://bugzilla.redhat.com/show_bug.cgi?id=2151825 Cc: jfale...@redhat.com Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++ drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 2 +- 2

[PATCH] drm/amdgpu: only WARN freeing buffers when DMA is unavailable

2023-02-02 Thread Jack Xiao
Reduce waringings, only warn when DMA is unavailable. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index

[PATCH 1/2] drm/amd/amdgpu: update mes11 api def

2022-11-29 Thread Jack Xiao
Update the api def of mes11. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/include/mes_v11_api_def.h | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/include/mes_v11_api_def.h b/drivers/gpu/drm/amd/include/mes_v11_api_def.h index 7e85cdc5bd34

[PATCH 2/2] drm/amdgpu/mes11: enable reg active poll

2022-11-29 Thread Jack Xiao
Enable reg active poll in mes11. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c index 02ad84a1526a..a3e7062b7f77 100644 --- a/drivers/gpu/drm

[PATCH] drm/amd/amdgpu: reserve vm invalidation engine for firmware

2022-11-17 Thread Jack Xiao
If mes enabled, reserve VM invalidation engine 5 for firmware. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c index 4365ede42855

[PATCH 2/5] drm/amdgpu/mes11: initialize aggregated doorbell

2022-07-11 Thread Jack Xiao
Allocate and enable aggregated doorbell. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 58 +- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c index

[PATCH 4/5] drm/amdgpu/gfx11: add aggregated doorbell support

2022-07-11 Thread Jack Xiao
Port aggregated doorbell support to gfx11. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 82 ++ 1 file changed, 71 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c index

[PATCH 5/5] drm/amdgpu/sdma6: add aggregated doorbell support

2022-07-11 Thread Jack Xiao
Port aggregated doorbell support to sdma6. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c | 80 ++ 1 file changed, 57 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c index

[PATCH 3/5] drm/amdgpu/mes: ring aggregatged doorbell when mes queue is unmapped

2022-07-11 Thread Jack Xiao
From: Le Ma Ring aggregated doorbel to make unmapped queue scheduled in mes firmware. Signed-off-by: Le Ma --- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 7 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 3 + drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 82 +

[PATCH 1/5] drm/amdgpu/mes: init aggregated doorbell

2022-07-11 Thread Jack Xiao
From: Le Ma Allocate and enable aggregated doorbell. Signed-off-by: Le Ma --- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 16 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 2 +- drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 58 - 3 files changed, 70 insertions(+), 6

[PATCH 3/3] drm/amdgpu/mes: set correct mes ring ready flag

2022-07-08 Thread Jack Xiao
Set corresponding ready flag for mes ring when enable or disable mes ring. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 3 +++ drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c b

[PATCH 1/3] drm/amdgpu/mes: fix mes submission in atomic context

2022-07-08 Thread Jack Xiao
For some cases (accessing registers, unmap legacy queue), it needs access mes in atomic context. Use spinlock to protect agaist mes ring buffer race condition. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 16 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 1

[PATCH 2/3] drm/amdgpu/mes: fix bo va unmap issue in mes

2022-07-08 Thread Jack Xiao
Need reserve buffers before unmap mes ctx bo va. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 59 +++-- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 2 + 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu

[PATCH] drm/amdgpu/mes11: fix to unmap legacy queue

2022-07-05 Thread Jack Xiao
MES fw updated to support unmapping legacy gfx/compute queue. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c| 9 - drivers/gpu/drm/amd/include/mes_v11_api_def.h | 6 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd

[PATCH 7/7] Revert "drm/amdgpu/gmc11: avoid cpu accessing registers to flush VM"

2022-06-28 Thread Jack Xiao
This reverts commit 5af39cf2fbadbaac1a04c94a604b298a9a325670 since drv enabled mes to access registers. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 51 +- 1 file changed, 1 insertion(+), 50 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu

[PATCH 5/7] drm/amdgpu: enable mes to access registers v2

2022-06-28 Thread Jack Xiao
Enable mes to access registers. v2: squash mes sched ring enablement flag Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 8 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 6 ++ drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 2 +- drivers/gpu/drm/amd/amdgpu

[PATCH 6/7] drm/amdgpu/mes: add mes ring test

2022-06-28 Thread Jack Xiao
Use read/write register to test mes ring. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 36 + drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 1 + drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 6 + 3 files changed, 43 insertions(+) diff --git

[PATCH 4/7] drm/amdgpu/mes: add mes register access interface

2022-06-28 Thread Jack Xiao
Add mes register access routines: 1. read register 2. write register 3. wait register 4. write and wait register Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 132 +++- 1 file changed, 131 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm

[PATCH 3/7] drm/amdgpu/mes11: add mes11 misc op

2022-06-28 Thread Jack Xiao
Add misc op commands in mes11. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 53 ++ 1 file changed, 53 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c index d5200cbceb8a..e2aa1ebb3a00

[PATCH 1/7] drm/amdgpu/mes11: update mes interface for acessing registers

2022-06-28 Thread Jack Xiao
Update MES firmware api for accessing registers. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/include/mes_v11_api_def.h | 37 +-- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/amd/include/mes_v11_api_def.h b/drivers/gpu/drm/amd/include

[PATCH 2/7] drm/amdgpu: add common interface for mes misc op

2022-06-28 Thread Jack Xiao
Add common interface for mes misc op, including accessing register interface. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 46 + 1 file changed, 46 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h b/drivers/gpu/drm/amd/amdgpu

[PATCH] drm/amdgpu: add mc wptr addr support for mes

2022-06-24 Thread Jack Xiao
MES requires mc wptr address for usermode queues. Export bo gart address for mc wptr address. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 10 -- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 2 ++ drivers/gpu/drm/amd/amdgpu

[PATCH 2/4] drm/amdgpu: initialize the cpu/gpu address of rptr/wptr/fence

2020-07-28 Thread Jack Xiao
Initialize the cpu/gpu address of rptr/wptr/fence. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 37 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu

[PATCH 3/4] drm/amdgpu: use ring structure to access rptr/wptr v2

2020-07-28 Thread Jack Xiao
Use ring structure to access the cpu/gpu address of rptr/wptr. v2: merge gfx10/sdma5/sdma5.2 patches Signed-off-by: Jack Xiao Reviewed-by: Christian König Reviewed-by: Hawking Zhang --- drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 8 +++--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 37

[PATCH 4/4] drm/amdgpu: assign the cpu/gpu address of fence from ring

2020-07-28 Thread Jack Xiao
assign the cpu/gpu address of fence for the normal or mes ring from ring structure. Signed-off-by: Jack Xiao Reviewed-by: Hawking Zhang Acked-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu

[PATCH 1/4] drm/amdgpu: define ring structure to access rptr/wptr/fence

2020-07-28 Thread Jack Xiao
Define ring structure to access the cpu/gpu address of rptr/wptr/fence instead of dynamic calculation. Cc: Christian König Suggested-by: Christian König Signed-off-by: Jack Xiao Reviewed-by: Hawking Zhang Acked-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 6 ++ 1

[PATCH 1/2] drm/amdgpu/gfx10: fix race condition for kiq

2020-07-09 Thread Jack Xiao
During preemption test for gfx10, it uses kiq to trigger gfx preemption, which would result in race condition with flushing TLB for kiq. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu

[PATCH 2/2] drm/amdgpu: fix preemption unit test

2020-07-09 Thread Jack Xiao
Remove signaled jobs from job list and ensure the job was indeed preempted. Signed-off-by: Jack Xiao --- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 20 +++- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers