Skip to contentSkip to conversation

PCI: fix Sapphire PCI rebar quirk

PATCH In review Alex Deucher 6 participants 9 messages Feb 17, 2025 – Feb 20, 2025

Subsystems (3)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/1 PCI: fix Sapphire PCI rebar quirk

There was a quirk added to add a workaround for a Sapphire RX 5600 XT Pulse. However, the quirk only checks the vendor ids and not the subsystem ids. The quirk really should have checked the subsystem vendor and device ids as now this quirk gets applied to all RX 5600 and it seems to cause problems on some Dell laptops. Add a subsystem vendor id check to limit the quirk to Sapphire boards.

Fixes 907830b0fc9e ("PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse")
Cc Christian König <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Nirmoy Das <[email protected]>
---
 drivers/pci/pci.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/pci.c +1 -0
index 225a6cd2e9ca3..dec917636974e 100644
@@ -3766,6 +3766,7 @@ u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar)
 
 	/* Sapphire RX 5600 XT Pulse has an invalid cap dword for BAR 0 */
 	if (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x731f &&
+	    pdev->subsystem_vendor == 0x1da2 &&
 	    bar == 0 && cap == 0x700)
 		return 0x3f00;
 
Signature · 1 line
2.48.1
maintainer
#1 lore raw

Am 17.02.25 um 16:10 schrieb Alex Deucher:

Quoted 7 lines

There was a quirk added to add a workaround for a Sapphire RX 5600 XT Pulse. However, the quirk only checks the vendor ids and not the subsystem ids. The quirk really should have checked the subsystem vendor and device ids as now this quirk gets applied to all RX 5600 and it seems to cause problems on some Dell laptops. Add a subsystem vendor id check to limit the quirk to Sapphire boards.

That's not correct. The issue is present on all RX 5600 boards, not just the Sapphire ones.

The problems with the Dell laptops are most likely the general instability of the RX 5600 again which this quirk just make more obvious because of the performance improvement.

Do you have a specific bug report for the Dell laptops?

Regards,
Christian.

Quoted 27 lines
Fixes 907830b0fc9e ("PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse")
Cc Christian König <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Nirmoy Das <[email protected]>
---
 drivers/pci/pci.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/pci.c +1 -0
index 225a6cd2e9ca3..dec917636974e 100644
@@ -3766,6 +3766,7 @@ u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar)
 
 	/* Sapphire RX 5600 XT Pulse has an invalid cap dword for BAR 0 */
 	if (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x731f &&
+	    pdev->subsystem_vendor == 0x1da2 &&
 
 
 
drivers/pci/pci.c +0 -0
 	    bar == 0 && cap == 0x700)
 		return 0x3f00;
#2 lore raw
Quoted 11 lines · Christian König

Am 17.02.25 um 16:10 schrieb Alex Deucher:

Quoted 7 lines

There was a quirk added to add a workaround for a Sapphire RX 5600 XT Pulse. However, the quirk only checks the vendor ids and not the subsystem ids. The quirk really should have checked the subsystem vendor and device ids as now this quirk gets applied to all RX 5600 and it seems to cause problems on some Dell laptops. Add a subsystem vendor id check to limit the quirk to Sapphire boards.

That's not correct. The issue is present on all RX 5600 boards, not just the Sapphire ones.

I suppose the alternative would be to disable resizing on the problematic DELL systems only.

Quoted 10 lines

The problems with the Dell laptops are most likely the general instability of the RX 5600 again which this quirk just make more obvious because of the performance improvement.

Do you have a specific bug report for the Dell laptops?

Regards,
Christian.

Quoted 2 lines

^^^ this bug report

Alex

Quoted 26 lines
Quoted 25 lines
Fixes 907830b0fc9e ("PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse")
Cc Christian König <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Nirmoy Das <[email protected]>
---
 drivers/pci/pci.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/pci.c +1 -0
index 225a6cd2e9ca3..dec917636974e 100644
@@ -3766,6 +3766,7 @@ u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar)
 
      /* Sapphire RX 5600 XT Pulse has an invalid cap dword for BAR 0 */
      if (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x731f &&
+         pdev->subsystem_vendor == 0x1da2 &&
 
 
 
          bar == 0 && cap == 0x700)
              return 0x3f00;
#3 lore raw
Quoted 13 lines · Alex Deucher
Quoted 10 lines · Christian König

Am 17.02.25 um 16:10 schrieb Alex Deucher:

