[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <BYAPR12MB279124DEA06FE8EA43E164BC99B60@BYAPR12MB2791.namprd12.prod.outlook.com>
Date: Thu, 27 Dec 2018 09:26:26 +0000
From: "Qu, Jim" <Jim.Qu@....com>
To: Kangjie Lu <kjlu@....edu>
CC: "Zhou, David(ChunMing)" <David1.Zhou@....com>,
David Airlie <airlied@...ux.ie>,
"Xu, Feifei" <Feifei.Xu@....com>,
"Francis, David" <David.Francis@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"amd-gfx@...ts.freedesktop.org" <amd-gfx@...ts.freedesktop.org>,
"Huang, Ray" <Ray.Huang@....com>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
Daniel Vetter <daniel@...ll.ch>,
"pakki001@....edu" <pakki001@....edu>,
"Deucher, Alexander" <Alexander.Deucher@....com>,
"Gao, Likun" <Likun.Gao@....com>, "Zhu, Rex" <Rex.Zhu@....com>,
"Koenig, Christian" <Christian.Koenig@....com>,
"Zhang, Hawking" <Hawking.Zhang@....com>
Subject: 答复: [PATCH] gpu: drm: fix an improper check of amdgpu_bo_create_kernel
Comments in line.
Thanks
JimQu
________________________________________
发件人: amd-gfx <amd-gfx-bounces@...ts.freedesktop.org> 代表 Kangjie Lu <kjlu@....edu>
发送时间: 2018年12月26日 14:23
收件人: kjlu@....edu
抄送: Zhou, David(ChunMing); David Airlie; Xu, Feifei; Francis, David; linux-kernel@...r.kernel.org; amd-gfx@...ts.freedesktop.org; Huang, Ray; dri-devel@...ts.freedesktop.org; Daniel Vetter; pakki001@....edu; Deucher, Alexander; Gao, Likun; Zhu, Rex; Koenig, Christian; Zhang, Hawking
主题: [PATCH] gpu: drm: fix an improper check of amdgpu_bo_create_kernel
adev->firmware.fw_buf being not NULL may not indicate kernel buffer is
created successful. A better way is to check the status (return value)
of it. The fix does so.
Signed-off-by: Kangjie Lu <kjlu@....edu>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
index 7b33867036e7..ba3c1cfb2c35 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
@@ -422,13 +422,19 @@ static int amdgpu_ucode_patch_jt(struct amdgpu_firmware_info *ucode,
int amdgpu_ucode_create_bo(struct amdgpu_device *adev)
{
+ int ret;
+
if (adev->firmware.load_type != AMDGPU_FW_LOAD_DIRECT) {
- amdgpu_bo_create_kernel(adev, adev->firmware.fw_size, PAGE_SIZE,
- amdgpu_sriov_vf(adev) ? AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
- &adev->firmware.fw_buf,
- &adev->firmware.fw_buf_mc,
- &adev->firmware.fw_buf_ptr);
- if (!adev->firmware.fw_buf) {
+ ret =
+ amdgpu_bo_create_kernel(adev,
+ adev->firmware.fw_size,
+ PAGE_SIZE,
+ amdgpu_sriov_vf(adev) ? AMDGPU_GEM_DOMAIN_VRAM :
+ AMDGPU_GEM_DOMAIN_GTT,
+ &adev->firmware.fw_buf,
+ &adev->firmware.fw_buf_mc,
+ &adev->firmware.fw_buf_ptr);
+ if (ret) {
JimQu: Look into amdgpu_bo_create_kernel(), new bo will be created only if *bo_ptr = NULL, So if you encounter the issue the adev->firmware.fw_buf != NULL but new bo is not created, the only problem I can see are:
1. there is bug in amdgpu_bo_create_kernel()
2. adev->firmware.fw_buf != NULL before it is transferred into amdgpu_bo_create_kernel().
Could you commit what is environment you encounter the issue?
Thanks
JimQu
dev_err(adev->dev, "failed to create kernel buffer for firmware.fw_buf\n");
return -ENOMEM;
} else if (amdgpu_sriov_vf(adev)) {
--
2.17.2 (Apple Git-113)
_______________________________________________
amd-gfx mailing list
amd-gfx@...ts.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Powered by blists - more mailing lists