aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-01-23 15:45:40 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-01-23 15:45:40 -0500
commit1f07476ec143bbed7bf0b641749783b1094b4c4f (patch)
tree03c947c3139efbb0a193f927bb8a33be661fe220
parenta84a8ab94ed5cb65a1355fe9e8d1d55283375808 (diff)
parent838cda3697073982acd276ac43387b2a0aed04b4 (diff)
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
-rw-r--r--arch/x86/pci/fixup.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index f6a26e3cb476..54ef19e90705 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -662,11 +662,11 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2033, quirk_no_aersid);
662 */ 662 */
663static void pci_amd_enable_64bit_bar(struct pci_dev *dev) 663static void pci_amd_enable_64bit_bar(struct pci_dev *dev)
664{ 664{
665 static const char *name = "PCI Bus 0000:00";
666 struct resource *res, *conflict;
665 u32 base, limit, high; 667 u32 base, limit, high;
666 struct pci_dev *other; 668 struct pci_dev *other;
667 struct resource *res;
668 unsigned i; 669 unsigned i;
669 int r;
670 670
671 if (!(pci_probe & PCI_BIG_ROOT_WINDOW)) 671 if (!(pci_probe & PCI_BIG_ROOT_WINDOW))
672 return; 672 return;
@@ -707,21 +707,26 @@ static void pci_amd_enable_64bit_bar(struct pci_dev *dev)
707 * Allocate a 256GB window directly below the 0xfd00000000 hardware 707 * Allocate a 256GB window directly below the 0xfd00000000 hardware
708 * limit (see AMD Family 15h Models 30h-3Fh BKDG, sec 2.4.6). 708 * limit (see AMD Family 15h Models 30h-3Fh BKDG, sec 2.4.6).
709 */ 709 */
710 res->name = "PCI Bus 0000:00"; 710 res->name = name;
711 res->flags = IORESOURCE_PREFETCH | IORESOURCE_MEM | 711 res->flags = IORESOURCE_PREFETCH | IORESOURCE_MEM |
712 IORESOURCE_MEM_64 | IORESOURCE_WINDOW; 712 IORESOURCE_MEM_64 | IORESOURCE_WINDOW;
713 res->start = 0xbd00000000ull; 713 res->start = 0xbd00000000ull;
714 res->end = 0xfd00000000ull - 1; 714 res->end = 0xfd00000000ull - 1;
715 715
716 r = request_resource(&iomem_resource, res); 716 conflict = request_resource_conflict(&iomem_resource, res);
717 if (r) { 717 if (conflict) {
718 kfree(res); 718 kfree(res);
719 return; 719 if (conflict->name != name)
720 } 720 return;
721 721
722 dev_info(&dev->dev, "adding root bus resource %pR (tainting kernel)\n", 722 /* We are resuming from suspend; just reenable the window */
723 res); 723 res = conflict;
724 add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); 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 }
725 730
726 base = ((res->start >> 8) & AMD_141b_MMIO_BASE_MMIOBASE_MASK) | 731 base = ((res->start >> 8) & AMD_141b_MMIO_BASE_MMIOBASE_MASK) |
727 AMD_141b_MMIO_BASE_RE_MASK | AMD_141b_MMIO_BASE_WE_MASK; 732 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)
733 pci_write_config_dword(dev, AMD_141b_MMIO_HIGH(i), high); 738 pci_write_config_dword(dev, AMD_141b_MMIO_HIGH(i), high);
734 pci_write_config_dword(dev, AMD_141b_MMIO_LIMIT(i), limit); 739 pci_write_config_dword(dev, AMD_141b_MMIO_LIMIT(i), limit);
735 pci_write_config_dword(dev, AMD_141b_MMIO_BASE(i), base); 740 pci_write_config_dword(dev, AMD_141b_MMIO_BASE(i), base);
736
737 pci_bus_add_resource(dev->bus, res, 0);
738} 741}
739DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1401, pci_amd_enable_64bit_bar); 742DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1401, pci_amd_enable_64bit_bar);
740DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x141b, pci_amd_enable_64bit_bar); 743DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x141b, pci_amd_enable_64bit_bar);
741DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1571, pci_amd_enable_64bit_bar); 744DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1571, pci_amd_enable_64bit_bar);
742DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x15b1, pci_amd_enable_64bit_bar); 745DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x15b1, pci_amd_enable_64bit_bar);
743DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1601, pci_amd_enable_64bit_bar); 746DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1601, pci_amd_enable_64bit_bar);
747DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x1401, pci_amd_enable_64bit_bar);
748DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x141b, pci_amd_enable_64bit_bar);
749DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x1571, pci_amd_enable_64bit_bar);
750DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x15b1, pci_amd_enable_64bit_bar);
751DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x1601, pci_amd_enable_64bit_bar);
744 752
745#endif 753#endif