]> git.dujemihanovic.xyz Git - linux.git/commitdiff
drm/amdgpu: Fix selfring initialization sequence on soc24
authorDavid Belanger <david.belanger@amd.com>
Wed, 11 Sep 2024 15:16:50 +0000 (11:16 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 18 Sep 2024 20:14:47 +0000 (16:14 -0400)
Move enable_doorbell_selfring_aperture from common_hw_init
to common_late_init in soc24, otherwise selfring aperture is
initialized with an incorrect doorbell aperture base.

Port changes from this commit from soc21 to soc24:
commit 1c312e816c40 ("drm/amdgpu: Enable doorbell selfring after resize FB BAR")

Signed-off-by: David Belanger <david.belanger@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org # 6.11.x
drivers/gpu/drm/amd/amdgpu/soc24.c

index b0c3678cfb31d80cf6f590037a1043a758e644d4..fd4c3d4f8387981d28f91695c0fdde65831c8315 100644 (file)
@@ -250,13 +250,6 @@ static void soc24_program_aspm(struct amdgpu_device *adev)
                adev->nbio.funcs->program_aspm(adev);
 }
 
-static void soc24_enable_doorbell_aperture(struct amdgpu_device *adev,
-                                          bool enable)
-{
-       adev->nbio.funcs->enable_doorbell_aperture(adev, enable);
-       adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, enable);
-}
-
 const struct amdgpu_ip_block_version soc24_common_ip_block = {
        .type = AMD_IP_BLOCK_TYPE_COMMON,
        .major = 1,
@@ -454,6 +447,11 @@ static int soc24_common_late_init(void *handle)
        if (amdgpu_sriov_vf(adev))
                xgpu_nv_mailbox_get_irq(adev);
 
+       /* Enable selfring doorbell aperture late because doorbell BAR
+        * aperture will change if resize BAR successfully in gmc sw_init.
+        */
+       adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, true);
+
        return 0;
 }
 
@@ -491,7 +489,7 @@ static int soc24_common_hw_init(void *handle)
                adev->df.funcs->hw_init(adev);
 
        /* enable the doorbell aperture */
-       soc24_enable_doorbell_aperture(adev, true);
+       adev->nbio.funcs->enable_doorbell_aperture(adev, true);
 
        return 0;
 }
@@ -500,8 +498,13 @@ static int soc24_common_hw_fini(void *handle)
 {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-       /* disable the doorbell aperture */
-       soc24_enable_doorbell_aperture(adev, false);
+       /* Disable the doorbell aperture and selfring doorbell aperture
+        * separately in hw_fini because soc21_enable_doorbell_aperture
+        * has been removed and there is no need to delay disabling
+        * selfring doorbell.
+        */
+       adev->nbio.funcs->enable_doorbell_aperture(adev, false);
+       adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, false);
 
        if (amdgpu_sriov_vf(adev))
                xgpu_nv_mailbox_put_irq(adev);