Skip to content

Commit 32efdbf

Browse files
committed
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"
2 parents 93d17c1 + a2b36ff commit 32efdbf

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

arch/x86/include/asm/e820/api.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
#include <asm/e820/types.h>
66

7-
struct device;
8-
struct resource;
9-
107
extern struct e820_table *e820_table;
118
extern struct e820_table *e820_table_kexec;
129
extern struct e820_table *e820_table_firmware;
@@ -46,8 +43,6 @@ extern void e820__register_nosave_regions(unsigned long limit_pfn);
4643

4744
extern int e820__get_entry_type(u64 start, u64 end);
4845

49-
extern void remove_e820_regions(struct device *dev, struct resource *avail);
50-
5146
/*
5247
* Returns true iff the specified range [start,end) is completely contained inside
5348
* the ISA region.

arch/x86/include/asm/pci_x86.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ void pcibios_scan_specific_bus(int busn);
6969

7070
/* pci-irq.c */
7171

72+
struct pci_dev;
73+
7274
struct irq_info {
7375
u8 bus, devfn; /* Bus, device and function */
7476
struct {
@@ -246,3 +248,9 @@ static inline void mmio_config_writel(void __iomem *pos, u32 val)
246248
# define x86_default_pci_init_irq NULL
247249
# define x86_default_pci_fixup_irqs NULL
248250
#endif
251+
252+
#if defined(CONFIG_PCI) && defined(CONFIG_ACPI)
253+
extern bool pci_use_e820;
254+
#else
255+
#define pci_use_e820 false
256+
#endif

arch/x86/kernel/resource.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// SPDX-License-Identifier: GPL-2.0
2-
#include <linux/dev_printk.h>
32
#include <linux/ioport.h>
3+
#include <linux/printk.h>
44
#include <asm/e820/api.h>
5+
#include <asm/pci_x86.h>
56

67
static void resource_clip(struct resource *res, resource_size_t start,
78
resource_size_t end)
@@ -24,14 +25,14 @@ static void resource_clip(struct resource *res, resource_size_t start,
2425
res->start = end + 1;
2526
}
2627

27-
void remove_e820_regions(struct device *dev, struct resource *avail)
28+
static void remove_e820_regions(struct resource *avail)
2829
{
2930
int i;
3031
struct e820_entry *entry;
3132
u64 e820_start, e820_end;
3233
struct resource orig = *avail;
3334

34-
if (!(avail->flags & IORESOURCE_MEM))
35+
if (!pci_use_e820)
3536
return;
3637

3738
for (i = 0; i < e820_table->nr_entries; i++) {
@@ -41,7 +42,7 @@ void remove_e820_regions(struct device *dev, struct resource *avail)
4142

4243
resource_clip(avail, e820_start, e820_end);
4344
if (orig.start != avail->start || orig.end != avail->end) {
44-
dev_info(dev, "clipped %pR to %pR for e820 entry [mem %#010Lx-%#010Lx]\n",
45+
pr_info("clipped %pR to %pR for e820 entry [mem %#010Lx-%#010Lx]\n",
4546
&orig, avail, e820_start, e820_end);
4647
orig = *avail;
4748
}
@@ -55,6 +56,9 @@ void arch_remove_reservations(struct resource *avail)
5556
* the low 1MB unconditionally, as this area is needed for some ISA
5657
* cards requiring a memory range, e.g. the i82365 PCMCIA controller.
5758
*/
58-
if (avail->flags & IORESOURCE_MEM)
59+
if (avail->flags & IORESOURCE_MEM) {
5960
resource_clip(avail, BIOS_ROM_BASE, BIOS_ROM_END);
61+
62+
remove_e820_regions(avail);
63+
}
6064
}

arch/x86/pci/acpi.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include <linux/pci-acpi.h>
99
#include <asm/numa.h>
1010
#include <asm/pci_x86.h>
11-
#include <asm/e820/api.h>
1211

1312
struct pci_root_info {
1413
struct acpi_pci_root_info common;
@@ -20,7 +19,7 @@ struct pci_root_info {
2019
#endif
2120
};
2221

23-
static bool pci_use_e820 = true;
22+
bool pci_use_e820 = true;
2423
static bool pci_use_crs = true;
2524
static bool pci_ignore_seg;
2625

@@ -387,11 +386,6 @@ static int pci_acpi_root_prepare_resources(struct acpi_pci_root_info *ci)
387386

388387
status = acpi_pci_probe_root_resources(ci);
389388

390-
if (pci_use_e820) {
391-
resource_list_for_each_entry(entry, &ci->resources)
392-
remove_e820_regions(&device->dev, entry->res);
393-
}
394-
395389
if (pci_use_crs) {
396390
resource_list_for_each_entry_safe(entry, tmp, &ci->resources)
397391
if (resource_is_pcicfg_ioport(entry->res))

0 commit comments

Comments
 (0)