Skip to content

Commit 1f07476

Browse files
committed
Merge tag 'pci-v4.15-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI fix from Bjorn Helgaas: "Fix AMD regression due to not re-enabling the big window on resume (Christian König)" * tag 'pci-v4.15-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: x86/PCI: Enable AMD 64-bit window on resume
2 parents a84a8ab + 838cda3 commit 1f07476

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

arch/x86/pci/fixup.c

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -662,11 +662,11 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2033, quirk_no_aersid);
662662
*/
663663
static void pci_amd_enable_64bit_bar(struct pci_dev *dev)
664664
{
665+
static const char *name = "PCI Bus 0000:00";
666+
struct resource *res, *conflict;
665667
u32 base, limit, high;
666668
struct pci_dev *other;
667-
struct resource *res;
668669
unsigned i;
669-
int r;
670670

671671
if (!(pci_probe & PCI_BIG_ROOT_WINDOW))
672672
return;
@@ -707,21 +707,26 @@ static void pci_amd_enable_64bit_bar(struct pci_dev *dev)
707707
* Allocate a 256GB window directly below the 0xfd00000000 hardware
708708
* limit (see AMD Family 15h Models 30h-3Fh BKDG, sec 2.4.6).
709709
*/
710-
res->name = "PCI Bus 0000:00";
710+
res->name = name;
711711
res->flags = IORESOURCE_PREFETCH | IORESOURCE_MEM |
712712
IORESOURCE_MEM_64 | IORESOURCE_WINDOW;
713713
res->start = 0xbd00000000ull;
714714
res->end = 0xfd00000000ull - 1;
715715

716-
r = request_resource(&iomem_resource, res);
717-
if (r) {
716+
conflict = request_resource_conflict(&iomem_resource, res);
717+
if (conflict) {
718718
kfree(res);
719-
return;
720-
}
719+
if (conflict->name != name)
720+
return;
721721

722-
dev_info(&dev->dev, "adding root bus resource %pR (tainting kernel)\n",
723-
res);
724-
add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
722+
/* We are resuming from suspend; just reenable the window */
723+
res = conflict;
724+
} else {
725+
dev_info(&dev->dev, "adding root bus resource %pR (tainting kernel)\n",
726+
res);
727+
add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
728+
pci_bus_add_resource(dev->bus, res, 0);
729+
}
725730

726731
base = ((res->start >> 8) & AMD_141b_MMIO_BASE_MMIOBASE_MASK) |
727732
AMD_141b_MMIO_BASE_RE_MASK | AMD_141b_MMIO_BASE_WE_MASK;
@@ -733,13 +738,16 @@ static void pci_amd_enable_64bit_bar(struct pci_dev *dev)
733738
pci_write_config_dword(dev, AMD_141b_MMIO_HIGH(i), high);
734739
pci_write_config_dword(dev, AMD_141b_MMIO_LIMIT(i), limit);
735740
pci_write_config_dword(dev, AMD_141b_MMIO_BASE(i), base);
736-
737-
pci_bus_add_resource(dev->bus, res, 0);
738741
}
739742
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1401, pci_amd_enable_64bit_bar);
740743
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x141b, pci_amd_enable_64bit_bar);
741744
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1571, pci_amd_enable_64bit_bar);
742745
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x15b1, pci_amd_enable_64bit_bar);
743746
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1601, pci_amd_enable_64bit_bar);
747+
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x1401, pci_amd_enable_64bit_bar);
748+
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x141b, pci_amd_enable_64bit_bar);
749+
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x1571, pci_amd_enable_64bit_bar);
750+
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x15b1, pci_amd_enable_64bit_bar);
751+
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x1601, pci_amd_enable_64bit_bar);
744752

745753
#endif

0 commit comments

Comments
 (0)