Skip to content

Commit 1a6513d

Browse files
superm1alexdeucher
authored andcommitted
drm/amd: Move AMD_IS_APU check for ASPM into top level function
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>
1 parent fbf1035 commit 1a6513d

7 files changed

Lines changed: 6 additions & 14 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,6 +1496,8 @@ bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev)
14961496
default:
14971497
return false;
14981498
}
1499+
if (adev->flags & AMD_IS_APU)
1500+
return false;
14991501
return pcie_aspm_enabled(adev->pdev);
15001502
}
15011503

drivers/gpu/drm/amd/amdgpu/cik.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,10 +1709,6 @@ static void cik_program_aspm(struct amdgpu_device *adev)
17091709
if (pci_is_root_bus(adev->pdev->bus))
17101710
return;
17111711

1712-
/* XXX double check APUs */
1713-
if (adev->flags & AMD_IS_APU)
1714-
return;
1715-
17161712
orig = data = RREG32_PCIE(ixPCIE_LC_N_FTS_CNTL);
17171713
data &= ~PCIE_LC_N_FTS_CNTL__LC_XMIT_N_FTS_MASK;
17181714
data |= (0x24 << PCIE_LC_N_FTS_CNTL__LC_XMIT_N_FTS__SHIFT) |

drivers/gpu/drm/amd/amdgpu/nv.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,7 @@ static void nv_program_aspm(struct amdgpu_device *adev)
516516
if (!amdgpu_device_should_use_aspm(adev) || !amdgpu_device_aspm_support_quirk())
517517
return;
518518

519-
if (!(adev->flags & AMD_IS_APU) &&
520-
(adev->nbio.funcs->program_aspm))
519+
if (adev->nbio.funcs->program_aspm)
521520
adev->nbio.funcs->program_aspm(adev);
522521

523522
}

drivers/gpu/drm/amd/amdgpu/si.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2440,8 +2440,6 @@ static void si_program_aspm(struct amdgpu_device *adev)
24402440
if (!amdgpu_device_should_use_aspm(adev))
24412441
return;
24422442

2443-
if (adev->flags & AMD_IS_APU)
2444-
return;
24452443
orig = data = RREG32_PCIE_PORT(PCIE_LC_N_FTS_CNTL);
24462444
data &= ~LC_XMIT_N_FTS_MASK;
24472445
data |= LC_XMIT_N_FTS(0x24) | LC_XMIT_N_FTS_OVERRIDE_EN;

drivers/gpu/drm/amd/amdgpu/soc15.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,7 @@ static void soc15_program_aspm(struct amdgpu_device *adev)
646646
if (!amdgpu_device_should_use_aspm(adev))
647647
return;
648648

649-
if (!(adev->flags & AMD_IS_APU) &&
650-
(adev->nbio.funcs->program_aspm))
649+
if (adev->nbio.funcs->program_aspm)
651650
adev->nbio.funcs->program_aspm(adev);
652651
}
653652

drivers/gpu/drm/amd/amdgpu/soc21.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,7 @@ static void soc21_program_aspm(struct amdgpu_device *adev)
433433
if (!amdgpu_device_should_use_aspm(adev))
434434
return;
435435

436-
if (!(adev->flags & AMD_IS_APU) &&
437-
(adev->nbio.funcs->program_aspm))
436+
if (adev->nbio.funcs->program_aspm)
438437
adev->nbio.funcs->program_aspm(adev);
439438
}
440439

drivers/gpu/drm/amd/amdgpu/vi.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,8 +1127,7 @@ static void vi_program_aspm(struct amdgpu_device *adev)
11271127
if (!amdgpu_device_should_use_aspm(adev) || !amdgpu_device_pcie_dynamic_switching_supported())
11281128
return;
11291129

1130-
if (adev->flags & AMD_IS_APU ||
1131-
adev->asic_type < CHIP_POLARIS10)
1130+
if (adev->asic_type < CHIP_POLARIS10)
11321131
return;
11331132

11341133
orig = data = RREG32_PCIE(ixPCIE_LC_CNTL);

0 commit comments

Comments
 (0)