Skip to content

Commit f32ab75

Browse files
=?UTF-8?q?Christian=20K=C3=B6nig?=Bjorn Helgaas
authored andcommitted
x86/PCI: Add "pci=big_root_window" option for AMD 64-bit windows
Only try to enable a 64-bit window on AMD CPUs when "pci=big_root_window" is specified. This taints the kernel because the new 64-bit window uses address space we don't know anything about, and it may contain unreported devices or memory that would conflict with the window. The pci_amd_enable_64bit_bar() quirk that enables the window is specific to AMD CPUs. The generic solution would be to have the firmware enable the window and describe it in the host bridge's _CRS method, or at least describe it in the _PRS method so the OS would have the option of enabling it. Signed-off-by: Christian König <[email protected]> [bhelgaas: changelog, extend doc, mention taint in dmesg] Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent 1291a0d commit f32ab75

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3094,6 +3094,12 @@
30943094
pcie_scan_all Scan all possible PCIe devices. Otherwise we
30953095
only look for one device below a PCIe downstream
30963096
port.
3097+
big_root_window Try to add a big 64bit memory window to the PCIe
3098+
root complex on AMD CPUs. Some GFX hardware
3099+
can resize a BAR to allow access to all VRAM.
3100+
Adding the window is slightly risky (it may
3101+
conflict with unreported devices), so this
3102+
taints the kernel.
30973103

30983104
pcie_aspm= [PCIE] Forcibly enable or disable PCIe Active State Power
30993105
Management.

arch/x86/include/asm/pci_x86.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ do { \
3838
#define PCI_NOASSIGN_ROMS 0x80000
3939
#define PCI_ROOT_NO_CRS 0x100000
4040
#define PCI_NOASSIGN_BARS 0x200000
41+
#define PCI_BIG_ROOT_WINDOW 0x400000
4142

4243
extern unsigned int pci_probe;
4344
extern unsigned long pirq_table_addr;

arch/x86/pci/common.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,11 @@ char *__init pcibios_setup(char *str)
594594
} else if (!strcmp(str, "nocrs")) {
595595
pci_probe |= PCI_ROOT_NO_CRS;
596596
return NULL;
597+
#ifdef CONFIG_PHYS_ADDR_T_64BIT
598+
} else if (!strcmp(str, "big_root_window")) {
599+
pci_probe |= PCI_BIG_ROOT_WINDOW;
600+
return NULL;
601+
#endif
597602
} else if (!strcmp(str, "earlydump")) {
598603
pci_early_dump_regs = 1;
599604
return NULL;

arch/x86/pci/fixup.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,9 @@ static void pci_amd_enable_64bit_bar(struct pci_dev *dev)
667667
struct resource *res, *conflict;
668668
struct pci_dev *other;
669669

670+
if (!(pci_probe & PCI_BIG_ROOT_WINDOW))
671+
return;
672+
670673
/* Check that we are the only device of that type */
671674
other = pci_get_device(dev->vendor, dev->device, NULL);
672675
if (other != dev ||
@@ -714,7 +717,9 @@ static void pci_amd_enable_64bit_bar(struct pci_dev *dev)
714717
res->start = conflict->end + 1;
715718
}
716719

717-
dev_info(&dev->dev, "adding root bus resource %pR\n", res);
720+
dev_info(&dev->dev, "adding root bus resource %pR (tainting kernel)\n",
721+
res);
722+
add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
718723

719724
base = ((res->start >> 8) & AMD_141b_MMIO_BASE_MMIOBASE_MASK) |
720725
AMD_141b_MMIO_BASE_RE_MASK | AMD_141b_MMIO_BASE_WE_MASK;

0 commit comments

Comments
 (0)