Quoted 7 lines

There was a quirk added to add a workaround for a Sapphire RX 5600 XT Pulse. However, the quirk only checks the vendor ids and not the subsystem ids. The quirk really should have checked the subsystem vendor and device ids as now this quirk gets applied to all RX 5600 and it seems to cause problems on some Dell laptops. Add a subsystem vendor id check to limit the quirk to Sapphire boards.

Quoted 4 lines
Quoted 1 line

That's not correct. The issue is present on all RX 5600 boards, not just the Sapphire ones.

I suppose the alternative would be to disable resizing on the problematic DELL systems only.

How about this attached patch instead?

Alex

Quoted 10 lines
Quoted 10 lines

The problems with the Dell laptops are most likely the general instability of the RX 5600 again which this quirk just make more obvious because of the performance improvement.

Do you have a specific bug report for the Dell laptops?

Regards,
Christian.

Quoted 1 line
Quoted 33 lines
Quoted 1 line
Quoted 1 line

^^^ this bug report

Alex

Quoted 26 lines
Quoted 25 lines
Fixes 907830b0fc9e ("PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse")
Cc Christian König <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Nirmoy Das <[email protected]>
---
 drivers/pci/pci.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/pci.c +1 -0
index 225a6cd2e9ca3..dec917636974e 100644
@@ -3766,6 +3766,7 @@ u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar)
 
      /* Sapphire RX 5600 XT Pulse has an invalid cap dword for BAR 0 */
      if (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x731f &&
+         pdev->subsystem_vendor == 0x1da2 &&
 
 
 
          bar == 0 && cap == 0x700)
              return 0x3f00;

From 3841dd904844860863c489796710d2d9fee05bcb Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Mon, 17 Feb 2025 10:55:05 -0500
Subject: [PATCH] drm/amdgpu: disable BAR resize on Dell G5 SE

There was a quirk added to add a workaround for a Sapphire RX 5600 XT Pulse that didn't allow BAR resizing. However, the quirk casused a regression on Dell laptops using those chips, rather than narrowing the scope of the resizing quirk, add a quirk to prevent amdgpu from resizing the BAR on those Dell platforms.

Fixes 907830b0fc9e ("PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -0
index 512e642477a7e..56fd874a22de8 100644
@@ -1662,6 +1662,12 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
 	if (amdgpu_sriov_vf(adev))
 		return 0;
 
+	/* skip resizing on Dell G5 SE platforms */
+	if (adev->pdev->vendor == PCI_VENDOR_ID_ATI &&
+	    adev->pdev->device == 0x731f &&
+	    adev->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL)
+		return 0;
+
 	/* PCI_EXT_CAP_ID_VNDR extended capability is located at 0x100 */
 	if (!pci_find_ext_capability(adev->pdev, PCI_EXT_CAP_ID_VNDR))
 		DRM_WARN("System can't access extended configuration space, please check!!\n");
Signature · 1 line
2.48.1
#4 lore raw
Quoted 14 lines · Alex Deucher
Quoted 13 lines · Alex Deucher
Quoted 10 lines · Christian König

Am 17.02.25 um 16:10 schrieb Alex Deucher:

Quoted 7 lines

There was a quirk added to add a workaround for a Sapphire RX 5600 XT Pulse. However, the quirk only checks the vendor ids and not the subsystem ids. The quirk really should have checked the subsystem vendor and device ids as now this quirk gets applied to all RX 5600 and it seems to cause problems on some Dell laptops. Add a subsystem vendor id check to limit the quirk to Sapphire boards.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

That's not correct. The issue is present on all RX 5600 boards, not just the Sapphire ones.

I suppose the alternative would be to disable resizing on the problematic DELL systems only.

How about this attached patch instead?

JFYI Typo in the commit message:

s,casused,caused,

Quoted 46 lines

Alex

Quoted 43 lines
Quoted 11 lines

The problems with the Dell laptops are most likely the general instability of the RX 5600 again which this quirk just make more obvious because of the performance improvement.

Do you have a specific bug report for the Dell laptops?

Regards,
Christian.

Quoted 2 lines

^^^ this bug report

Alex

Quoted 26 lines
Quoted 25 lines
Fixes 907830b0fc9e ("PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse")
Cc Christian König <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Nirmoy Das <[email protected]>
---
  drivers/pci/pci.c | 1 +
  1 file changed, 1 insertion(+)
drivers/pci/pci.c +1 -0
index 225a6cd2e9ca3..dec917636974e 100644
@@ -3766,6 +3766,7 @@ u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar)
 
       /* Sapphire RX 5600 XT Pulse has an invalid cap dword for BAR 0 */
       if (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x731f &&
+         pdev->subsystem_vendor == 0x1da2 &&
 
 
 
           bar == 0 && cap == 0x700)
               return 0x3f00;
