Commit 2757a848 authored by Mario Limonciello's avatar Mario Limonciello Committed by Alex Deucher
Browse files

drm/amd: Explicitly disable ASPM when dynamic switching disabled



Currently there are separate but related checks:
* amdgpu_device_should_use_aspm()
* amdgpu_device_aspm_support_quirk()
* amdgpu_device_pcie_dynamic_switching_supported()

Simplify into checking whether DPM was enabled or not in the auto
case.  This works because amdgpu_device_pcie_dynamic_switching_supported()
populates that value.

Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 1a6513de
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -1340,9 +1340,7 @@ void amdgpu_device_pci_config_reset(struct amdgpu_device *adev);
int amdgpu_device_pci_reset(struct amdgpu_device *adev);
bool amdgpu_device_need_post(struct amdgpu_device *adev);
bool amdgpu_device_seamless_boot_supported(struct amdgpu_device *adev);
bool amdgpu_device_pcie_dynamic_switching_supported(void);
bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev);
bool amdgpu_device_aspm_support_quirk(void);

void amdgpu_cs_report_moved_bytes(struct amdgpu_device *adev, u64 num_bytes,
				  u64 num_vis_bytes);
+6 −15
Original line number Diff line number Diff line
@@ -1456,14 +1456,14 @@ bool amdgpu_device_seamless_boot_supported(struct amdgpu_device *adev)
}

/*
 * Intel hosts such as Raptor Lake and Sapphire Rapids don't support dynamic
 * speed switching. Until we have confirmation from Intel that a specific host
 * supports it, it's safer that we keep it disabled for all.
 * Intel hosts such as Rocket Lake, Alder Lake, Raptor Lake and Sapphire Rapids
 * don't support dynamic speed switching. Until we have confirmation from Intel
 * that a specific host supports it, it's safer that we keep it disabled for all.
 *
 * https://edc.intel.com/content/www/us/en/design/products/platforms/details/raptor-lake-s/13th-generation-core-processors-datasheet-volume-1-of-2/005/pci-express-support/
 * https://gitlab.freedesktop.org/drm/amd/-/issues/2663
 */
bool amdgpu_device_pcie_dynamic_switching_supported(void)
static bool amdgpu_device_pcie_dynamic_switching_supported(void)
{
#if IS_ENABLED(CONFIG_X86)
	struct cpuinfo_x86 *c = &cpu_data(0);
@@ -1498,20 +1498,11 @@ bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev)
	}
	if (adev->flags & AMD_IS_APU)
		return false;
	if (!(adev->pm.pp_feature & PP_PCIE_DPM_MASK))
		return false;
	return pcie_aspm_enabled(adev->pdev);
}

bool amdgpu_device_aspm_support_quirk(void)
{
#if IS_ENABLED(CONFIG_X86)
	struct cpuinfo_x86 *c = &cpu_data(0);

	return !(c->x86 == 6 && c->x86_model == INTEL_FAM6_ALDERLAKE);
#else
	return true;
#endif
}

/* if we get transitioned to only one device, take VGA back */
/**
 * amdgpu_device_vga_set_decode - enable/disable vga decode
+3 −4
Original line number Diff line number Diff line
@@ -513,7 +513,7 @@ static int nv_set_vce_clocks(struct amdgpu_device *adev, u32 evclk, u32 ecclk)

static void nv_program_aspm(struct amdgpu_device *adev)
{
	if (!amdgpu_device_should_use_aspm(adev) || !amdgpu_device_aspm_support_quirk())
	if (!amdgpu_device_should_use_aspm(adev))
		return;

	if (adev->nbio.funcs->program_aspm)
@@ -608,8 +608,7 @@ static int nv_update_umd_stable_pstate(struct amdgpu_device *adev,
	if (adev->gfx.funcs->update_perfmon_mgcg)
		adev->gfx.funcs->update_perfmon_mgcg(adev, !enter);

	if (!(adev->flags & AMD_IS_APU) &&
	    (adev->nbio.funcs->enable_aspm) &&
	if (adev->nbio.funcs->enable_aspm &&
	    amdgpu_device_should_use_aspm(adev))
		adev->nbio.funcs->enable_aspm(adev, !enter);

+1 −1
Original line number Diff line number Diff line
@@ -1124,7 +1124,7 @@ static void vi_program_aspm(struct amdgpu_device *adev)
	bool bL1SS = false;
	bool bClkReqSupport = true;

	if (!amdgpu_device_should_use_aspm(adev) || !amdgpu_device_pcie_dynamic_switching_supported())
	if (!amdgpu_device_should_use_aspm(adev))
		return;

	if (adev->asic_type < CHIP_POLARIS10)