linux-next: manual merge of the amdgpu tree with the drm-fixes tree
From: Mark Brown
Date: Fri Sep 18 2026 - 08:47:02 EST
Hi all,
Today's linux-next merge of the amdgpu tree got a conflict in:
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
between commit:
04de4007d3238 ("drm/amdgpu: Fix GPU PCIe link capability reporting")
from the drm-fixes tree and commits:
7ea6a47224e2c ("drm/amdgpu: Fix GPU PCIe link capability reporting")
15b2b06744561 ("drm/amdgpu: Reuse cached PCIe link device")
from the amdgpu tree.
I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.
diff --combined drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index cf39db90dfe0a,dcf72ff438889..0000000000000
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@@ -68,6 -68,7 +68,7 @@@
#include "amdgpu_vf_error.h"
#include "amdgpu_amdkfd.h"
+ #include "amdgpu_ip.h"
#include "amdgpu_pm.h"
#include "amdgpu_xgmi.h"
@@@ -1353,31 -1354,6 +1354,6 @@@ static bool amdgpu_device_aspm_support_
#endif
}
- /*
- * Some dGPUs expose their display endpoint below an internal PCIe switch.
- * Use the switch upstream port to query the host-facing link.
- */
- static struct pci_dev *amdgpu_device_get_aspm_pdev(struct amdgpu_device *adev)
- {
- struct pci_dev *swds, *swus;
-
- swds = pci_upstream_bridge(adev->pdev);
- if (!swds ||
- (swds->vendor != PCI_VENDOR_ID_ATI &&
- swds->vendor != PCI_VENDOR_ID_AMD) ||
- pci_pcie_type(swds) != PCI_EXP_TYPE_DOWNSTREAM)
- return adev->pdev;
-
- swus = pci_upstream_bridge(swds);
- if (!swus ||
- (swus->vendor != PCI_VENDOR_ID_ATI &&
- swus->vendor != PCI_VENDOR_ID_AMD) ||
- pci_pcie_type(swus) != PCI_EXP_TYPE_UPSTREAM)
- return adev->pdev;
-
- return swus;
- }
-
/**
* amdgpu_device_should_use_aspm - check if the device should program ASPM
*
@@@ -1413,7 -1389,7 +1389,7 @@@ bool amdgpu_device_should_use_aspm(stru
* the immediate upstream bridge. Use SWUS for dGPUs with an
* internal switch so that this is the host-facing link.
*/
- aspm_pdev = amdgpu_device_get_aspm_pdev(adev);
+ aspm_pdev = adev->link_dev;
parent = pci_upstream_bridge(aspm_pdev);
if (!parent) {
dev_dbg(adev->dev, "ASPM: no upstream PCIe link for %s\n",
@@@ -1739,17 -1715,10 +1715,17 @@@ static bool amdgpu_switcheroo_can_switc
return atomic_read(&dev->open_count) == 0;
}
+static void amdgpu_switcheroo_pre_switch(struct pci_dev *pdev)
+{
+ struct drm_device *dev = pci_get_drvdata(pdev);
+
+ drm_client_dev_acquire_outputs(dev);
+}
+
static const struct vga_switcheroo_client_ops amdgpu_switcheroo_ops = {
.set_gpu_state = amdgpu_switcheroo_set_state,
- .reprobe = NULL,
.can_switch = amdgpu_switcheroo_can_switch,
+ .pre_switch = amdgpu_switcheroo_pre_switch,
};
/**
@@@ -1968,15 -1937,26 +1944,26 @@@ static void amdgpu_uid_fini(struct amdg
static void amdgpu_device_init_pcie_links(struct amdgpu_device *adev)
{
+ struct pci_dev *swds, *swus;
+
adev->link_dev = adev->pdev;
adev->link_partner = pci_upstream_bridge(adev->link_dev);
- /* Skip upstream/downstream switches internal to the dGPU. */
- while (adev->link_partner &&
- adev->link_partner->vendor == PCI_VENDOR_ID_ATI) {
- adev->link_dev = adev->link_partner;
- adev->link_partner = pci_upstream_bridge(adev->link_dev);
- }
+ /* Skip an upstream/downstream switch internal to the dGPU. */
+ swds = adev->link_partner;
+ if (!swds || swds->vendor != PCI_VENDOR_ID_ATI ||
+ pci_pcie_type(swds) != PCI_EXP_TYPE_DOWNSTREAM)
+ return;
+
+ swus = pci_upstream_bridge(swds);
+ if (!swus ||
+ (swus->vendor != PCI_VENDOR_ID_ATI &&
+ swus->vendor != PCI_VENDOR_ID_AMD) ||
+ pci_pcie_type(swus) != PCI_EXP_TYPE_UPSTREAM)
+ return;
+
+ adev->link_dev = swus;
+ adev->link_partner = pci_upstream_bridge(swus);
}
/**
@@@ -3855,6 -3835,7 +3842,7 @@@ int amdgpu_device_init(struct amdgpu_de
spin_lock_init(&adev->irq.lock);
+ amdgpu_ip_map_init(adev);
amdgpu_early_init_rlc_reg_funcs(adev);
amdgpu_device_init_apu_flags(adev);
@@@ -6434,16 -6415,10 +6422,10 @@@ static void amdgpu_device_cache_switch_
struct pci_dev *swus, *swds;
int r;
+ swus = adev->link_dev != adev->pdev ? adev->link_dev : NULL;
+ if (!swus)
+ return;
swds = pci_upstream_bridge(adev->pdev);
- if (!swds || swds->vendor != PCI_VENDOR_ID_ATI ||
- pci_pcie_type(swds) != PCI_EXP_TYPE_DOWNSTREAM)
- return;
- swus = pci_upstream_bridge(swds);
- if (!swus ||
- (swus->vendor != PCI_VENDOR_ID_ATI &&
- swus->vendor != PCI_VENDOR_ID_AMD) ||
- pci_pcie_type(swus) != PCI_EXP_TYPE_UPSTREAM)
- return;
/* If already saved, return */
if (adev->pcie_reset_ctx.swus)
Attachment:
signature.asc
Description: PGP signature