Skip to content

Commit 7b1c626

Browse files
committed
drm/amdgpu: don't use pci_is_thunderbolt_attached()
It's only valid on Intel systems with the Intel VSEC. Use dev_is_removable() instead. This should do the right thing regardless of the platform. Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2925 Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
1 parent 432e664 commit 7b1c626

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include <drm/drm_fb_helper.h>
4242
#include <drm/drm_probe_helper.h>
4343
#include <drm/amdgpu_drm.h>
44+
#include <linux/device.h>
4445
#include <linux/vgaarb.h>
4546
#include <linux/vga_switcheroo.h>
4647
#include <linux/efi.h>
@@ -2223,7 +2224,6 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
22232224
*/
22242225
static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
22252226
{
2226-
struct drm_device *dev = adev_to_drm(adev);
22272227
struct pci_dev *parent;
22282228
int i, r;
22292229
bool total;
@@ -2294,7 +2294,7 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
22942294
(amdgpu_is_atpx_hybrid() ||
22952295
amdgpu_has_atpx_dgpu_power_cntl()) &&
22962296
((adev->flags & AMD_IS_APU) == 0) &&
2297-
!pci_is_thunderbolt_attached(to_pci_dev(dev->dev)))
2297+
!dev_is_removable(&adev->pdev->dev))
22982298
adev->flags |= AMD_IS_PX;
22992299

23002300
if (!(adev->flags & AMD_IS_APU)) {
@@ -4142,7 +4142,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
41424142

41434143
px = amdgpu_device_supports_px(ddev);
41444144

4145-
if (px || (!pci_is_thunderbolt_attached(adev->pdev) &&
4145+
if (px || (!dev_is_removable(&adev->pdev->dev) &&
41464146
apple_gmux_detect(NULL, NULL)))
41474147
vga_switcheroo_register_client(adev->pdev,
41484148
&amdgpu_switcheroo_ops, px);
@@ -4292,7 +4292,7 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)
42924292

42934293
px = amdgpu_device_supports_px(adev_to_drm(adev));
42944294

4295-
if (px || (!pci_is_thunderbolt_attached(adev->pdev) &&
4295+
if (px || (!dev_is_removable(&adev->pdev->dev) &&
42964296
apple_gmux_detect(NULL, NULL)))
42974297
vga_switcheroo_unregister_client(adev->pdev);
42984298

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "nbio/nbio_2_3_offset.h"
2929
#include "nbio/nbio_2_3_sh_mask.h"
3030
#include <uapi/linux/kfd_ioctl.h>
31+
#include <linux/device.h>
3132
#include <linux/pci.h>
3233

3334
#define smnPCIE_CONFIG_CNTL 0x11180044
@@ -361,7 +362,7 @@ static void nbio_v2_3_enable_aspm(struct amdgpu_device *adev,
361362

362363
data |= NAVI10_PCIE__LC_L0S_INACTIVITY_DEFAULT << PCIE_LC_CNTL__LC_L0S_INACTIVITY__SHIFT;
363364

364-
if (pci_is_thunderbolt_attached(adev->pdev))
365+
if (dev_is_removable(&adev->pdev->dev))
365366
data |= NAVI10_PCIE__LC_L1_INACTIVITY_TBT_DEFAULT << PCIE_LC_CNTL__LC_L1_INACTIVITY__SHIFT;
366367
else
367368
data |= NAVI10_PCIE__LC_L1_INACTIVITY_DEFAULT << PCIE_LC_CNTL__LC_L1_INACTIVITY__SHIFT;
@@ -480,7 +481,7 @@ static void nbio_v2_3_program_aspm(struct amdgpu_device *adev)
480481

481482
def = data = RREG32_PCIE(smnPCIE_LC_CNTL);
482483
data |= NAVI10_PCIE__LC_L0S_INACTIVITY_DEFAULT << PCIE_LC_CNTL__LC_L0S_INACTIVITY__SHIFT;
483-
if (pci_is_thunderbolt_attached(adev->pdev))
484+
if (dev_is_removable(&adev->pdev->dev))
484485
data |= NAVI10_PCIE__LC_L1_INACTIVITY_TBT_DEFAULT << PCIE_LC_CNTL__LC_L1_INACTIVITY__SHIFT;
485486
else
486487
data |= NAVI10_PCIE__LC_L1_INACTIVITY_DEFAULT << PCIE_LC_CNTL__LC_L1_INACTIVITY__SHIFT;

0 commit comments

Comments
 (0)