This is a note to let you know that I've just added the patch titled drm/amdgpu: don't use pci_is_thunderbolt_attached() to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: drm-amdgpu-don-t-use-pci_is_thunderbolt_attached.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 7b1c6263eaf4fd64ffe1cafdc504a42ee4bfbb33 Mon Sep 17 00:00:00 2001 From: Alex Deucher <alexander.deucher@xxxxxxx> Date: Tue, 17 Oct 2023 16:30:00 -0400 Subject: drm/amdgpu: don't use pci_is_thunderbolt_attached() From: Alex Deucher <alexander.deucher@xxxxxxx> commit 7b1c6263eaf4fd64ffe1cafdc504a42ee4bfbb33 upstream. 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@xxxxxxx> Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx> Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -41,6 +41,7 @@ #include <drm/drm_atomic_helper.h> #include <drm/drm_probe_helper.h> #include <drm/amdgpu_drm.h> +#include <linux/device.h> #include <linux/vgaarb.h> #include <linux/vga_switcheroo.h> #include <linux/efi.h> @@ -2105,7 +2106,6 @@ out: */ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev) { - struct drm_device *dev = adev_to_drm(adev); struct pci_dev *parent; int i, r; @@ -2175,7 +2175,7 @@ static int amdgpu_device_ip_early_init(s (amdgpu_is_atpx_hybrid() || amdgpu_has_atpx_dgpu_power_cntl()) && ((adev->flags & AMD_IS_APU) == 0) && - !pci_is_thunderbolt_attached(to_pci_dev(dev->dev))) + !dev_is_removable(&adev->pdev->dev)) adev->flags |= AMD_IS_PX; if (!(adev->flags & AMD_IS_APU)) { @@ -3968,7 +3968,7 @@ fence_driver_init: px = amdgpu_device_supports_px(ddev); - if (px || (!pci_is_thunderbolt_attached(adev->pdev) && + if (px || (!dev_is_removable(&adev->pdev->dev) && apple_gmux_detect(NULL, NULL))) vga_switcheroo_register_client(adev->pdev, &amdgpu_switcheroo_ops, px); @@ -4117,7 +4117,7 @@ void amdgpu_device_fini_sw(struct amdgpu px = amdgpu_device_supports_px(adev_to_drm(adev)); - if (px || (!pci_is_thunderbolt_attached(adev->pdev) && + if (px || (!dev_is_removable(&adev->pdev->dev) && apple_gmux_detect(NULL, NULL))) vga_switcheroo_unregister_client(adev->pdev); --- a/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c @@ -28,6 +28,7 @@ #include "nbio/nbio_2_3_offset.h" #include "nbio/nbio_2_3_sh_mask.h" #include <uapi/linux/kfd_ioctl.h> +#include <linux/device.h> #include <linux/pci.h> #define smnPCIE_CONFIG_CNTL 0x11180044 @@ -361,7 +362,7 @@ static void nbio_v2_3_enable_aspm(struct data |= NAVI10_PCIE__LC_L0S_INACTIVITY_DEFAULT << PCIE_LC_CNTL__LC_L0S_INACTIVITY__SHIFT; - if (pci_is_thunderbolt_attached(adev->pdev)) + if (dev_is_removable(&adev->pdev->dev)) data |= NAVI10_PCIE__LC_L1_INACTIVITY_TBT_DEFAULT << PCIE_LC_CNTL__LC_L1_INACTIVITY__SHIFT; else 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(struc def = data = RREG32_PCIE(smnPCIE_LC_CNTL); data |= NAVI10_PCIE__LC_L0S_INACTIVITY_DEFAULT << PCIE_LC_CNTL__LC_L0S_INACTIVITY__SHIFT; - if (pci_is_thunderbolt_attached(adev->pdev)) + if (dev_is_removable(&adev->pdev->dev)) data |= NAVI10_PCIE__LC_L1_INACTIVITY_TBT_DEFAULT << PCIE_LC_CNTL__LC_L1_INACTIVITY__SHIFT; else data |= NAVI10_PCIE__LC_L1_INACTIVITY_DEFAULT << PCIE_LC_CNTL__LC_L1_INACTIVITY__SHIFT; Patches currently in stable-queue which might be from alexander.deucher@xxxxxxx are queue-6.1/drm-amd-pm-fix-error-of-maco-flag-setting-code.patch queue-6.1/drm-amd-display-use-full-update-for-clip-size-increa.patch queue-6.1/drm-radeon-fix-a-possible-null-pointer-dereference.patch queue-6.1/drm-amdkfd-fix-shift-out-of-bounds-issue.patch queue-6.1/drm-amdgpu-not-to-save-bo-in-the-case-of-ras-err_eve.patch queue-6.1/drm-amdgpu-lower-cs-errors-to-debug-severity.patch queue-6.1/drm-amdgpu-fix-a-null-pointer-access-when-the-smc_rr.patch queue-6.1/drm-amd-update-update_pcie_parameters-functions-to-u.patch queue-6.1/drm-amd-pm-handle-non-terminated-overdrive-commands.patch queue-6.1/drm-amd-display-enable-dsc_clk-even-if-dsc_pg-disabl.patch queue-6.1/drm-amdgpu-vkms-fix-a-possible-null-pointer-derefere.patch queue-6.1/drm-amd-display-change-the-dmcub-mailbox-memory-location-from-fb-to-inbox.patch queue-6.1/drm-amd-fix-ubsan-array-index-out-of-bounds-for-smu7.patch queue-6.1/drm-amdgpu-don-t-use-pci_is_thunderbolt_attached.patch queue-6.1/drm-amd-display-fix-a-null-pointer-dereference-in-amdgpu_dm_i2c_xfer.patch queue-6.1/drm-amdgpu-don-t-use-atrm-for-external-devices.patch queue-6.1/drm-amdkfd-fix-a-race-condition-of-vram-buffer-unref.patch queue-6.1/drm-amdgpu-fix-software-pci_unplug-on-some-chips.patch queue-6.1/drm-amd-display-enable-fast-plane-updates-on-dcn3.2-and-above.patch queue-6.1/drm-amdgpu-fix-potential-null-pointer-derefernce.patch queue-6.1/drm-amd-display-avoid-null-dereference-of-timing-gen.patch queue-6.1/drm-amd-fix-ubsan-array-index-out-of-bounds-for-pola.patch queue-6.1/drm-amdgpu-smu13-drop-compute-workload-workaround.patch queue-6.1/drm-amdgpu-fix-error-handling-in-amdgpu_bo_list_get.patch