FAILED: patch "[PATCH] drm/amdgpu: Fix GPU PCIe link capability reporting" failed to apply to 7.2-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 7.2-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-7.2.y
git checkout FETCH_HEAD
git cherry-pick -x 04de4007d32385b8b6a5dd72bff3146dfdc592c3
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026092210-sprinkled-coherent-e132@gregkh' --subject-prefix 'PATCH 7.2.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 04de4007d32385b8b6a5dd72bff3146dfdc592c3 Mon Sep 17 00:00:00 2001
From: Mario Limonciello <[email protected]>
Date: Tue, 15 Sep 2026 10:59:45 -0500
Subject: [PATCH] drm/amdgpu: Fix GPU PCIe link capability reporting
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Commit eb53125a7ad9 ("drm/amd: Add dedicated helper for amdgpu_device_find_parent()") made amdgpu_device_gpu_bandwidth() query the first device outside the dGPU. That is the host side of the physical link, not the GPU side.
As a result, the ASIC and platform capability masks can both be based on the host port. drm_amdgpu_info_device then exposes the host capabilities to userspace, such as Gen5 x16 for a Gen4 x8 GPU.
Cache both ends of the physical link during device initialization. Use link_dev for the GPU capability and link_partner for the platform capability and _PR3 detection.
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3 -0
@@ -621,6 +621,9 @@ enum amdgpu_enforce_isolation_mode {struct amdgpu_device {struct device *dev;struct pci_dev *pdev; +/* The two ends of the physical PCIe link outside the device. */ +struct pci_dev *link_dev; +struct pci_dev *link_partner;struct drm_device ddev;#ifdef CONFIG_DRM_AMD_ACP
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +17 -31
90 lines not on this page · raw message
Sasha Levin
maintainerPATCH 1/2 drm/amdgpu: reduce early full GPU access during SR-IOV init
From: chong li <[email protected]>
[ Upstream commit cba4928cdffaa0f9012acff0ec4f896320107077 ]
Allow early FB reads to fall back to BAR0 when the VRAM aperture is not ready. This lets SR-IOV VFs consume host-provided init data before requesting full GPU access.
For ASICs that support request_init_data,
defer full GPU access until after non-GPU early init to shorten the full-access window.
Legacy ASICs(before NV12) do not send request_init_data; the host dumps init data only during full GPU access, so keep the original early full-access request path for them.
Stable-dep-of: 04de4007d323 ("drm/amdgpu: Fix GPU PCIe link capability reporting")
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 88 ++++++++++++++++++++-- drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c | 7 +- 2 files changed, 88 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +83 -5
@@ -750,6 +750,64 @@ void amdgpu_device_mm_access(struct amdgpu_device *adev, loff_t pos,drm_dev_exit (idx); } +#ifdef CONFIG_64BIT +/* +* During early SR-IOV VF init, host-provided init data can live in FB before +* the normal VRAM aperture mapping is ready. Use a temporary BAR0 mapping for +* reads only, and verify it matches the VRAM aperture when aperture information +* is already available. +*/ +static int amdgpu_device_read_fb_via_bar0 (struct amdgpu_device *adev, +u64 offset,void *buf,size_t size) +{ +resource_size_t aper_base, aper_size, bar_start, bar_size, map_base; +void __iomem *vram; +size_t map_offset, map_size; +unsigned long flags; +u64 end; + +if (!buf || !size) +return -EINVAL ; + + flags =pci_resource_flags (adev->pdev,0 ); +if ((flags &IORESOURCE_UNSET ) || !(flags &IORESOURCE_MEM )) +return -EINVAL ; + + bar_start =pci_resource_start (adev->pdev,0 ); + bar_size =pci_resource_len (adev->pdev,0 ); +if (!bar_size) +return -ENODEV ; + + aper_base = adev->gmc.aper_base; + aper_size = adev->gmc.visible_vram_size ? adev->gmc.visible_vram_size : + adev->gmc.aper_size; + +if (aper_base || aper_size) { +if (aper_base != bar_start || aper_size > bar_size) +return -EINVAL ; + }else { + aper_base = bar_start; + aper_size = bar_size; + } + +if (check_add_overflow (offset, size, &end) || end > aper_size) +return -EINVAL ; + + map_offset =offset_in_page (offset); + map_base = aper_base + (offset &PAGE_MASK ); + map_size =PAGE_ALIGN (map_offset + size); + + vram =ioremap_wc (map_base, map_size); +if (!vram) +return -ENOMEM ; + +memcpy_fromio (buf, (u8 __iomem *)vram + map_offset, size); +iounmap (vram); + +return 0 ; +} +#endif +/** * amdgpu_device_aper_access - access vram by vram aperture *
@@ -769,8 +827,12 @@ size_t amdgpu_device_aper_access(struct amdgpu_device *adev, loff_t pos,size_t count =0 ;uint64_t last; -if (!adev->mman.aper_base_kaddr) +if (!adev->mman.aper_base_kaddr) { +/* Writes still require the regular aperture/MM path. */ +if (!write && !amdgpu_device_read_fb_via_bar0 (adev, pos, buf, size)) +return size;return 0 ; + } last =min (pos + size, adev->gmc.visible_vram_size);if (last > pos) {
@@ -2011,16 +2073,25 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev) {struct amdgpu_ip_block *ip_block;struct pci_dev *parent; -bool total, skip_bios; +bool total, skip_bios, early_full_gpu_access = false;uint32_t bios_flags;int i, r;amdgpu_device_enable_virtual_display (adev);if (amdgpu_sriov_vf (adev)) { - r =amdgpu_virt_request_full_gpu (adev, true); -if (r) -return r; +/* +* Legacy hosts do not provide init data before early init, so +* keep the original early full GPU access request for them. Newer +* hosts publish the init data through VF FB, which lets us defer +* full GPU access until after non-GPU early init work is done. +*/ + early_full_gpu_access = (adev->virt.req_init_data_ver ==0 ); +if (early_full_gpu_access) { + r =amdgpu_virt_request_full_gpu (adev, true); +if (r) +return r; + } r =amdgpu_virt_init_critical_region (adev);if (r)
@@ -2183,6 +2254,13 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)if (!total)return -ENODEV ; +/* Request full GPU access only for the remaining SR-IOV init work. */ +if (amdgpu_sriov_vf (adev) && !early_full_gpu_access) { + r =amdgpu_virt_request_full_gpu (adev, true); +if (r) +return r; + } +if (adev->gmc.xgmi.supported)amdgpu_xgmi_early_init (adev);
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +5 -2
@@ -185,8 +185,11 @@ static int xgpu_ai_send_access_requests(struct amdgpu_device *adev, }else if (req ==IDH_REQ_GPU_INIT_DATA ){/* Dummy REQ_GPU_INIT_DATA handling */ r =xgpu_ai_poll_msg (adev,IDH_REQ_GPU_INIT_DATA_READY ); -/* version set to 0 since dummy */ - adev->virt.req_init_data_ver =0 ; +/* +* AI uses the GPU_CRIT_REGION_V1 layout in practice, so fix the +* dummy version value to match the actual init-data format. +*/ + adev->virt.req_init_data_ver =GPU_CRIT_REGION_V1 ; }return 0 ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 drm/amdgpu: Fix GPU PCIe link capability reporting
From: Mario Limonciello <[email protected]>
[ Upstream commit 04de4007d32385b8b6a5dd72bff3146dfdc592c3 ]
Commit eb53125a7ad9 ("drm/amd: Add dedicated helper for amdgpu_device_find_parent()") made amdgpu_device_gpu_bandwidth() query the first device outside the dGPU. That is the host side of the physical link, not the GPU side.
As a result, the ASIC and platform capability masks can both be based on the host port. drm_amdgpu_info_device then exposes the host capabilities to userspace, such as Gen5 x16 for a Gen4 x8 GPU.
Cache both ends of the physical link during device initialization. Use link_dev for the GPU capability and link_partner for the platform capability and _PR3 detection.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 48 ++++++++-------------- 2 files changed, 20 insertions(+), 31 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3 -0
@@ -822,6 +822,9 @@ enum amdgpu_enforce_isolation_mode {struct amdgpu_device {struct device *dev;struct pci_dev *pdev; +/* The two ends of the physical PCIe link outside the device. */ +struct pci_dev *link_dev; +struct pci_dev *link_partner;struct drm_device ddev;#ifdef CONFIG_DRM_AMD_ACP
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +17 -31
90 lines not on this page · raw message
Signature · 1 line
2.53.0