Skip to content

Commit 30919b0

Browse files
Bjorn Helgaasjbarnes993
authored andcommitted
x86: avoid low BIOS area when allocating address space
This implements arch_remove_reservations() so allocate_resource() can avoid any arch-specific reserved areas. This currently just avoids the BIOS area (the first 1MB), but could be used for E820 reserved areas if that turns out to be necessary. We previously avoided this area in pcibios_align_resource(). This patch moves the test from that PCI-specific path to a generic path, so *all* resource allocations will avoid this area. Acked-by: H. Peter Anvin <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Signed-off-by: Jesse Barnes <[email protected]>
1 parent fcb1191 commit 30919b0

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

arch/x86/kernel/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ obj-y += pci-dma.o quirks.o i8237.o topology.o kdebugfs.o
4545
obj-y += alternative.o i8253.o pci-nommu.o hw_breakpoint.o
4646
obj-y += tsc.o io_delay.o rtc.o
4747
obj-y += pci-iommu_table.o
48+
obj-y += resource.o
4849

4950
obj-$(CONFIG_X86_TRAMPOLINE) += trampoline.o
5051
obj-y += process.o

arch/x86/kernel/resource.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include <linux/ioport.h>
2+
#include <asm/e820.h>
3+
4+
void arch_remove_reservations(struct resource *avail)
5+
{
6+
/* Trim out BIOS area (low 1MB) */
7+
if (avail->flags & IORESOURCE_MEM) {
8+
if (avail->start < BIOS_END)
9+
avail->start = BIOS_END;
10+
}
11+
}

arch/x86/pci/i386.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@ pcibios_align_resource(void *data, const struct resource *res,
7272
return start;
7373
if (start & 0x300)
7474
start = (start + 0x3ff) & ~0x3ff;
75-
} else if (res->flags & IORESOURCE_MEM) {
76-
if (start < BIOS_END)
77-
start = BIOS_END;
7875
}
7976
return start;
8077
}

0 commit comments

Comments
 (0)