#5 lore raw

Am 17.02.25 um 17:04 schrieb Mario Limonciello:

Quoted 17 lines · Alex Deucher
Quoted 16 lines · Alex Deucher
Quoted 15 lines
Quoted 11 lines · Christian König

Am 17.02.25 um 16:10 schrieb Alex Deucher:

Quoted 7 lines

There was a quirk added to add a workaround for a Sapphire RX 5600 XT Pulse.  However, the quirk only checks the vendor ids and not the subsystem ids.  The quirk really should have checked the subsystem vendor and device ids as now this quirk gets applied to all RX 5600 and it seems to cause problems on some Dell laptops.  Add a subsystem vendor id check to limit the quirk to Sapphire boards.

That's not correct. The issue is present on all RX 5600 boards, not just the Sapphire ones.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

I suppose the alternative would be to disable resizing on the problematic DELL systems only.

How about this attached patch instead?

JFYI Typo in the commit message:

s,casused,caused,

With that fixed feel free to add my rb. It's just that the Dell systems are unstable even without the resizing.

The resizing just makes it more likely to hit the issue because ti massively improves performance on the RX 5600 boards.

Regards,
Christian.

Quoted 48 lines
Quoted 47 lines

Alex

Quoted 43 lines
Quoted 11 lines

The problems with the Dell laptops are most likely the general instability of the RX 5600 again which this quirk just make more obvious because of the performance improvement.

Do you have a specific bug report for the Dell laptops?

Regards,
Christian.

Quoted 2 lines

^^^ this bug report

Alex

Quoted 26 lines
Quoted 25 lines
Fixes 907830b0fc9e ("PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse")
Cc Christian König <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Nirmoy Das <[email protected]>

---
  drivers/pci/pci.c | 1 +

  1 file changed, 1 insertion(+)
drivers/pci/pci.c +0 -0
index 225a6cd2e9ca3..dec917636974e 100644
@@ -3766,6 +3766,7 @@ u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar)
 
        /* Sapphire RX 5600 XT Pulse has an invalid cap dword for BAR 0 */

       if (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x731f && +         pdev->subsystem_vendor == 0x1da2 &&

           bar == 0 && cap == 0x700)
               return 0x3f00;

#6 lore raw
Quoted 23 lines · Christian König

Am 17.02.25 um 17:04 schrieb Mario Limonciello:

Quoted 22 lines · Alex Deucher
Quoted 20 lines · Alex Deucher
Quoted 13 lines
Quoted 10 lines · Christian König

Am 17.02.25 um 16:10 schrieb Alex Deucher:

Quoted 7 lines

There was a quirk added to add a workaround for a Sapphire RX 5600 XT Pulse.  However, the quirk only checks the vendor ids and not the subsystem ids.  The quirk really should have checked the subsystem vendor and device ids as now this quirk gets applied to all RX 5600 and it seems to cause problems on some Dell laptops.  Add a subsystem vendor id check to limit the quirk to Sapphire boards.

Quoted 4 lines
Quoted 1 line

That's not correct. The issue is present on all RX 5600 boards, not just the Sapphire ones.

I suppose the alternative would be to disable resizing on the problematic DELL systems only.

How about this attached patch instead?

Quoted 8 lines
Quoted 3 lines

JFYI Typo in the commit message:

s,casused,caused,

With that fixed feel free to add my rb. It's just that the Dell systems are unstable even without the resizing.

The resizing just makes it more likely to hit the issue because ti massively improves performance on the RX 5600 boards.

As a workaround, from the thread, the most reliable one seems to be to disable runpm on the device.

Thanks,
Lijo

Quoted 52 lines

Regards,
Christian.

Quoted 48 lines
Quoted 47 lines

Alex

Quoted 43 lines
Quoted 11 lines

The problems with the Dell laptops are most likely the general instability of the RX 5600 again which this quirk just make more obvious because of the performance improvement.

Do you have a specific bug report for the Dell laptops?

Regards,
Christian.

Quoted 2 lines

^^^ this bug report

Alex

