Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 8795e182b02d ("PCI/portdrv: Don't disable AER reporting in get_port_device_capability()")

Reported-by: Gustaw Smolarczyk <wielkiegie@gmail.com>
Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

Cc: stable@vger.kernel.org
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Lijo Lazar and committed by
Alex Deucher
6c204906 7c6fb61a

+24 -3
+8 -1
drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c
··· 380 380 WREG32_PCIE(smnPCIE_LC_CNTL, data); 381 381 } 382 382 383 + #ifdef CONFIG_PCIEASPM 383 384 static void nbio_v2_3_program_ltr(struct amdgpu_device *adev) 384 385 { 385 386 uint32_t def, data; ··· 402 401 if (def != data) 403 402 WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data); 404 403 } 404 + #endif 405 405 406 406 static void nbio_v2_3_program_aspm(struct amdgpu_device *adev) 407 407 { 408 + #ifdef CONFIG_PCIEASPM 408 409 uint32_t def, data; 409 410 410 411 def = data = RREG32_PCIE(smnPCIE_LC_CNTL); ··· 462 459 if (def != data) 463 460 WREG32_PCIE(smnPCIE_LC_CNTL6, data); 464 461 465 - nbio_v2_3_program_ltr(adev); 462 + /* Don't bother about LTR if LTR is not enabled 463 + * in the path */ 464 + if (adev->pdev->ltr_path) 465 + nbio_v2_3_program_ltr(adev); 466 466 467 467 def = data = RREG32_SOC15(NBIO, 0, mmRCC_BIF_STRAP3); 468 468 data |= 0x5DE0 << RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER__SHIFT; ··· 489 483 data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK; 490 484 if (def != data) 491 485 WREG32_PCIE(smnPCIE_LC_CNTL3, data); 486 + #endif 492 487 } 493 488 494 489 static void nbio_v2_3_apply_lc_spc_mode_wa(struct amdgpu_device *adev)
+8 -1
drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c
··· 282 282 mmBIF_BX_DEV0_EPF0_VF0_HDP_MEM_COHERENCY_FLUSH_CNTL) << 2; 283 283 } 284 284 285 + #ifdef CONFIG_PCIEASPM 285 286 static void nbio_v6_1_program_ltr(struct amdgpu_device *adev) 286 287 { 287 288 uint32_t def, data; ··· 304 303 if (def != data) 305 304 WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data); 306 305 } 306 + #endif 307 307 308 308 static void nbio_v6_1_program_aspm(struct amdgpu_device *adev) 309 309 { 310 + #ifdef CONFIG_PCIEASPM 310 311 uint32_t def, data; 311 312 312 313 def = data = RREG32_PCIE(smnPCIE_LC_CNTL); ··· 364 361 if (def != data) 365 362 WREG32_PCIE(smnPCIE_LC_CNTL6, data); 366 363 367 - nbio_v6_1_program_ltr(adev); 364 + /* Don't bother about LTR if LTR is not enabled 365 + * in the path */ 366 + if (adev->pdev->ltr_path) 367 + nbio_v6_1_program_ltr(adev); 368 368 369 369 def = data = RREG32_PCIE(smnRCC_BIF_STRAP3); 370 370 data |= 0x5DE0 << RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER__SHIFT; ··· 391 385 data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK; 392 386 if (def != data) 393 387 WREG32_PCIE(smnPCIE_LC_CNTL3, data); 388 + #endif 394 389 } 395 390 396 391 const struct amdgpu_nbio_funcs nbio_v6_1_funcs = {
+8 -1
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c
··· 673 673 }; 674 674 675 675 676 + #ifdef CONFIG_PCIEASPM 676 677 static void nbio_v7_4_program_ltr(struct amdgpu_device *adev) 677 678 { 678 679 uint32_t def, data; ··· 695 694 if (def != data) 696 695 WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data); 697 696 } 697 + #endif 698 698 699 699 static void nbio_v7_4_program_aspm(struct amdgpu_device *adev) 700 700 { 701 + #ifdef CONFIG_PCIEASPM 701 702 uint32_t def, data; 702 703 703 704 if (adev->ip_versions[NBIO_HWIP][0] == IP_VERSION(7, 4, 4)) ··· 758 755 if (def != data) 759 756 WREG32_PCIE(smnPCIE_LC_CNTL6, data); 760 757 761 - nbio_v7_4_program_ltr(adev); 758 + /* Don't bother about LTR if LTR is not enabled 759 + * in the path */ 760 + if (adev->pdev->ltr_path) 761 + nbio_v7_4_program_ltr(adev); 762 762 763 763 def = data = RREG32_PCIE(smnRCC_BIF_STRAP3); 764 764 data |= 0x5DE0 << RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER__SHIFT; ··· 785 779 data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK; 786 780 if (def != data) 787 781 WREG32_PCIE(smnPCIE_LC_CNTL3, data); 782 + #endif 788 783 } 789 784 790 785 const struct amdgpu_nbio_funcs nbio_v7_4_funcs = {