Skip to content

Commit 6c20490

Browse files
Lijo Lazaralexdeucher
authored andcommitted
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: 8795e18 ("PCI/portdrv: Don't disable AER reporting in get_port_device_capability()") Reported-by: Gustaw Smolarczyk <[email protected]> Signed-off-by: Lijo Lazar <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Cc: [email protected] Signed-off-by: Alex Deucher <[email protected]>
1 parent 7c6fb61 commit 6c20490

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ static void nbio_v2_3_enable_aspm(struct amdgpu_device *adev,
380380
WREG32_PCIE(smnPCIE_LC_CNTL, data);
381381
}
382382

383+
#ifdef CONFIG_PCIEASPM
383384
static void nbio_v2_3_program_ltr(struct amdgpu_device *adev)
384385
{
385386
uint32_t def, data;
@@ -401,9 +402,11 @@ static void nbio_v2_3_program_ltr(struct amdgpu_device *adev)
401402
if (def != data)
402403
WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data);
403404
}
405+
#endif
404406

405407
static void nbio_v2_3_program_aspm(struct amdgpu_device *adev)
406408
{
409+
#ifdef CONFIG_PCIEASPM
407410
uint32_t def, data;
408411

409412
def = data = RREG32_PCIE(smnPCIE_LC_CNTL);
@@ -459,7 +462,10 @@ static void nbio_v2_3_program_aspm(struct amdgpu_device *adev)
459462
if (def != data)
460463
WREG32_PCIE(smnPCIE_LC_CNTL6, data);
461464

462-
nbio_v2_3_program_ltr(adev);
465+
/* Don't bother about LTR if LTR is not enabled
466+
* in the path */
467+
if (adev->pdev->ltr_path)
468+
nbio_v2_3_program_ltr(adev);
463469

464470
def = data = RREG32_SOC15(NBIO, 0, mmRCC_BIF_STRAP3);
465471
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)
483489
data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK;
484490
if (def != data)
485491
WREG32_PCIE(smnPCIE_LC_CNTL3, data);
492+
#endif
486493
}
487494

488495
static void nbio_v2_3_apply_lc_spc_mode_wa(struct amdgpu_device *adev)

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ static void nbio_v6_1_init_registers(struct amdgpu_device *adev)
282282
mmBIF_BX_DEV0_EPF0_VF0_HDP_MEM_COHERENCY_FLUSH_CNTL) << 2;
283283
}
284284

285+
#ifdef CONFIG_PCIEASPM
285286
static void nbio_v6_1_program_ltr(struct amdgpu_device *adev)
286287
{
287288
uint32_t def, data;
@@ -303,9 +304,11 @@ static void nbio_v6_1_program_ltr(struct amdgpu_device *adev)
303304
if (def != data)
304305
WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data);
305306
}
307+
#endif
306308

307309
static void nbio_v6_1_program_aspm(struct amdgpu_device *adev)
308310
{
311+
#ifdef CONFIG_PCIEASPM
309312
uint32_t def, data;
310313

311314
def = data = RREG32_PCIE(smnPCIE_LC_CNTL);
@@ -361,7 +364,10 @@ static void nbio_v6_1_program_aspm(struct amdgpu_device *adev)
361364
if (def != data)
362365
WREG32_PCIE(smnPCIE_LC_CNTL6, data);
363366

364-
nbio_v6_1_program_ltr(adev);
367+
/* Don't bother about LTR if LTR is not enabled
368+
* in the path */
369+
if (adev->pdev->ltr_path)
370+
nbio_v6_1_program_ltr(adev);
365371

366372
def = data = RREG32_PCIE(smnRCC_BIF_STRAP3);
367373
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)
385391
data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK;
386392
if (def != data)
387393
WREG32_PCIE(smnPCIE_LC_CNTL3, data);
394+
#endif
388395
}
389396

390397
const struct amdgpu_nbio_funcs nbio_v6_1_funcs = {

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,7 @@ struct amdgpu_nbio_ras nbio_v7_4_ras = {
673673
};
674674

675675

676+
#ifdef CONFIG_PCIEASPM
676677
static void nbio_v7_4_program_ltr(struct amdgpu_device *adev)
677678
{
678679
uint32_t def, data;
@@ -694,9 +695,11 @@ static void nbio_v7_4_program_ltr(struct amdgpu_device *adev)
694695
if (def != data)
695696
WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data);
696697
}
698+
#endif
697699

698700
static void nbio_v7_4_program_aspm(struct amdgpu_device *adev)
699701
{
702+
#ifdef CONFIG_PCIEASPM
700703
uint32_t def, data;
701704

702705
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)
755758
if (def != data)
756759
WREG32_PCIE(smnPCIE_LC_CNTL6, data);
757760

758-
nbio_v7_4_program_ltr(adev);
761+
/* Don't bother about LTR if LTR is not enabled
762+
* in the path */
763+
if (adev->pdev->ltr_path)
764+
nbio_v7_4_program_ltr(adev);
759765

760766
def = data = RREG32_PCIE(smnRCC_BIF_STRAP3);
761767
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)
779785
data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK;
780786
if (def != data)
781787
WREG32_PCIE(smnPCIE_LC_CNTL3, data);
788+
#endif
782789
}
783790

784791
const struct amdgpu_nbio_funcs nbio_v7_4_funcs = {

0 commit comments

Comments
 (0)