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.

Signed-off-by: Mario Limonciello <mario.limoncie...@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 8846f026eeece..2f904bb545fe4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2074,6 +2074,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);
 
@@ -2157,6 +2158,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",
@@ -2170,7 +2172,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;
                                }
@@ -2201,6 +2203,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;
-- 
2.25.1

Reply via email to