]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amd: Move AMD_IS_APU check for ASPM into top level function
authorMario Limonciello <mario.limonciello@amd.com>
Mon, 23 Oct 2023 20:47:43 +0000 (15:47 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 26 Oct 2023 22:41:23 +0000 (18:41 -0400)
There is no need for every ASIC driver to perform the same check.
Move the duplicated code into amdgpu_device_should_use_aspm().

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/cik.c
drivers/gpu/drm/amd/amdgpu/nv.c
drivers/gpu/drm/amd/amdgpu/si.c
drivers/gpu/drm/amd/amdgpu/soc15.c
drivers/gpu/drm/amd/amdgpu/soc21.c
drivers/gpu/drm/amd/amdgpu/vi.c

index 286f3f60c25b763b0a1ebd2877a19d6bc588b7d9..9c51a31864a726af7a979578a57ed58a113b6115 100644 (file)
@@ -1496,6 +1496,8 @@ bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev)
        default:
                return false;
        }
+       if (adev->flags & AMD_IS_APU)
+               return false;
        return pcie_aspm_enabled(adev->pdev);
 }
 
index e63abdf52b6c2dd1f76a27636382ed8fd8c66421..4dfaa017cf7fad6971c0aa191a0796e7f06cfc84 100644 (file)
@@ -1709,10 +1709,6 @@ static void cik_program_aspm(struct amdgpu_device *adev)
        if (pci_is_root_bus(adev->pdev->bus))
                return;
 
-       /* XXX double check APUs */
-       if (adev->flags & AMD_IS_APU)
-               return;
-
        orig = data = RREG32_PCIE(ixPCIE_LC_N_FTS_CNTL);
        data &= ~PCIE_LC_N_FTS_CNTL__LC_XMIT_N_FTS_MASK;
        data |= (0x24 << PCIE_LC_N_FTS_CNTL__LC_XMIT_N_FTS__SHIFT) |
index 1995c7459f20fac2fb3497085aaf5787402a027e..9fa220de1490efef7c924ab2528e8e3fcdab6bb1 100644 (file)
@@ -516,8 +516,7 @@ static void nv_program_aspm(struct amdgpu_device *adev)
        if (!amdgpu_device_should_use_aspm(adev) || !amdgpu_device_aspm_support_quirk())
                return;
 
-       if (!(adev->flags & AMD_IS_APU) &&
-           (adev->nbio.funcs->program_aspm))
+       if (adev->nbio.funcs->program_aspm)
                adev->nbio.funcs->program_aspm(adev);
 
 }
index 4b81f29e5fd5a56b8adfe2c1f96a8d85fd5c34e5..a757526153e5eaae308762dc3f868c426299c066 100644 (file)
@@ -2440,8 +2440,6 @@ static void si_program_aspm(struct amdgpu_device *adev)
        if (!amdgpu_device_should_use_aspm(adev))
                return;
 
-       if (adev->flags & AMD_IS_APU)
-               return;
        orig = data = RREG32_PCIE_PORT(PCIE_LC_N_FTS_CNTL);
        data &= ~LC_XMIT_N_FTS_MASK;
        data |= LC_XMIT_N_FTS(0x24) | LC_XMIT_N_FTS_OVERRIDE_EN;
index 66ed28136bc8edbc4670c4255b8fb3a8d540a0b2..d4b8d62f42943f7913d16b00ee6eac6dfbc13315 100644 (file)
@@ -646,8 +646,7 @@ static void soc15_program_aspm(struct amdgpu_device *adev)
        if (!amdgpu_device_should_use_aspm(adev))
                return;
 
-       if (!(adev->flags & AMD_IS_APU) &&
-           (adev->nbio.funcs->program_aspm))
+       if (adev->nbio.funcs->program_aspm)
                adev->nbio.funcs->program_aspm(adev);
 }
 
index 8c6cab641a1c751b4b6abf052d8123e85367cded..d5083c54933015d038b59a3b05e1b404372ede8b 100644 (file)
@@ -433,8 +433,7 @@ static void soc21_program_aspm(struct amdgpu_device *adev)
        if (!amdgpu_device_should_use_aspm(adev))
                return;
 
-       if (!(adev->flags & AMD_IS_APU) &&
-           (adev->nbio.funcs->program_aspm))
+       if (adev->nbio.funcs->program_aspm)
                adev->nbio.funcs->program_aspm(adev);
 }
 
index fe8ba9e9837b39e82bc94cceb5a5a4e9a88b5ee4..1a08052bade3c96ac01fb049218be929f085ef8b 100644 (file)
@@ -1127,8 +1127,7 @@ static void vi_program_aspm(struct amdgpu_device *adev)
        if (!amdgpu_device_should_use_aspm(adev) || !amdgpu_device_pcie_dynamic_switching_supported())
                return;
 
-       if (adev->flags & AMD_IS_APU ||
-           adev->asic_type < CHIP_POLARIS10)
+       if (adev->asic_type < CHIP_POLARIS10)
                return;
 
        orig = data = RREG32_PCIE(ixPCIE_LC_CNTL);