drm/amd: Evaluate early init for all IP blocks even if one fails
authorMario Limonciello <mario.limonciello@amd.com>
Sun, 15 Jan 2023 19:05:31 +0000 (13:05 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 17 Jan 2023 21:11:51 +0000 (16:11 -0500)
If early init fails for a single IP block, then no further IP blocks
are evaluated.  This means that if a user was missing more than one
firmware binary they would have to keep adding binaries and re-probing
until they discovered the ones missing.

To make this easier, run early init for each IP block and report a single
failure if not all passed.

Reviewed-by: Aaron Liu <aaron.liu@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

index 692266e..0d7d175 100644 (file)
@@ -2075,6 +2075,7 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
        struct drm_device *dev = adev_to_drm(adev);
        struct pci_dev *parent;
        int i, r;
+       bool total;
 
        amdgpu_device_enable_virtual_display(adev);
 
@@ -2158,6 +2159,7 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
        if (amdgpu_sriov_vf(adev) && adev->asic_type == CHIP_SIENNA_CICHLID)
                adev->pm.pp_feature &= ~PP_OVERDRIVE_MASK;
 
+       total = true;
        for (i = 0; i < adev->num_ip_blocks; i++) {
                if ((amdgpu_ip_block_mask & (1 << i)) == 0) {
                        DRM_ERROR("disabled ip block: %d <%s>\n",
@@ -2171,7 +2173,7 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
                                } else if (r) {
                                        DRM_ERROR("early_init of IP block <%s> failed %d\n",
                                                  adev->ip_blocks[i].version->funcs->name, r);
-                                       return r;
+                                       total = false;
                                } else {
                                        adev->ip_blocks[i].status.valid = true;
                                }
@@ -2202,6 +2204,8 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
 
                }
        }
+       if (!total)
+               return -ENODEV;
 
        adev->cg_flags &= amdgpu_cg_mask;
        adev->pg_flags &= amdgpu_pg_mask;