This is a note to let you know that I've just added the patch titled PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: pci-add-a-rebar-size-quirk-for-sapphire-rx-5600-xt-p.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 594d7023c54b331d6147282a994efb9eca1efdd6 Author: Nirmoy Das <nirmoy.das@xxxxxxx> Date: Thu Jan 7 12:26:55 2021 +0100 PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse [ 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@xxxxxxx> Signed-off-by: Nirmoy Das <nirmoy.das@xxxxxxx> Acked-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx> Link: https://patchwork.kernel.org/project/dri-devel/patch/20210107175017.15893-5-nirmoy.das@xxxxxxx Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index cd628dd73719..83fda1987d1f 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -3361,7 +3361,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; } /**