OSDN Git Service

drm/amdgpu: postpone entering fullaccess mode
authorMonk Liu <Monk.Liu@amd.com>
Tue, 10 Mar 2020 10:12:13 +0000 (18:12 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 1 Apr 2020 18:44:43 +0000 (14:44 -0400)
if host support new handshake we only need to enter
fullaccess_mode in ip_init() part, otherwise we need
to do it before reading vbios (becuase host prepares vbios
for VF only after received REQ_GPU_INIT event under
legacy handshake)

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Emily Deng <Emily.Deng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

index 3c19ae0..a97492f 100644 (file)
@@ -1812,10 +1812,14 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
                                return r;
                        }
                }
+       }
 
+       /* we need to send REQ_GPU here for legacy handshaker otherwise the vbios
+        * will not be prepared by host for this VF */
+       if (amdgpu_sriov_vf(adev) && adev->virt.req_init_data_ver < 1) {
                r = amdgpu_virt_request_full_gpu(adev, true);
                if (r)
-                       return -EAGAIN;
+                       return r;
        }
 
        adev->pm.pp_feature = amdgpu_pp_feature_mask;
@@ -1975,6 +1979,12 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
        if (r)
                return r;
 
+       if (amdgpu_sriov_vf(adev) && adev->virt.req_init_data_ver > 0) {
+               r = amdgpu_virt_request_full_gpu(adev, true);
+               if (r)
+                       return -EAGAIN;
+       }
+
        for (i = 0; i < adev->num_ip_blocks; i++) {
                if (!adev->ip_blocks[i].status.valid)
                        continue;