@@ -3152,7 +3152,8 @@ static int amdgpu_device_ip_resume_phase1(struct amdgpu_device *adev)
31523152 continue ;
31533153 if (adev -> ip_blocks [i ].version -> type == AMD_IP_BLOCK_TYPE_COMMON ||
31543154 adev -> ip_blocks [i ].version -> type == AMD_IP_BLOCK_TYPE_GMC ||
3155- adev -> ip_blocks [i ].version -> type == AMD_IP_BLOCK_TYPE_IH ) {
3155+ adev -> ip_blocks [i ].version -> type == AMD_IP_BLOCK_TYPE_IH ||
3156+ (adev -> ip_blocks [i ].version -> type == AMD_IP_BLOCK_TYPE_PSP && amdgpu_sriov_vf (adev ))) {
31563157
31573158 r = adev -> ip_blocks [i ].version -> funcs -> resume (adev );
31583159 if (r ) {
@@ -4064,12 +4065,20 @@ static void amdgpu_device_evict_resources(struct amdgpu_device *adev)
40644065int amdgpu_device_suspend (struct drm_device * dev , bool fbcon )
40654066{
40664067 struct amdgpu_device * adev = drm_to_adev (dev );
4068+ int r = 0 ;
40674069
40684070 if (dev -> switch_power_state == DRM_SWITCH_POWER_OFF )
40694071 return 0 ;
40704072
40714073 adev -> in_suspend = true;
40724074
4075+ if (amdgpu_sriov_vf (adev )) {
4076+ amdgpu_virt_fini_data_exchange (adev );
4077+ r = amdgpu_virt_request_full_gpu (adev , false);
4078+ if (r )
4079+ return r ;
4080+ }
4081+
40734082 if (amdgpu_acpi_smart_shift_update (dev , AMDGPU_SS_DEV_D3 ))
40744083 DRM_WARN ("smart shift update failed\n" );
40754084
@@ -4093,6 +4102,9 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
40934102
40944103 amdgpu_device_ip_suspend_phase2 (adev );
40954104
4105+ if (amdgpu_sriov_vf (adev ))
4106+ amdgpu_virt_release_full_gpu (adev , false);
4107+
40964108 return 0 ;
40974109}
40984110
@@ -4111,6 +4123,12 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
41114123 struct amdgpu_device * adev = drm_to_adev (dev );
41124124 int r = 0 ;
41134125
4126+ if (amdgpu_sriov_vf (adev )) {
4127+ r = amdgpu_virt_request_full_gpu (adev , true);
4128+ if (r )
4129+ return r ;
4130+ }
4131+
41144132 if (dev -> switch_power_state == DRM_SWITCH_POWER_OFF )
41154133 return 0 ;
41164134
@@ -4125,6 +4143,13 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
41254143 }
41264144
41274145 r = amdgpu_device_ip_resume (adev );
4146+
4147+ /* no matter what r is, always need to properly release full GPU */
4148+ if (amdgpu_sriov_vf (adev )) {
4149+ amdgpu_virt_init_data_exchange (adev );
4150+ amdgpu_virt_release_full_gpu (adev , true);
4151+ }
4152+
41284153 if (r ) {
41294154 dev_err (adev -> dev , "amdgpu_device_ip_resume failed (%d).\n" , r );
41304155 return r ;
0 commit comments