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 286f3f6..9c51a31 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 e63abdf..4dfaa01 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 1995c74..9fa220d 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 4b81f29..a757526 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 66ed281..d4b8d62 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 8c6cab6..d5083c5 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 fe8ba9e..1a08052 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);