[PATCH] drm/amd/amdgpu: Add checksun check for pf2vf message

Li, Xin (Justin) Xin2.Li at amd.com
Thu Oct 29 05:52:00 UTC 2020


[AMD Official Use Only - Internal Distribution Only]

Any updates on this patch?

Best Regards,
Li, Xin (Justin)

From: Li, Xin (Justin) <Xin2.Li at amd.com>
Date: Tuesday, October 27, 2020 at 14:36
To: amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>, Li, Xin (Justin) <Xin2.Li at amd.com>, Zhou, Tiecheng <Tiecheng.Zhou at amd.com>
Subject: [PATCH] drm/amd/amdgpu: Add checksun check for pf2vf message

[AMD Official Use Only - Internal Distribution Only]

Add checksum checking for pf2vf message

Signed-off-by: Li, Xin (Justin) <Xin2.Li at amd.com<mailto:Xin2.Li at amd.com>>
Signed-off-by: Zhou, Tiecheng <Tiecheng.Zhou at amd.com<mailto:Tiecheng.Zhou at amd.com>>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index 836d784456e5..bfc74533b5ee 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -450,12 +450,11 @@ static int amdgpu_virt_read_pf2vf_data(struct amdgpu_device *adev)
                         ((struct amdgim_pf2vf_info_v1 *)pf2vf_info)->feature_flags;
                 break;
         case 2:
-               /* TODO: missing key, need to add it later */
                 checksum = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->checksum;
                 checkval = amd_sriov_msg_checksum(
                         adev->virt.fw_reserve.p_pf2vf, pf2vf_info->size,
-                       0, checksum);
-               if (checksum != checkval) {
+                       adev->virt.fw_reserve.checksum_key, checksum);
+               if (checksum != 0 && checksum != checkval) {
                         DRM_ERROR("invalid pf2vf message\n");
                         return -EINVAL;
                 }
--
2.24.3 (Apple Git-128)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20201029/028ae421/attachment.htm>


More information about the amd-gfx mailing list