Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'pci-v5.19-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci

Pull pci fix from Bjorn Helgaas:
"Revert clipping of PCI host bridge windows to avoid E820 regions,
which broke several machines by forcing unnecessary BAR reassignments
(Hans de Goede)"

* tag 'pci-v5.19-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
x86/PCI: Revert "x86/PCI: Clip only host bridge windows for E820 regions"

+18 -17
-5
arch/x86/include/asm/e820/api.h
··· 4 4 5 5 #include <asm/e820/types.h> 6 6 7 - struct device; 8 - struct resource; 9 - 10 7 extern struct e820_table *e820_table; 11 8 extern struct e820_table *e820_table_kexec; 12 9 extern struct e820_table *e820_table_firmware; ··· 42 45 extern void e820__register_nosave_regions(unsigned long limit_pfn); 43 46 44 47 extern int e820__get_entry_type(u64 start, u64 end); 45 - 46 - extern void remove_e820_regions(struct device *dev, struct resource *avail); 47 48 48 49 /* 49 50 * Returns true iff the specified range [start,end) is completely contained inside
+8
arch/x86/include/asm/pci_x86.h
··· 69 69 70 70 /* pci-irq.c */ 71 71 72 + struct pci_dev; 73 + 72 74 struct irq_info { 73 75 u8 bus, devfn; /* Bus, device and function */ 74 76 struct { ··· 247 245 # define x86_default_pci_init NULL 248 246 # define x86_default_pci_init_irq NULL 249 247 # define x86_default_pci_fixup_irqs NULL 248 + #endif 249 + 250 + #if defined(CONFIG_PCI) && defined(CONFIG_ACPI) 251 + extern bool pci_use_e820; 252 + #else 253 + #define pci_use_e820 false 250 254 #endif
+9 -5
arch/x86/kernel/resource.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 - #include <linux/dev_printk.h> 3 2 #include <linux/ioport.h> 3 + #include <linux/printk.h> 4 4 #include <asm/e820/api.h> 5 + #include <asm/pci_x86.h> 5 6 6 7 static void resource_clip(struct resource *res, resource_size_t start, 7 8 resource_size_t end) ··· 25 24 res->start = end + 1; 26 25 } 27 26 28 - void remove_e820_regions(struct device *dev, struct resource *avail) 27 + static void remove_e820_regions(struct resource *avail) 29 28 { 30 29 int i; 31 30 struct e820_entry *entry; 32 31 u64 e820_start, e820_end; 33 32 struct resource orig = *avail; 34 33 35 - if (!(avail->flags & IORESOURCE_MEM)) 34 + if (!pci_use_e820) 36 35 return; 37 36 38 37 for (i = 0; i < e820_table->nr_entries; i++) { ··· 42 41 43 42 resource_clip(avail, e820_start, e820_end); 44 43 if (orig.start != avail->start || orig.end != avail->end) { 45 - dev_info(dev, "clipped %pR to %pR for e820 entry [mem %#010Lx-%#010Lx]\n", 44 + pr_info("clipped %pR to %pR for e820 entry [mem %#010Lx-%#010Lx]\n", 46 45 &orig, avail, e820_start, e820_end); 47 46 orig = *avail; 48 47 } ··· 56 55 * the low 1MB unconditionally, as this area is needed for some ISA 57 56 * cards requiring a memory range, e.g. the i82365 PCMCIA controller. 58 57 */ 59 - if (avail->flags & IORESOURCE_MEM) 58 + if (avail->flags & IORESOURCE_MEM) { 60 59 resource_clip(avail, BIOS_ROM_BASE, BIOS_ROM_END); 60 + 61 + remove_e820_regions(avail); 62 + } 61 63 }
+1 -7
arch/x86/pci/acpi.c
··· 8 8 #include <linux/pci-acpi.h> 9 9 #include <asm/numa.h> 10 10 #include <asm/pci_x86.h> 11 - #include <asm/e820/api.h> 12 11 13 12 struct pci_root_info { 14 13 struct acpi_pci_root_info common; ··· 19 20 #endif 20 21 }; 21 22 22 - static bool pci_use_e820 = true; 23 + bool pci_use_e820 = true; 23 24 static bool pci_use_crs = true; 24 25 static bool pci_ignore_seg; 25 26 ··· 385 386 int status; 386 387 387 388 status = acpi_pci_probe_root_resources(ci); 388 - 389 - if (pci_use_e820) { 390 - resource_list_for_each_entry(entry, &ci->resources) 391 - remove_e820_regions(&device->dev, entry->res); 392 - } 393 389 394 390 if (pci_use_crs) { 395 391 resource_list_for_each_entry_safe(entry, tmp, &ci->resources)