aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrinivasan Shanmugam <[email protected]>2025-02-07 09:30:03 +0000
committerAlex Deucher <[email protected]>2025-02-13 02:05:49 +0000
commitbe2560e4b8288e9a8794cfa5db32614ce61a0068 (patch)
tree35b0e856b9435f51f274ce2f0ce2c403433199f9
parentdrm/amd/amdgpu: add support for IP version 11.5.2 (diff)
downloadkernel-be2560e4b8288e9a8794cfa5db32614ce61a0068.tar.gz
kernel-be2560e4b8288e9a8794cfa5db32614ce61a0068.zip
drm/amdgpu/mes: Add cleaner shader fence address handling in MES for GFX11
This commit introduces enhancements to the handling of the cleaner shader fence in the AMDGPU MES driver: - The MES (Microcode Execution Scheduler) now sends a PM4 packet to the KIQ (Kernel Interface Queue) to request the cleaner shader, ensuring that requests are handled in a controlled manner and avoiding the race conditions. - The CP (Compute Processor) firmware has been updated to use a private bus for accessing specific registers, avoiding unnecessary operations that could lead to issues in VF (Virtual Function) mode. - The cleaner shader fence memory address is now set correctly in the `mes_set_hw_res_pkt` structure, allowing for proper synchronization of the cleaner shader execution. Cc: lin cao <[email protected]> Cc: Jingwen Chen <[email protected]> Cc: Christian König <[email protected]> Cc: Alex Deucher <[email protected]> Suggested-by: Shaoyun Liu <[email protected]> Reviewed by: Shaoyun.liu <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Srinivasan Shanmugam <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/mes_v11_0.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
index 84cd846ec741..2549ea65e1b9 100644
--- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
@@ -732,7 +732,9 @@ static int mes_v11_0_set_hw_resources(struct amdgpu_mes *mes)
static int mes_v11_0_set_hw_resources_1(struct amdgpu_mes *mes)
{
- int size = 128 * AMDGPU_GPU_PAGE_SIZE;
+ unsigned int hw_rsrc_size = 128 * AMDGPU_GPU_PAGE_SIZE;
+ /* add a page for the cleaner shader fence */
+ unsigned int alloc_size = hw_rsrc_size + AMDGPU_GPU_PAGE_SIZE;
int ret = 0;
struct amdgpu_device *adev = mes->adev;
union MESAPI_SET_HW_RESOURCES_1 mes_set_hw_res_pkt;
@@ -743,7 +745,7 @@ static int mes_v11_0_set_hw_resources_1(struct amdgpu_mes *mes)
mes_set_hw_res_pkt.header.dwsize = API_FRAME_SIZE_IN_DWORDS;
mes_set_hw_res_pkt.enable_mes_info_ctx = 1;
- ret = amdgpu_bo_create_kernel(adev, size, PAGE_SIZE,
+ ret = amdgpu_bo_create_kernel(adev, alloc_size, PAGE_SIZE,
AMDGPU_GEM_DOMAIN_VRAM,
&mes->resource_1,
&mes->resource_1_gpu_addr,
@@ -754,7 +756,10 @@ static int mes_v11_0_set_hw_resources_1(struct amdgpu_mes *mes)
}
mes_set_hw_res_pkt.mes_info_ctx_mc_addr = mes->resource_1_gpu_addr;
- mes_set_hw_res_pkt.mes_info_ctx_size = mes->resource_1->tbo.base.size;
+ mes_set_hw_res_pkt.mes_info_ctx_size = hw_rsrc_size;
+ mes_set_hw_res_pkt.cleaner_shader_fence_mc_addr =
+ mes->resource_1_gpu_addr + hw_rsrc_size;
+
return mes_v11_0_submit_pkt_and_poll_completion(mes,
&mes_set_hw_res_pkt, sizeof(mes_set_hw_res_pkt),
offsetof(union MESAPI_SET_HW_RESOURCES_1, api_status));
@@ -1621,7 +1626,8 @@ static int mes_v11_0_hw_init(struct amdgpu_ip_block *ip_block)
if (r)
goto failure;
- if (amdgpu_sriov_is_mes_info_enable(adev)) {
+ if (amdgpu_sriov_is_mes_info_enable(adev) ||
+ adev->gfx.enable_cleaner_shader) {
r = mes_v11_0_set_hw_resources_1(&adev->mes);
if (r) {
DRM_ERROR("failed mes_v11_0_set_hw_resources_1, r=%d\n", r);
@@ -1654,10 +1660,13 @@ failure:
static int mes_v11_0_hw_fini(struct amdgpu_ip_block *ip_block)
{
struct amdgpu_device *adev = ip_block->adev;
- if (amdgpu_sriov_is_mes_info_enable(adev)) {
+
+ if (amdgpu_sriov_is_mes_info_enable(adev) ||
+ adev->gfx.enable_cleaner_shader) {
amdgpu_bo_free_kernel(&adev->mes.resource_1, &adev->mes.resource_1_gpu_addr,
- &adev->mes.resource_1_addr);
+ &adev->mes.resource_1_addr);
}
+
return 0;
}