Skip to content

Commit 9a45840

Browse files
Jingwen Chenalexdeucher
authored andcommitted
drm/amd/amdgpu: fixing read wrong pf2vf data in SRIOV
[Why] This fixes 892deb4 ("drm/amdgpu: Separate vf2pf work item init from virt data exchange"). we should read pf2vf data based at mman.fw_vram_usage_va after gmc sw_init. commit 892deb4 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 Fixes: 892deb4 ("drm/amdgpu: Separate vf2pf work item init from virt data exchange") Signed-off-by: Jingwen Chen <[email protected]> Reviewed-by: Horace Chen <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 520d9cd commit 9a45840

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2354,7 +2354,7 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
23542354
}
23552355

23562356
if (amdgpu_sriov_vf(adev))
2357-
amdgpu_virt_exchange_data(adev);
2357+
amdgpu_virt_init_data_exchange(adev);
23582358

23592359
r = amdgpu_ib_pool_init(adev);
23602360
if (r) {

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -625,20 +625,20 @@ void amdgpu_virt_init_data_exchange(struct amdgpu_device *adev)
625625
adev->virt.fw_reserve.p_vf2pf = NULL;
626626
adev->virt.vf2pf_update_interval_ms = 0;
627627

628-
if (adev->bios != NULL) {
629-
adev->virt.vf2pf_update_interval_ms = 2000;
628+
if (adev->mman.fw_vram_usage_va != NULL) {
629+
/* go through this logic in ip_init and reset to init workqueue*/
630+
amdgpu_virt_exchange_data(adev);
630631

632+
INIT_DELAYED_WORK(&adev->virt.vf2pf_work, amdgpu_virt_update_vf2pf_work_item);
633+
schedule_delayed_work(&(adev->virt.vf2pf_work), msecs_to_jiffies(adev->virt.vf2pf_update_interval_ms));
634+
} else if (adev->bios != NULL) {
635+
/* got through this logic in early init stage to get necessary flags, e.g. rlcg_acc related*/
631636
adev->virt.fw_reserve.p_pf2vf =
632637
(struct amd_sriov_msg_pf2vf_info_header *)
633638
(adev->bios + (AMD_SRIOV_MSG_PF2VF_OFFSET_KB << 10));
634639

635640
amdgpu_virt_read_pf2vf_data(adev);
636641
}
637-
638-
if (adev->virt.vf2pf_update_interval_ms != 0) {
639-
INIT_DELAYED_WORK(&adev->virt.vf2pf_work, amdgpu_virt_update_vf2pf_work_item);
640-
schedule_delayed_work(&(adev->virt.vf2pf_work), msecs_to_jiffies(adev->virt.vf2pf_update_interval_ms));
641-
}
642642
}
643643

644644

@@ -674,12 +674,6 @@ void amdgpu_virt_exchange_data(struct amdgpu_device *adev)
674674
if (adev->virt.ras_init_done)
675675
amdgpu_virt_add_bad_page(adev, bp_block_offset, bp_block_size);
676676
}
677-
} else if (adev->bios != NULL) {
678-
adev->virt.fw_reserve.p_pf2vf =
679-
(struct amd_sriov_msg_pf2vf_info_header *)
680-
(adev->bios + (AMD_SRIOV_MSG_PF2VF_OFFSET_KB << 10));
681-
682-
amdgpu_virt_read_pf2vf_data(adev);
683677
}
684678
}
685679

0 commit comments

Comments
 (0)