[PATCH] drm/amdkfd: Use gpu_offset for user queue's wptr

2023-09-14 Thread YuBiao Wang
Directly use tbo's start address will miss the domain start offset. Need to use gpu_offset instead. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdkfd

[PATCH] drm/amdgpu: Forbid kfd using cpu to update pt if vm is shared with gfx

2023-06-21 Thread YuBiao Wang
If a same GPU VM is shared by kfd and graphic operations, we must align the vm update mode to sdma, or cpu kmap will fail and cause null pointer issue. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/gpu

[PATCH] drm/amdgpu: set default num_kcq to 2 under sriov

2023-05-05 Thread YuBiao Wang
The number of kernel queues has impact on the latency under sriov usecase. So to reduce the latency we set the default num_kcq = 2 under sriov if not set manually. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git

[PATCH] drm/amdgpu: Enable mcbp under sriov by default

2023-04-28 Thread YuBiao Wang
Enable mcbp under sriov by default. Asics with soc21 supports mcbp now so we should set it enabled. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers

[PATCH] drm/amdgpu: use sdma_v6 single packet invalidation

2023-04-11 Thread YuBiao Wang
From: Pierre-Eric Pelloux-Prayer Send this patch on behalf of Pierre-Eric. This achieves the same result as the sequence used in emit_flush_gpu_tlb but the invalidation is now a single packet instead of the 3 packets required to implement reg_write_reg_wait. Signed-off-by: Pierre-Eric

[PATCH v2] drm/amdgpu: Force signal hw_fences that are embedded in non-sched jobs

2023-03-08 Thread YuBiao Wang
the non_sched bad job's fence during pre_asic_reset or the clear is not complete. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c index

[PATCH] drm/amdgpu: Force signal hw_fences that are embedded in non-sched jobs

2023-03-06 Thread YuBiao Wang
or the clear is not complete. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c index faff4a3f96e6..2e549bd50990 100644

[PATCH] drm/amdgpu: Add nv mailbox irq in soc21

2022-11-30 Thread YuBiao Wang
Under virtualization guest needs to receive notification from host to perform reset in some cases. Add nv mailbox irq in soc21. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/soc21.c | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/gpu

[PATCH] drm/amdgpu: Stop clearing kiq position during unload

2022-11-10 Thread YuBiao Wang
Do not clear kiq position in RLC_CP_SCHEDULER so that CP could perform IDLE-SAVE after VF fini. CPG also needs to be active in save command. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 14 ++ drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 4 +++- 2 files

[PATCH] drm/amdgpu: Disable GFX RAS feature for SRIOV case

2022-11-02 Thread YuBiao Wang
In sriov guest side doesn't need init ras feature, so skip it. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c index

[PATCH] drm/amdgpu: skip mes self test for gc 11.0.3 in recover

2022-10-18 Thread YuBiao Wang
Temporary disable mes self teset for gc 11.0.3 during gpu_recovery. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu

[PATCH v3] drm/amdgpu: dequeue mes scheduler during fini

2022-10-17 Thread YuBiao Wang
kiq_hw_fini. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 42 -- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c index 1174dcc88db5..b477bed40d61

[PATCH v3] drm/amdgpu: dequeue mes scheduler during fini

2022-10-13 Thread YuBiao Wang
and before kiq fini. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 3 ++ drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 3 ++ drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 41 +++-- 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/drivers/gpu

[PATCH v2] drm/amdgpu: dequeue mes scheduler during fini

2022-10-13 Thread YuBiao Wang
. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 3 ++ drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 3 ++ drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 47 +++-- 3 files changed, 50 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu

[PATCH] drm/amdgpu: dequeue mes scheduler during fini

2022-10-13 Thread YuBiao Wang
[Why] If mes is not dequeued during fini, mes will be in an uncleaned state during reload, then mes couldn't receive some commands which leads to reload failure. [How] Perform MES dequeue via MMIO after all the unmap jobs are done by mes and before kiq fini. Signed-off-by: YuBiao Wang

[PATCH] drm/amdgpu: Fix use-after-free in amdgpu_cs_ioctl

2022-08-25 Thread YuBiao Wang
Hello, This patch is reviewed by Andrey and Christian and pushed into bringup temp branch. It need to be cherry-picked to drm-next, too. Does anyone has any comments on this patch? Thanks, Yubiao Wang [Why] In amdgpu_cs_ioctl, amdgpu_job_free could be performed ealier if there is -ERESTARTSYS

[PATCH] drm/amd/amdgpu: Fix csb.bo pin_count leak on gfx 9

2021-11-04 Thread YuBiao Wang
[Why] csb bo is not unpinned in gfx 9. It will lead to pin_count leak on driver unload. [How] Call bo_free_kernel corresponding to bo_create_kernel in gfx_rlc_init_csb. This will also unify the code path with other gfx versions. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu

[PATCH v2] drm/amd/amdgpu: Avoid writing GMC registers under sriov in gmc9

2021-11-03 Thread YuBiao Wang
[Why] For Vega10, disabling gart of gfxhub could mess up KIQ and PSP under sriov mode, and lead to DMAR on host side. [How] Skip writing GMC registers under sriov. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 26 +--- 1 file changed, 14

