Skip to contentSkip to conversation

drm/amdgpu: avoid reading vf2pf info size from FB

PATCH In review Zhigang Luo 3 participants 3 messages Apr 30, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: avoid reading vf2pf info size from FB

VF can't access FB when host is doing mode1 reset. Using sizeof to get vf2pf info size, instead of reading it from vf2pf header stored in FB.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +1 -1
index 54ab51a4ada7..c84d2217005e 100644
@@ -583,7 +583,7 @@ static int amdgpu_virt_write_vf2pf_data(struct amdgpu_device *adev)
 	}
 	vf2pf_info->checksum =
 		amd_sriov_msg_checksum(
-		vf2pf_info, vf2pf_info->header.size, 0, 0);
+		vf2pf_info, sizeof(struct amd_sriov_msg_vf2pf_info), 0, 0);
 
 	return 0;
 }
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - General]

Regards,
Hawking
-----Original Message-----
From: Luo, Zhigang <[email protected]>
Sent: Tuesday, April 30, 2024 22:24
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Saye, Sashank <[email protected]>; Chan, Hing Pong <[email protected]>; Lazar, Lijo <[email protected]>; Luo, Zhigang <[email protected]>
Subject: [PATCH] drm/amdgpu: avoid reading vf2pf info size from FB

VF can't access FB when host is doing mode1 reset. Using sizeof to get vf2pf info size, instead of reading it from vf2pf header stored in FB.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +1 -1
index 54ab51a4ada7..c84d2217005e 100644
@@ -583,7 +583,7 @@ static int amdgpu_virt_write_vf2pf_data(struct amdgpu_device *adev)
        }
        vf2pf_info->checksum =
                amd_sriov_msg_checksum(
-               vf2pf_info, vf2pf_info->header.size, 0, 0);
+               vf2pf_info, sizeof(struct amd_sriov_msg_vf2pf_info), 0, 0);
 
        return 0;
 }

--
2.25.1

Reviewed-by on v1 1/1
#2 lore raw
In reply to Zhigang Luo
Quoted 13 lines · Zhigang Luo

VF can't access FB when host is doing mode1 reset. Using sizeof to get vf2pf info size, instead of reading it from vf2pf header stored in FB.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +0 -0
index 54ab51a4ada7..c84d2217005e 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c static int amdgpu_virt_write_vf2pf_data(struct amdgpu_device *adev) · line 586

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +1 -1
@@ -583,7 +583,7 @@ static int amdgpu_virt_write_vf2pf_data(struct amdgpu_device *adev)
 	}
 	vf2pf_info->checksum =
 		amd_sriov_msg_checksum(
-		vf2pf_info, vf2pf_info->header.size, 0, 0);
+		vf2pf_info, sizeof(struct amd_sriov_msg_vf2pf_info), 0, 0);

You may change to sizeof(*vf2pf_info).

Thanks,
Lijo

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +0 -0
 	return 0;
 }