diff options
| author | =?UTF-8?q?Christian=20K=C3=B6nig?= <ckoenig.leichtzumerken@gmail.com> | 2018-01-11 08:23:30 -0500 |
|---|---|---|
| committer | Bjorn Helgaas <helgaas@kernel.org> | 2018-01-11 13:01:58 -0500 |
| commit | 03a551734cfc2b93f83950a595974e3c9cbd82fd (patch) | |
| tree | 51e78945b9696c8ec7219ed412ee75607e4a11c8 | |
| parent | f32ab7547161b9fa7ebfbc4f18ea1eb3fd49fe25 (diff) | |
x86/PCI: Move and shrink AMD 64-bit window to avoid conflict
Avoid problems with BIOS implementations which don't report all used
resources to the OS by only allocating a 256GB window directly below the
hardware limit (from the BKDG, sec 2.4.6).
Fixes a silent reboot loop reported by Aaro Koskinen <aaro.koskinen@iki.fi>
on an AMD-based MSI MS-7699/760GA-P43(FX) system. This was apparently
caused by RAM or other unreported hardware that conflicted with the new
window.
Link: https://support.amd.com/TechDocs/49125_15h_Models_30h-3Fh_BKDG.pdf
Link: https://lkml.kernel.org/r/20180105220412.fzpwqe4zljdawr36@darkstar.musicnaut.iki.fi
Fixes: fa564ad96366 ("x86/PCI: Enable a 64bit BAR on AMD Family 15h (Models 00-1f, 30-3f, 60-7f)")
Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Christian König <christian.koenig@amd.com>
[bhelgaas: changelog, comment, Fixes:]
Signed-off-by: Bjorn Helgaas <helgaas@kernel.org>
| -rw-r--r-- | arch/x86/pci/fixup.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c index 8bad19c7473d..f6a26e3cb476 100644 --- a/arch/x86/pci/fixup.c +++ b/arch/x86/pci/fixup.c | |||
| @@ -662,10 +662,11 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2033, quirk_no_aersid); | |||
| 662 | */ | 662 | */ |
| 663 | static void pci_amd_enable_64bit_bar(struct pci_dev *dev) | 663 | static void pci_amd_enable_64bit_bar(struct pci_dev *dev) |
| 664 | { | 664 | { |
| 665 | unsigned i; | ||
| 666 | u32 base, limit, high; | 665 | u32 base, limit, high; |
| 667 | struct resource *res, *conflict; | ||
| 668 | struct pci_dev *other; | 666 | struct pci_dev *other; |
| 667 | struct resource *res; | ||
| 668 | unsigned i; | ||
| 669 | int r; | ||
| 669 | 670 | ||
| 670 | if (!(pci_probe & PCI_BIG_ROOT_WINDOW)) | 671 | if (!(pci_probe & PCI_BIG_ROOT_WINDOW)) |
| 671 | return; | 672 | return; |
| @@ -702,19 +703,20 @@ static void pci_amd_enable_64bit_bar(struct pci_dev *dev) | |||
| 702 | if (!res) | 703 | if (!res) |
| 703 | return; | 704 | return; |
| 704 | 705 | ||
| 706 | /* | ||
| 707 | * Allocate a 256GB window directly below the 0xfd00000000 hardware | ||
| 708 | * limit (see AMD Family 15h Models 30h-3Fh BKDG, sec 2.4.6). | ||
| 709 | */ | ||
| 705 | res->name = "PCI Bus 0000:00"; | 710 | res->name = "PCI Bus 0000:00"; |
| 706 | res->flags = IORESOURCE_PREFETCH | IORESOURCE_MEM | | 711 | res->flags = IORESOURCE_PREFETCH | IORESOURCE_MEM | |
| 707 | IORESOURCE_MEM_64 | IORESOURCE_WINDOW; | 712 | IORESOURCE_MEM_64 | IORESOURCE_WINDOW; |
| 708 | res->start = 0x100000000ull; | 713 | res->start = 0xbd00000000ull; |
| 709 | res->end = 0xfd00000000ull - 1; | 714 | res->end = 0xfd00000000ull - 1; |
| 710 | 715 | ||
| 711 | /* Just grab the free area behind system memory for this */ | 716 | r = request_resource(&iomem_resource, res); |
| 712 | while ((conflict = request_resource_conflict(&iomem_resource, res))) { | 717 | if (r) { |
| 713 | if (conflict->end >= res->end) { | 718 | kfree(res); |
| 714 | kfree(res); | 719 | return; |
| 715 | return; | ||
| 716 | } | ||
| 717 | res->start = conflict->end + 1; | ||
| 718 | } | 720 | } |
| 719 | 721 | ||
| 720 | dev_info(&dev->dev, "adding root bus resource %pR (tainting kernel)\n", | 722 | dev_info(&dev->dev, "adding root bus resource %pR (tainting kernel)\n", |
