Commit dd6aeb4e authored by Lijo Lazar's avatar Lijo Lazar Committed by Alex Deucher

drm/amdgpu: Don't enable LTR if not supported

As per PCIE Base Spec r4.0 Section 6.18
'Software must not enable LTR in an Endpoint unless the Root Complex
and all intermediate Switches indicate support for LTR.'

This fixes the Unsupported Request error reported through AER during
ASPM enablement.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=216455

The error was unnoticed before and got visible because of the commit
referenced below. This doesn't fix anything in the commit below, rather
fixes the issue in amdgpu exposed by the commit. The reference is only
to associate this commit with below one so that both go together.

Fixes: 8795e182 ("PCI/portdrv: Don't disable AER reporting in get_port_device_capability()")
Reported-by: default avatarGustaw Smolarczyk <wielkiegie@gmail.com>
Signed-off-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>

Cc: stable@vger.kernel.org
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 7bb91228
...@@ -380,6 +380,7 @@ static void nbio_v2_3_enable_aspm(struct amdgpu_device *adev, ...@@ -380,6 +380,7 @@ static void nbio_v2_3_enable_aspm(struct amdgpu_device *adev,
WREG32_PCIE(smnPCIE_LC_CNTL, data); WREG32_PCIE(smnPCIE_LC_CNTL, data);
} }
#ifdef CONFIG_PCIEASPM
static void nbio_v2_3_program_ltr(struct amdgpu_device *adev) static void nbio_v2_3_program_ltr(struct amdgpu_device *adev)
{ {
uint32_t def, data; uint32_t def, data;
...@@ -401,9 +402,11 @@ static void nbio_v2_3_program_ltr(struct amdgpu_device *adev) ...@@ -401,9 +402,11 @@ static void nbio_v2_3_program_ltr(struct amdgpu_device *adev)
if (def != data) if (def != data)
WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data); WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data);
} }
#endif
static void nbio_v2_3_program_aspm(struct amdgpu_device *adev) static void nbio_v2_3_program_aspm(struct amdgpu_device *adev)
{ {
#ifdef CONFIG_PCIEASPM
uint32_t def, data; uint32_t def, data;
def = data = RREG32_PCIE(smnPCIE_LC_CNTL); def = data = RREG32_PCIE(smnPCIE_LC_CNTL);
...@@ -459,7 +462,10 @@ static void nbio_v2_3_program_aspm(struct amdgpu_device *adev) ...@@ -459,7 +462,10 @@ static void nbio_v2_3_program_aspm(struct amdgpu_device *adev)
if (def != data) if (def != data)
WREG32_PCIE(smnPCIE_LC_CNTL6, data); WREG32_PCIE(smnPCIE_LC_CNTL6, data);
nbio_v2_3_program_ltr(adev); /* Don't bother about LTR if LTR is not enabled
* in the path */
if (adev->pdev->ltr_path)
nbio_v2_3_program_ltr(adev);
def = data = RREG32_SOC15(NBIO, 0, mmRCC_BIF_STRAP3); def = data = RREG32_SOC15(NBIO, 0, mmRCC_BIF_STRAP3);
data |= 0x5DE0 << RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER__SHIFT; data |= 0x5DE0 << RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER__SHIFT;
...@@ -483,6 +489,7 @@ static void nbio_v2_3_program_aspm(struct amdgpu_device *adev) ...@@ -483,6 +489,7 @@ static void nbio_v2_3_program_aspm(struct amdgpu_device *adev)
data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK; data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK;
if (def != data) if (def != data)
WREG32_PCIE(smnPCIE_LC_CNTL3, data); WREG32_PCIE(smnPCIE_LC_CNTL3, data);
#endif
} }
static void nbio_v2_3_apply_lc_spc_mode_wa(struct amdgpu_device *adev) static void nbio_v2_3_apply_lc_spc_mode_wa(struct amdgpu_device *adev)
......
...@@ -282,6 +282,7 @@ static void nbio_v6_1_init_registers(struct amdgpu_device *adev) ...@@ -282,6 +282,7 @@ static void nbio_v6_1_init_registers(struct amdgpu_device *adev)
mmBIF_BX_DEV0_EPF0_VF0_HDP_MEM_COHERENCY_FLUSH_CNTL) << 2; mmBIF_BX_DEV0_EPF0_VF0_HDP_MEM_COHERENCY_FLUSH_CNTL) << 2;
} }
#ifdef CONFIG_PCIEASPM
static void nbio_v6_1_program_ltr(struct amdgpu_device *adev) static void nbio_v6_1_program_ltr(struct amdgpu_device *adev)
{ {
uint32_t def, data; uint32_t def, data;
...@@ -303,9 +304,11 @@ static void nbio_v6_1_program_ltr(struct amdgpu_device *adev) ...@@ -303,9 +304,11 @@ static void nbio_v6_1_program_ltr(struct amdgpu_device *adev)
if (def != data) if (def != data)
WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data); WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data);
} }
#endif
static void nbio_v6_1_program_aspm(struct amdgpu_device *adev) static void nbio_v6_1_program_aspm(struct amdgpu_device *adev)
{ {
#ifdef CONFIG_PCIEASPM
uint32_t def, data; uint32_t def, data;
def = data = RREG32_PCIE(smnPCIE_LC_CNTL); def = data = RREG32_PCIE(smnPCIE_LC_CNTL);
...@@ -361,7 +364,10 @@ static void nbio_v6_1_program_aspm(struct amdgpu_device *adev) ...@@ -361,7 +364,10 @@ static void nbio_v6_1_program_aspm(struct amdgpu_device *adev)
if (def != data) if (def != data)
WREG32_PCIE(smnPCIE_LC_CNTL6, data); WREG32_PCIE(smnPCIE_LC_CNTL6, data);
nbio_v6_1_program_ltr(adev); /* Don't bother about LTR if LTR is not enabled
* in the path */
if (adev->pdev->ltr_path)
nbio_v6_1_program_ltr(adev);
def = data = RREG32_PCIE(smnRCC_BIF_STRAP3); def = data = RREG32_PCIE(smnRCC_BIF_STRAP3);
data |= 0x5DE0 << RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER__SHIFT; data |= 0x5DE0 << RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER__SHIFT;
...@@ -385,6 +391,7 @@ static void nbio_v6_1_program_aspm(struct amdgpu_device *adev) ...@@ -385,6 +391,7 @@ static void nbio_v6_1_program_aspm(struct amdgpu_device *adev)
data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK; data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK;
if (def != data) if (def != data)
WREG32_PCIE(smnPCIE_LC_CNTL3, data); WREG32_PCIE(smnPCIE_LC_CNTL3, data);
#endif
} }
const struct amdgpu_nbio_funcs nbio_v6_1_funcs = { const struct amdgpu_nbio_funcs nbio_v6_1_funcs = {
......
...@@ -673,6 +673,7 @@ struct amdgpu_nbio_ras nbio_v7_4_ras = { ...@@ -673,6 +673,7 @@ struct amdgpu_nbio_ras nbio_v7_4_ras = {
}; };
#ifdef CONFIG_PCIEASPM
static void nbio_v7_4_program_ltr(struct amdgpu_device *adev) static void nbio_v7_4_program_ltr(struct amdgpu_device *adev)
{ {
uint32_t def, data; uint32_t def, data;
...@@ -694,9 +695,11 @@ static void nbio_v7_4_program_ltr(struct amdgpu_device *adev) ...@@ -694,9 +695,11 @@ static void nbio_v7_4_program_ltr(struct amdgpu_device *adev)
if (def != data) if (def != data)
WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data); WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data);
} }
#endif
static void nbio_v7_4_program_aspm(struct amdgpu_device *adev) static void nbio_v7_4_program_aspm(struct amdgpu_device *adev)
{ {
#ifdef CONFIG_PCIEASPM
uint32_t def, data; uint32_t def, data;
if (adev->ip_versions[NBIO_HWIP][0] == IP_VERSION(7, 4, 4)) if (adev->ip_versions[NBIO_HWIP][0] == IP_VERSION(7, 4, 4))
...@@ -755,7 +758,10 @@ static void nbio_v7_4_program_aspm(struct amdgpu_device *adev) ...@@ -755,7 +758,10 @@ static void nbio_v7_4_program_aspm(struct amdgpu_device *adev)
if (def != data) if (def != data)
WREG32_PCIE(smnPCIE_LC_CNTL6, data); WREG32_PCIE(smnPCIE_LC_CNTL6, data);
nbio_v7_4_program_ltr(adev); /* Don't bother about LTR if LTR is not enabled
* in the path */
if (adev->pdev->ltr_path)
nbio_v7_4_program_ltr(adev);
def = data = RREG32_PCIE(smnRCC_BIF_STRAP3); def = data = RREG32_PCIE(smnRCC_BIF_STRAP3);
data |= 0x5DE0 << RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER__SHIFT; data |= 0x5DE0 << RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER__SHIFT;
...@@ -779,6 +785,7 @@ static void nbio_v7_4_program_aspm(struct amdgpu_device *adev) ...@@ -779,6 +785,7 @@ static void nbio_v7_4_program_aspm(struct amdgpu_device *adev)
data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK; data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK;
if (def != data) if (def != data)
WREG32_PCIE(smnPCIE_LC_CNTL3, data); WREG32_PCIE(smnPCIE_LC_CNTL3, data);
#endif
} }
const struct amdgpu_nbio_funcs nbio_v7_4_funcs = { const struct amdgpu_nbio_funcs nbio_v7_4_funcs = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment