From 2fb3c5d0d16192c926dbad5363867b31c8b8b2f8 Mon Sep 17 00:00:00 2001 From: Kevin Wang Date: Sun, 7 Feb 2021 21:09:59 +0800 Subject: drm/amdgpu: change psp_rap_invoke() function return value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RAP TA is an optional firmware. if it doesn’t exist, the driver should bypass psp_rap_invoke() function. 1. bypass psp_rap_invoke() when RAP TA is not loaded. 2. add new parameter (status) to query RAP TA status. (the status value is different with psp_ta_invoke(), 3. fix the 'rap_status' MThread critical problem. (used without lock) Signed-off-by: Kevin Wang Reviewed-by: Hawking Zhang Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c') diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c index 8da5356c36f1..51909bf8798c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c @@ -48,6 +48,7 @@ static ssize_t amdgpu_rap_debugfs_write(struct file *f, const char __user *buf, struct ta_rap_cmd_output_data *rap_cmd_output; struct drm_device *dev = adev_to_drm(adev); uint32_t op; + enum ta_rap_status status; int ret; if (*pos || size != 2) @@ -70,9 +71,8 @@ static ssize_t amdgpu_rap_debugfs_write(struct file *f, const char __user *buf, switch (op) { case 2: - ret = psp_rap_invoke(&adev->psp, op); - - if (ret == TA_RAP_STATUS__SUCCESS) { + ret = psp_rap_invoke(&adev->psp, op, &status); + if (!ret && status == TA_RAP_STATUS__SUCCESS) { dev_info(adev->dev, "RAP L0 validate test success.\n"); } else { rap_shared_mem = (struct ta_rap_shared_memory *) @@ -97,6 +97,7 @@ static ssize_t amdgpu_rap_debugfs_write(struct file *f, const char __user *buf, default: dev_info(adev->dev, "Unsupported op id: %d, ", op); dev_info(adev->dev, "Only support op 2(L0 validate test).\n"); + break; } amdgpu_gfx_off_ctrl(adev, true); -- cgit v1.2.3-70-g09d2