Files
stambha/third_party/patches/linux/0225-find-the-gpus.patch
T

68 lines
2.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tyler Smith <74526874+tylertms@users.noreply.github.com>
Date: Wed, 18 Nov 2026 09:19:06 +0000
Subject: [PATCH] fix(amdgpu): find the GPU's PCIe link partner among the ports
above it, as Linux finds it among the bridges
Stela's PCI tree has no bridges, so pci_upstream_bridge finds none above
the GPU and pci_is_root_bus holds for every GPU: amdgpu took its default
platform mask (2.5 and 5 GT/s) and capped its PCIe power levels at 5 GT/s
on every discrete GPU. Find the link partner among the ports the GPU's
owner read (stela_linux_pci_upstream), read-only, and take the GPU as on
a root bus only when no port stands above it.
---
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 13bfc05e4607f8f6d3bc3beb1d188c25e7286f31..eaa8340ffbb288833147b4f040a4763cd1036cf7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -89,6 +89,9 @@
#include <asm/intel-family.h>
#include <asm/cpu_device_id.h>
#endif
+#if IS_ENABLED(CONFIG_STELA)
+#include <stela/pci.h>
+#endif
MODULE_FIRMWARE("amdgpu/vega10_gpu_info.bin");
MODULE_FIRMWARE("amdgpu/vega12_gpu_info.bin");
@@ -2050,6 +2053,12 @@ static void amdgpu_uid_fini(struct amdgpu_device *adev)
static void amdgpu_device_init_pcie_links(struct amdgpu_device *adev)
{
+#if IS_ENABLED(CONFIG_STELA)
+ /* Stela: its PCI tree has no bridges; the ports above the GPU, which
+ * its owner read, stand in for them here, read-only, so the link
+ * partner is the port Linux finds. */
+#define pci_upstream_bridge stela_linux_pci_upstream
+#endif
adev->link_dev = adev->pdev;
adev->link_partner = pci_upstream_bridge(adev->link_dev);
@@ -2059,6 +2068,9 @@ static void amdgpu_device_init_pcie_links(struct amdgpu_device *adev)
adev->link_dev = adev->link_partner;
adev->link_partner = pci_upstream_bridge(adev->link_dev);
}
+#if IS_ENABLED(CONFIG_STELA)
+#undef pci_upstream_bridge
+#endif
}
/**
@@ -6204,7 +6216,13 @@ static void amdgpu_device_get_pcie_info(struct amdgpu_device *adev)
adev->pm.pcie_mlw_mask = amdgpu_pcie_lane_cap;
/* covers APUs as well */
+#if IS_ENABLED(CONFIG_STELA)
+ /* Stela: every function sits on a bus of its own; it is on a root bus
+ * when no port stands above it. */
+ if (!stela_linux_pci_upstream(adev->pdev) && !amdgpu_passthrough(adev)) {
+#else
if (pci_is_root_bus(adev->pdev->bus) && !amdgpu_passthrough(adev)) {
+#endif
if (adev->pm.pcie_gen_mask == 0)
adev->pm.pcie_gen_mask = AMDGPU_DEFAULT_PCIE_GEN_MASK;
if (adev->pm.pcie_mlw_mask == 0)