Skip to content

Commit 03a5517

Browse files
=?UTF-8?q?Christian=20K=C3=B6nig?=Bjorn Helgaas
authored andcommitted
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 <[email protected]> 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/[email protected] Fixes: fa564ad ("x86/PCI: Enable a 64bit BAR on AMD Family 15h (Models 00-1f, 30-3f, 60-7f)") Reported-by: Aaro Koskinen <[email protected]> Signed-off-by: Christian König <[email protected]> [bhelgaas: changelog, comment, Fixes:] Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent f32ab75 commit 03a5517

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

arch/x86/pci/fixup.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -662,10 +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-
unsigned i;
666665
u32 base, limit, high;
667-
struct resource *res, *conflict;
668666
struct pci_dev *other;
667+
struct resource *res;
668+
unsigned i;
669+
int r;
669670

670671
if (!(pci_probe & PCI_BIG_ROOT_WINDOW))
671672
return;
@@ -702,19 +703,20 @@ static void pci_amd_enable_64bit_bar(struct pci_dev *dev)
702703
if (!res)
703704
return;
704705

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+
*/
705710
res->name = "PCI Bus 0000:00";
706711
res->flags = IORESOURCE_PREFETCH | IORESOURCE_MEM |
707712
IORESOURCE_MEM_64 | IORESOURCE_WINDOW;
708-
res->start = 0x100000000ull;
713+
res->start = 0xbd00000000ull;
709714
res->end = 0xfd00000000ull - 1;
710715

711-
/* Just grab the free area behind system memory for this */
712-
while ((conflict = request_resource_conflict(&iomem_resource, res))) {
713-
if (conflict->end >= res->end) {
714-
kfree(res);
715-
return;
716-
}
717-
res->start = conflict->end + 1;
716+
r = request_resource(&iomem_resource, res);
717+
if (r) {
718+
kfree(res);
719+
return;
718720
}
719721

720722
dev_info(&dev->dev, "adding root bus resource %pR (tainting kernel)\n",

0 commit comments

Comments
 (0)