drm/amd/amdgpu: fixing read wrong pf2vf data in SRIOV
Subsystems (2)
PATCH v4 1/1 drm/amd/amdgpu: fixing read wrong pf2vf data in SRIOV
[Why]
This fixes 35709bd76d229a51b0c571a768b741650ec47828.
we should read pf2vf data based at mman.fw_vram_usage_va after gmc sw_init. patch 35709bd76 breaks this logic.
[How]
calling amdgpu_virt_exchange_data in amdgpu_virt_init_data_exchange to set the right base in the right sequence.
v2:
call amdgpu_virt_init_data_exchange after gmc sw_init to make data exchange workqueue run
v3:
clean up the code logic
v4:
add some comment and make the code more readable
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 20 +++++++------------- 2 files changed, 8 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
@@ -2353,7 +2353,7 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev) }if (amdgpu_sriov_vf (adev)) -amdgpu_virt_exchange_data (adev); +amdgpu_virt_init_data_exchange (adev); r =amdgpu_ib_pool_init (adev);if (r) {
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +7 -13
@@ -625,20 +625,20 @@ void amdgpu_virt_init_data_exchange(struct amdgpu_device *adev) adev->virt.fw_reserve.p_vf2pf =NULL ; adev->virt.vf2pf_update_interval_ms =0 ; -if (adev->bios !=NULL ) { - adev->virt.vf2pf_update_interval_ms =2000 ; +if (adev->mman.fw_vram_usage_va !=NULL ) { +/* go through this logic in ip_init and reset to init workqueue*/ +amdgpu_virt_exchange_data (adev); +INIT_DELAYED_WORK (&adev->virt.vf2pf_work, amdgpu_virt_update_vf2pf_work_item); +schedule_delayed_work (&(adev->virt.vf2pf_work),msecs_to_jiffies (adev->virt.vf2pf_update_interval_ms)); + }else if (adev->bios !=NULL ) { +/* got through this logic in early init stage to get necessary flags, e.g. rlcg_acc related*/ adev->virt.fw_reserve.p_pf2vf = (struct amd_sriov_msg_pf2vf_info_header *) (adev->bios + (AMD_SRIOV_MSG_PF2VF_OFFSET_KB <<10 ));amdgpu_virt_read_pf2vf_data (adev); } - -if (adev->virt.vf2pf_update_interval_ms !=0 ) { -INIT_DELAYED_WORK (&adev->virt.vf2pf_work, amdgpu_virt_update_vf2pf_work_item); -schedule_delayed_work (&(adev->virt.vf2pf_work),msecs_to_jiffies (adev->virt.vf2pf_update_interval_ms)); - } }
@@ -674,12 +674,6 @@ void amdgpu_virt_exchange_data(struct amdgpu_device *adev)if (adev->virt.ras_init_done)amdgpu_virt_add_bad_page (adev, bp_block_offset, bp_block_size); } - }else if (adev->bios !=NULL ) { - adev->virt.fw_reserve.p_pf2vf = - (struct amd_sriov_msg_pf2vf_info_header *) - (adev->bios + (AMD_SRIOV_MSG_PF2VF_OFFSET_KB <<10 )); - -amdgpu_virt_read_pf2vf_data (adev); } }
Signature · 1 line
2.30.2
[AMD Official Use Only]
-----Original Message-----
From: Chen, JingWen <[email protected]>
Sent: Friday, January 14, 2022 2:54 PM
To: [email protected]
Cc: Liu, Monk <[email protected]>; Chen, Horace <[email protected]>; Skvortsov, Victor <[email protected]>; Chen, JingWen <[email protected]>
Subject: [PATCH v4] drm/amd/amdgpu: fixing read wrong pf2vf data in SRIOV
[Why]
This fixes 35709bd76d229a51b0c571a768b741650ec47828.
we should read pf2vf data based at mman.fw_vram_usage_va after gmc sw_init. patch 35709bd76 breaks this logic.
[How]
calling amdgpu_virt_exchange_data in amdgpu_virt_init_data_exchange to set the right base in the right sequence.
v2:
call amdgpu_virt_init_data_exchange after gmc sw_init to make data exchange workqueue run
v3:
clean up the code logic
v4:
add some comment and make the code more readable
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 20 +++++++------------- 2 files changed, 8 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
@@ -2353,7 +2353,7 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev) }if (amdgpu_sriov_vf (adev)) -amdgpu_virt_exchange_data (adev); +amdgpu_virt_init_data_exchange (adev); r =amdgpu_ib_pool_init (adev);if (r) {
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +8 -7
@@ -625,20 +625,20 @@ void amdgpu_virt_init_data_exchange(struct amdgpu_device *adev) adev->virt.fw_reserve.p_vf2pf =NULL ; adev->virt.vf2pf_update_interval_ms =0 ; -if (adev->bios !=NULL ) { - adev->virt.vf2pf_update_interval_ms =2000 ; +if (adev->mman.fw_vram_usage_va !=NULL ) { +/* go through this logic in ip_init and reset to init workqueue*/ +amdgpu_virt_exchange_data (adev); +INIT_DELAYED_WORK (&adev->virt.vf2pf_work, amdgpu_virt_update_vf2pf_work_item); +schedule_delayed_work (&(adev->virt.vf2pf_work),msecs_to_jiffies (adev->virt.vf2pf_update_interval_ms)); + }else if (adev->bios !=NULL ) { +/* got through this logic in early init stage to get necessary flags, +e.g. rlcg_acc related*/ adev->virt.fw_reserve.p_pf2vf = (struct amd_sriov_msg_pf2vf_info_header *) (adev->bios + (AMD_SRIOV_MSG_PF2VF_OFFSET_KB <<10 ));amdgpu_virt_read_pf2vf_data (adev); } - -if (adev->virt.vf2pf_update_interval_ms !=0 ) { -INIT_DELAYED_WORK (&adev->virt.vf2pf_work, amdgpu_virt_update_vf2pf_work_item); -schedule_delayed_work (&(adev->virt.vf2pf_work),msecs_to_jiffies (adev->virt.vf2pf_update_interval_ms)); - } }
@@ -674,12 +674,6 @@ void amdgpu_virt_exchange_data(struct amdgpu_device *adev)
if (adev->virt.ras_init_done)
amdgpu_virt_add_bad_page(adev, bp_block_offset, bp_block_size);
}- } else if (adev->bios != NULL) {
- adev->virt.fw_reserve.p_pf2vf =
- (struct amd_sriov_msg_pf2vf_info_header *)
- (adev->bios + (AMD_SRIOV_MSG_PF2VF_OFFSET_KB << 10));
-
- amdgpu_virt_read_pf2vf_data(adev);
}}
--
2.30.2