drm/amdgpu: make sure to init common IP before gmc
authorjsg <jsg@openbsd.org>
Mon, 3 Oct 2022 11:42:42 +0000 (11:42 +0000)
committerjsg <jsg@openbsd.org>
Mon, 3 Oct 2022 11:42:42 +0000 (11:42 +0000)
From Alex Deucher
55653c548612d7ffbb21cf05ebff6d14f79cc913 in linux 5.15.y/5.15.71
a8671493d2074950553da3cf07d1be43185ef6c6 in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c

index 26e2342..9784b7a 100644 (file)
@@ -2420,8 +2420,16 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
                }
                adev->ip_blocks[i].status.sw = true;
 
-               /* need to do gmc hw init early so we can allocate gpu mem */
-               if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) {
+               if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON) {
+                       /* need to do common hw init early so everything is set up for gmc */
+                       r = adev->ip_blocks[i].version->funcs->hw_init((void *)adev);
+                       if (r) {
+                               DRM_ERROR("hw_init %d failed %d\n", i, r);
+                               goto init_failed;
+                       }
+                       adev->ip_blocks[i].status.hw = true;
+               } else if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) {
+                       /* need to do gmc hw init early so we can allocate gpu mem */
                        /* Try to reserve bad pages early */
                        if (amdgpu_sriov_vf(adev))
                                amdgpu_virt_exchange_data(adev);
@@ -3069,8 +3077,8 @@ static int amdgpu_device_ip_reinit_early_sriov(struct amdgpu_device *adev)
        int i, r;
 
        static enum amd_ip_block_type ip_order[] = {
-               AMD_IP_BLOCK_TYPE_GMC,
                AMD_IP_BLOCK_TYPE_COMMON,
+               AMD_IP_BLOCK_TYPE_GMC,
                AMD_IP_BLOCK_TYPE_PSP,
                AMD_IP_BLOCK_TYPE_IH,
        };