Quoted 26 lines
Quoted 25 lines
Fixes 907830b0fc9e ("PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse")
Cc Christian König <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Nirmoy Das <[email protected]>

---
  drivers/pci/pci.c | 1 +

  1 file changed, 1 insertion(+)
drivers/pci/pci.c +0 -0
index 225a6cd2e9ca3..dec917636974e 100644
@@ -3766,6 +3766,7 @@ u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar)
 
        /* Sapphire RX 5600 XT Pulse has an invalid cap dword for BAR 0 */

       if (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x731f && +         pdev->subsystem_vendor == 0x1da2 &&

           bar == 0 && cap == 0x700)
               return 0x3f00;

maintainer
#7 lore raw

Am 18.02.25 um 10:58 schrieb Lazar, Lijo:

Quoted 20 lines · Christian König
Quoted 19 lines

Am 17.02.25 um 17:04 schrieb Mario Limonciello:

Quoted 18 lines · Alex Deucher
Quoted 11 lines · Alex Deucher
Quoted 10 lines
Quoted 8 lines · Christian König

Am 17.02.25 um 16:10 schrieb Alex Deucher:

Quoted 7 lines

There was a quirk added to add a workaround for a Sapphire RX 5600 XT Pulse.  However, the quirk only checks the vendor ids and not the subsystem ids.  The quirk really should have checked the subsystem vendor and device ids as now this quirk gets applied to all RX 5600 and it seems to cause problems on some Dell laptops.  Add a subsystem vendor id check to limit the quirk to Sapphire boards.

Quoted 4 lines
Quoted 3 lines
Quoted 1 line

That's not correct. The issue is present on all RX 5600 boards, not just the Sapphire ones.

I suppose the alternative would be to disable resizing on the problematic DELL systems only.

How about this attached patch instead?

JFYI Typo in the commit message:

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

s,casused,caused,

With that fixed feel free to add my rb. It's just that the Dell systems are unstable even without the resizing.

The resizing just makes it more likely to hit the issue because ti massively improves performance on the RX 5600 boards.

As a workaround, from the thread, the most reliable one seems to be to disable runpm on the device.

Yeah, really good point. Actually trying to fix the underlying issue is my strong preference as well.

Regards,
Christian.

Quoted 46 lines

Thanks,
Lijo

Quoted 42 lines

Regards,
Christian.

Quoted 39 lines
Quoted 39 lines

Alex

Quoted 37 lines
Quoted 8 lines

The problems with the Dell laptops are most likely the general instability of the RX 5600 again which this quirk just make more obvious because of the performance improvement.

Do you have a specific bug report for the Dell laptops?

Regards,
Christian.

Quoted 1 line

^^^ this bug report

Alex

Quoted 24 lines
Quoted 24 lines
Fixes 907830b0fc9e ("PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse")
Cc Christian König <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Nirmoy Das <[email protected]>

---
  drivers/pci/pci.c | 1 +

  1 file changed, 1 insertion(+)
drivers/pci/pci.c +0 -0
index 225a6cd2e9ca3..dec917636974e 100644
@@ -3766,6 +3766,7 @@ u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar)
 
        /* Sapphire RX 5600 XT Pulse has an invalid cap dword for BAR 0 */

       if (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x731f && +         pdev->subsystem_vendor == 0x1da2 &&

           bar == 0 && cap == 0x700)
               return 0x3f00;

#8 lore raw
In reply to Alex Deucher

Dropping this patch. Will work around this in the driver.

Alex

Quoted 34 lines · Alex Deucher

There was a quirk added to add a workaround for a Sapphire RX 5600 XT Pulse. However, the quirk only checks the vendor ids and not the subsystem ids. The quirk really should have checked the subsystem vendor and device ids as now this quirk gets applied to all RX 5600 and it seems to cause problems on some Dell laptops. Add a subsystem vendor id check to limit the quirk to Sapphire boards.

Fixes 907830b0fc9e ("PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse")
Cc Christian König <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Nirmoy Das <[email protected]>
---
 drivers/pci/pci.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/pci.c +1 -1
index 225a6cd2e9ca3..dec917636974e 100644
@@ -3766,6 +3766,7 @@ u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar)
 
        /* Sapphire RX 5600 XT Pulse has an invalid cap dword for BAR 0 */
        if (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x731f &&
+           pdev->subsystem_vendor == 0x1da2 &&
            bar == 0 && cap == 0x700)
                return 0x3f00;
 
--

2.48.1