[PATCH] drm/amd/amdgpu: Avoid writing GMC registers under sriov in gmc9

2021-11-03 Thread YuBiao Wang
[Why] For Vega10, disabling gart of gfxhub and mmhub could mess up KIQ and PSP under sriov mode, and lead to DMAR on host side. [How] Skip writing GMC registers under sriov. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 26 +--- 1 file changed

[PATCH] drm/amd/amdgpu: Avoid writing GMC registers under sriov in gmc9

2021-11-02 Thread YuBiao Wang
[Why] For Vega10, disabling gart of gfxhub and mmhub could mess up KIQ and PSP under sriov mode, and lead to DMAR on host side. [How] Do not call gmc_gart_disable under sriov but keep vram_unpin to avoid pin_count leak. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 4

[PATCH] drm/amd/amdgpu: Do irq_fini_hw after ip_fini_early

2021-09-29 Thread YuBiao Wang
Some IP such as SMU need irq_put to perform hw_fini. So move irq_fini_hw after ip_fini. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm

[PATCH] drm/amd/amdgpu: Add ready_to_reset resp for vega10

2021-08-27 Thread YuBiao Wang
Send response to host after received the flr notification from host. Port NV change to vega10. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c | 2 ++ drivers/gpu/drm/amd/amdgpu/mxgpu_ai.h | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu

[PATCH] drm/amd/amdgpu:flush ttm delayed work before cancel_sync

2021-08-17 Thread YuBiao Wang
[Why] In some cases when we unload driver, warning call trace will show up in vram_mgr_fini which claims that LRU is not empty, caused by the ttm bo inside delay deleted queue. [How] We should flush delayed work to make sure the delay deleting is done. Signed-off-by: YuBiao Wang --- drivers

[PATCH] drm/amd/amdgpu: skip locking delayed work if not initialized.

2021-08-04 Thread YuBiao Wang
When init failed in early init stage, amdgpu_object has not been initialized, so hasn't the ttm delayed queue functions. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu

[PATCH 1/1] drm/amdgpu: Read clock counter via MMIO to reduce delay (v5)

2021-07-01 Thread YuBiao Wang
carryover happens. v5: Remove mutex and gfxoff ctrl unused with current timing registers. Signed-off-by: YuBiao Wang Acked-by: Horace Chen --- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 19 --- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu

[PATCH 1/1] drm/amdgpu: Read clock counter via MMIO to reduce delay (v4)

2021-06-30 Thread YuBiao Wang
carryover happens. Signed-off-by: YuBiao Wang Acked-by: Horace Chen --- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c index ff7e9f49040e

[PATCH 1/1] drm/amdgpu: Read clock counter via MMIO to reduce delay

2021-06-29 Thread YuBiao Wang
[Why] GPU timing counters are read via KIQ under sriov, which will introduce a delay. [How] It could be directly read by MMIO. v2: Add additional check to prevent carryover issue. v3: Only check for carryover for once to prevent performance issue. Signed-off-by: YuBiao Wang Acked-by: Horace

[PATCH 1/1] drm/amdgpu: Read clock counter via MMIO to reduce delay

2021-06-29 Thread YuBiao Wang
[Why] GPU timing counters are read via KIQ under sriov, which will introduce a delay. [How] It could be directly read by MMIO. v2: Add additional check to prevent carryover issue. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 13 +++-- 1 file changed, 11

[PATCH] drm/amdgpu: reset psp ring wptr during ring_create

2021-06-09 Thread YuBiao Wang
[Why] psp ring wptr is not initialized properly in ring_create, which would lead to psp failure after several gpu reset. [How] Set ring_wptr to zero in psp_ring_create. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 1 + drivers/gpu/drm/amd/amdgpu/psp_v3_1.c | 1 + 2

[PATCH] drm/amd/amdgpu: psp program IH_RB_CTRL on sienna_cichlid

2021-05-13 Thread YuBiao Wang
[Why] IH_RB_CNTL is blocked by PSP so we need to ask psp to help config it. [How] Move psp ip block before ih, and use psp to program IH_RB_CNTL under sriov. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 20 ++-- drivers/gpu/drm/amd/amdgpu/nv.c

[PATCH] drm/amd/amdgpu: psp program IH_RB_CTRL on navi12 and sienna_cichlid

2021-05-11 Thread YuBiao Wang
[Why] IH_RB_CNTL is blocked by PSP so we need to ask psp to help config it. [How] Move psp ip block before ih, and use psp to program IH_RB_CNTL under sriov. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 20 ++-- drivers/gpu/drm/amd/amdgpu/nv.c

[PATCH] drm/amd/amdgpu: psp program IH_RB_CTRL on navi12 and navi21

2021-05-11 Thread YuBiao Wang
[Why] IH_RB_CNTL is blocked by PSP so we need to ask psp to help config it. [How] Move psp ip block before ih, and use psp to program IH_RB_CNTL under sriov. Signed-off-by: YuBiao Wang --- drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 20 ++-- drivers/gpu/drm/amd/amdgpu/nv.c