Skip to contentSkip to conversation

PCI (& drm/amdgpu): BAR to be excluded depends on HW generation

PATCH In review Ilpo Järvinen 3 participants 3 messages Nov 14, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI (& drm/amdgpu): BAR to be excluded depends on HW generation

Depending on HW generation, BAR that needs to be excluded from pci_resize_resource() is either 2 or 5.

---

This change should be be folded into the commit 73cd7ee85e78 ("PCI: Fix restoring BARs on BAR resize rollback path") in the pci/resource branch.

Also the changelog should be changed: "(BAR 5)" -> "(BAR 2 or 5)".

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -1
index 4e241836ae68..bf0bc38e1c47 100644
@@ -1736,7 +1736,9 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
 
 	pci_release_resource(adev->pdev, 0);
 
-	r = pci_resize_resource(adev->pdev, 0, rbar_size, 1 << 5);
+	r = pci_resize_resource(adev->pdev, 0, rbar_size,
+				(adev->asic_type >= CHIP_BONAIRE) ? 1 << 5
+								  : 1 << 2);
 	if (r == -ENOSPC)
 		dev_info(adev->dev,
 			 "Not enough PCI address space for a large BAR.");

base-commit: 73cd7ee85e788bc2541bfce2500e3587cf79f081

Signature · 1 line
2.39.5
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Ilpo Järvinen

Depending on HW generation, BAR that needs to be excluded from pci_resize_resource() is either 2 or 5.

If necessary feel free to add Acked-by: Christian König <[email protected]> to the amdgpu patch in this set as well.

Regards,
Christian.

Quoted 28 lines

---

This change should be be folded into the commit 73cd7ee85e78 ("PCI: Fix restoring BARs on BAR resize rollback path") in the pci/resource branch.

Also the changelog should be changed: "(BAR 5)" -> "(BAR 2 or 5)".

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -1
index 4e241836ae68..bf0bc38e1c47 100644
@@ -1736,7 +1736,9 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
 
 	pci_release_resource(adev->pdev, 0);
 
-	r = pci_resize_resource(adev->pdev, 0, rbar_size, 1 << 5);
+	r = pci_resize_resource(adev->pdev, 0, rbar_size,
+				(adev->asic_type >= CHIP_BONAIRE) ? 1 << 5
+								  : 1 << 2);
 	if (r == -ENOSPC)
 		dev_info(adev->dev,
 			 "Not enough PCI address space for a large BAR.");

base-commit: 73cd7ee85e788bc2541bfce2500e3587cf79f081

#2 lore raw
In reply to Ilpo Järvinen
Quoted 7 lines · Ilpo Järvinen

Depending on HW generation, BAR that needs to be excluded from pci_resize_resource() is either 2 or 5.

---

Quoted 8 lines

This change should be be folded into the commit 73cd7ee85e78 ("PCI: Fix restoring BARs on BAR resize rollback path") in the pci/resource branch.

Also the changelog should be changed: "(BAR 5)" -> "(BAR 2 or 5)".

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Squashed into 73cd7ee85e78, thanks:

https://git.kernel.org/cgit/linux/kernel/git/pci/pci.git/commit/?id=40a8789930e2

Quoted 20 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -1
index 4e241836ae68..bf0bc38e1c47 100644
@@ -1736,7 +1736,9 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
 
 	pci_release_resource(adev->pdev, 0);
 
-	r = pci_resize_resource(adev->pdev, 0, rbar_size, 1 << 5);
+	r = pci_resize_resource(adev->pdev, 0, rbar_size,
+				(adev->asic_type >= CHIP_BONAIRE) ? 1 << 5
+								  : 1 << 2);
 	if (r == -ENOSPC)
 		dev_info(adev->dev,
 			 "Not enough PCI address space for a large BAR.");

base-commit: 73cd7ee85e788bc2541bfce2500e3587cf79f081

Signature · 1 line
2.39.5