]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amdgpu: move program_aspm to amdgpu_nbio
authorGabriel Almeida <gabrielsousa230@gmail.com>
Fri, 24 Apr 2026 00:49:09 +0000 (21:49 -0300)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 28 Apr 2026 18:28:52 +0000 (14:28 -0400)
The program_aspm helper is duplicated across multiple files with
identical logic.

Move it to amdgpu_nbio.c as amdgpu_nbio_program_aspm and update
all users accordingly.

Signed-off-by: Gabriel Almeida <gabrielsousa230@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h
drivers/gpu/drm/amd/amdgpu/nv.c
drivers/gpu/drm/amd/amdgpu/soc15.c
drivers/gpu/drm/amd/amdgpu/soc21.c

index a974265837f0d451cb7b28bde80b4b3ed0d8bc6e..e4c8e98725f017a7af8e2db7f6b62af4a8f16bff 100644 (file)
@@ -84,3 +84,13 @@ late_fini:
        amdgpu_ras_block_late_fini(adev, ras_block);
        return r;
 }
+
+
+void amdgpu_nbio_program_aspm(struct amdgpu_device *adev)
+{
+       if (!amdgpu_device_should_use_aspm(adev))
+               return;
+
+       if (adev->nbio.funcs->program_aspm)
+               adev->nbio.funcs->program_aspm(adev);
+}
index b528de6a01f6d3d57b5151afbbeba1014afb9991..a61f3a6e8ec774d7a2e875439c452d606f00974b 100644 (file)
@@ -121,4 +121,6 @@ u64 amdgpu_nbio_get_pcie_replay_count(struct amdgpu_device *adev);
 
 bool amdgpu_nbio_is_replay_cnt_supported(struct amdgpu_device *adev);
 
+void amdgpu_nbio_program_aspm(struct amdgpu_device *adev);
+
 #endif
index 7ce1a1b956065c1742500d793bf1b471b9cd9a39..030d8066494cf32c553874afb2de7a012dfb244d 100644 (file)
@@ -511,16 +511,6 @@ static int nv_set_vce_clocks(struct amdgpu_device *adev, u32 evclk, u32 ecclk)
        return 0;
 }
 
-static void nv_program_aspm(struct amdgpu_device *adev)
-{
-       if (!amdgpu_device_should_use_aspm(adev))
-               return;
-
-       if (adev->nbio.funcs->program_aspm)
-               adev->nbio.funcs->program_aspm(adev);
-
-}
-
 const struct amdgpu_ip_block_version nv_common_ip_block = {
        .type = AMD_IP_BLOCK_TYPE_COMMON,
        .major = 1,
@@ -984,7 +974,7 @@ static int nv_common_hw_init(struct amdgpu_ip_block *ip_block)
                adev->nbio.funcs->apply_l1_link_width_reconfig_wa(adev);
 
        /* enable aspm */
-       nv_program_aspm(adev);
+       amdgpu_nbio_program_aspm(adev);
        /* setup nbio registers */
        adev->nbio.funcs->init_registers(adev);
        /* remap HDP registers to a hole in mmio space,
index b456e4541d9acf34b9a103d7e18d3da20dc3fc89..27bcbbae5db458bf44f17bb26fa5a3507235f0e3 100644 (file)
@@ -695,15 +695,6 @@ static int soc15_set_vce_clocks(struct amdgpu_device *adev, u32 evclk, u32 ecclk
        return 0;
 }
 
-static void soc15_program_aspm(struct amdgpu_device *adev)
-{
-       if (!amdgpu_device_should_use_aspm(adev))
-               return;
-
-       if (adev->nbio.funcs->program_aspm)
-               adev->nbio.funcs->program_aspm(adev);
-}
-
 const struct amdgpu_ip_block_version vega10_common_ip_block =
 {
        .type = AMD_IP_BLOCK_TYPE_COMMON,
@@ -1284,7 +1275,7 @@ static int soc15_common_hw_init(struct amdgpu_ip_block *ip_block)
        struct amdgpu_device *adev = ip_block->adev;
 
        /* enable aspm */
-       soc15_program_aspm(adev);
+       amdgpu_nbio_program_aspm(adev);
        /* setup nbio registers */
        adev->nbio.funcs->init_registers(adev);
        /* remap HDP registers to a hole in mmio space,
index fbd1d97f33add8a199532c3a2814a2f8c5187025..7e4353d0ce6e306d0a85dbdf358146d81a07c0d4 100644 (file)
@@ -470,15 +470,6 @@ static int soc21_set_vce_clocks(struct amdgpu_device *adev, u32 evclk, u32 ecclk
        return 0;
 }
 
-static void soc21_program_aspm(struct amdgpu_device *adev)
-{
-       if (!amdgpu_device_should_use_aspm(adev))
-               return;
-
-       if (adev->nbio.funcs->program_aspm)
-               adev->nbio.funcs->program_aspm(adev);
-}
-
 const struct amdgpu_ip_block_version soc21_common_ip_block = {
        .type = AMD_IP_BLOCK_TYPE_COMMON,
        .major = 1,
@@ -925,7 +916,7 @@ static int soc21_common_hw_init(struct amdgpu_ip_block *ip_block)
        struct amdgpu_device *adev = ip_block->adev;
 
        /* enable aspm */
-       soc21_program_aspm(adev);
+       amdgpu_nbio_program_aspm(adev);
        /* setup nbio registers */
        adev->nbio.funcs->init_registers(adev);
        /* remap HDP registers to a hole in mmio space,