]> git.itanic.dy.fi Git - linux-stable/commitdiff
PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse
authorNirmoy Das <nirmoy.das@amd.com>
Thu, 7 Jan 2021 11:26:55 +0000 (12:26 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 7 Mar 2021 11:20:46 +0000 (12:20 +0100)
[ Upstream commit 907830b0fc9e374d00f3c83de5e426157b482c01 ]

RX 5600 XT Pulse advertises support for BAR 0 being 256MB, 512MB,
or 1GB, but it also supports 2GB, 4GB, and 8GB. Add a rebar
size quirk so that the BAR 0 is big enough to cover complete VARM.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20210107175017.15893-5-nirmoy.das@amd.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pci/pci.c

index 89dece8a41321b6b7cbe8b6f69fb894382fe37ac..9add26438be50bc5b27f28aefde5bf15c8bc83ca 100644 (file)
@@ -3471,7 +3471,14 @@ u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar)
                return 0;
 
        pci_read_config_dword(pdev, pos + PCI_REBAR_CAP, &cap);
-       return (cap & PCI_REBAR_CAP_SIZES) >> 4;
+       cap &= PCI_REBAR_CAP_SIZES;
+
+       /* Sapphire RX 5600 XT Pulse has an invalid cap dword for BAR 0 */
+       if (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x731f &&
+           bar == 0 && cap == 0x7000)
+               cap = 0x3f000;
+
+       return cap >> 4;
 }
 
 /**