Skip to content

x86/boot/e820: Assorted E820 table handling features and cleanups

Ingo Molnar lkml 1 version Applied

Status from this message: The following commit has been merged into the x86/boot branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest32 patches 16 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/32x86/boot/e820: Remove inverted boolean logic from the e820_nomerge() function name, rename it to e820_type_mergeable()arch/x86/kernel/e820.c+10 -61 reply
2/32x86/boot/e820: Simplify e820__print_table() a bitarch/x86/kernel/e820.c+5 -30 replies
3/32x86/boot/e820: Simplify the PPro Erratum #50 workaroundarch/x86/kernel/setup.c+2 -40 replies
4/32x86/boot/e820: Mark e820__print_table() staticarch/x86/include/asm/e820/api.h arch/x86/kernel/e820.c+1 -20 replies
5/32x86/boot/e820: Print gaps in the E820 tablearch/x86/kernel/e820.c+18 -40 replies
6/32x86/boot/e820: Make the field separator space character part of e820_print_type()arch/x86/kernel/e820.c+11 -110 replies
7/32x86/boot/e820: Print out sizes of E820 memory rangesarch/x86/kernel/e820.c+45 -22 replies
8/32x86/boot/e820: Print E820_TYPE_RAM entries as ... RAM entriesarch/x86/kernel/e820.c+1 -10 replies
9/32x86/boot/e820: Call the PCI gap a 'gap' in the boot log printoutarch/x86/kernel/e820.c+1 -12 replies
10/32x86/boot/e820: Use 'u64' consistently instead of 'unsigned long long'arch/x86/kernel/e820.c+5 -50 replies
11/32x86/boot/e820: Remove pointless early_panic() indirectionarch/x86/kernel/e820.c+1 -70 replies
12/32x86/boot/e820: Clean up confusing and self-contradictory verbiage around E820 related resource allocationsarch/x86/kernel/e820.c+37 -182 replies
13/32x86/boot/e820: Improve e820_print_type() messagesarch/x86/kernel/e820.c+8 -80 replies
14/32x86/boot/e820: Clean up __e820__range_add() a bitarch/x86/kernel/e820.c+8 -70 replies
15/32x86/boot/e820: Clean up __refdata use a bitarch/x86/kernel/e820.c+3 -30 replies
16/32x86/boot/e820: Remove unnecessary header inclusionsarch/x86/kernel/e820.c+0 -20 replies
17/32x86/boot/e820: Standardize e820 table index variable names under 'idx'arch/x86/kernel/e820.c+57 -571 reply
18/32x86/boot/e820: Standardize e820 table index variable types under 'u32'arch/x86/kernel/e820.c+12 -120 replies
19/32x86/boot/e820: Change struct e820_table::nr_entries type from __u32 to u32arch/x86/include/asm/e820/types.h+1 -10 replies
20/32x86/boot/e820: Clean up e820__setup_pci_gap()/e820_search_gap() a bitarch/x86/kernel/e820.c+11 -111 reply
21/32x86/boot/e820: Change e820_search_gap() to search for the highest-address PCI gaparch/x86/kernel/e820.c+1 -10 replies
22/32x86/boot/e820: Rename gap_start/gap_size to max_gap_start/max_gap_start in e820_search_gap() et alarch/x86/kernel/e820.c+11 -110 replies
23/32x86/boot/e820: Simplify & clarify __e820__range_add() a bitarch/x86/kernel/e820.c+7 -40 replies
24/32x86/boot/e820: Standardize __init/__initdata tag placementarch/x86/kernel/e820.c+46 -460 replies
25/32x86/boot/e820: Simplify append_e820_table() and remove restriction on single-entry tablesarch/x86/kernel/e820.c+11 -242 replies
26/32x86/boot/e820: Remove e820__range_remove()'s unused return parameterarch/x86/include/asm/e820/api.h arch/x86/kernel/e820.c+2 -80 replies
27/32x86/boot/e820: Simplify the e820__range_remove() APIarch/x86/include/asm/e820/api.h arch/x86/kernel/e820.c arch/x86/kernel/setup.c +1 more+11 -140 replies
28/32x86/boot/e820: Make sure e820_search_gap() finds all gapsarch/x86/kernel/e820.c+41 -181 reply
29/32x86/boot/e820: Introduce E820_TYPE_13 and treat it as a device regionarch/x86/include/asm/e820/types.h arch/x86/kernel/e820.c+13 -20 replies
30/32x86/boot/e820: Change e820_type_to_string() to take a 'type' parameterarch/x86/kernel/e820.c+4 -40 replies
31/32x86/boot/e820: Unify e820_print_type() and e820_type_to_string()arch/x86/kernel/e820.c+20 -300 replies
32/32x86/boot/e820: Move index increments outside accessors in e820__update_table()arch/x86/kernel/e820.c+4 -24 replies

Reviews trailers per patch

1 of 32 patches has a Reviewed-by or Acked-by.

PatchNikolay Borisov
1/32R-b
2/32
3/32
4/32
5/32
6/32
7/32
8/32
9/32
10/32
11/32
12/32
13/32
14/32
15/32
16/32
17/32
18/32
19/32
20/32
21/32
22/32
23/32
24/32
25/32
26/32
27/32
28/32
29/32
30/32
31/32
32/32

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH -v2 00/32] x86/boot/e820: Assorted E820 table handling features and cleanups

Changes in -v2:

- Further refine type-13 handling as suggested by hpa, and don't change behavior for other undefined E820 types.

- Incorporate review feedback from Mike Rapoport and Andy Shevchenko:

- Clean up the ppro_with_ram_bug() quirk some more
- Use FW_BUG to print out firmware bugs
- Simplify the new size-printing code
- Standardize on the 'System RAM' string for E820_TYPE_RAM
- Change e820_type_to_string() to take a 'type' parameter
- Unify e820_print_type() and e820_type_to_string()
- Move index increments outside accessors in e820__update_table()
- Reorder the series a bit for easier review
- Utilize more SZ_ constants

- Rebase on top of v6.15-rc6 + tip:x86/core

The latest version of this series can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/mingo/tip.git WIP.x86/e820

Thanks,

Ingo

===========
Original -v1 announcement:

So I was looking into a E820 table related bug report by Paul Menzel, and I wanted to implement the behavior suggested by the ACPI specification, which bug/problem results in unbootable Linux systems with certain bootloaders:

https://lore.kernel.org/r/[email protected]

One thing led to another, and now I'm here 29 patches later, trying to explain what they all do. :-/

In order of importance:

- The bugfix / change of Linux kernel E820 table parsing behavior:

      x86/boot/e820: Treat non-type-2 'reserved' E820 region types as E820_TYPE_RESERVED

- A change to e820_search_gap() to fix an implementational oddity that would prefer lower-address same-size PCI gaps over larger-address PCI gaps. Now the implementation searches for the largest gap:

x86/boot/e820: Change e820_search_gap() to search for the highest-address PCI gap

- A rewrite of e820_search_gap() to search the E820 table in ascending order to make sure even weird PCI holes get found, as claimed by the comments around the code (but not properly implemented):

      x86/boot/e820: Make sure e820_search_gap() finds all gaps

- Remove the exclusion of single-entry E820 tables passed in by firmware:

x86/boot/e820: Simplify append_e820_table() and remove restriction on single-entry tables

- A debuggability improvement, to print the sizes of the e820 entries and the holes as well, because parsing raw hexadecimal ranges is hard for humans:

x86/boot/e820: Print gaps in the E820 table x86/boot/e820: Print out sizes of E820 memory ranges

Before:

		BIOS-provided physical RAM map:
		BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
		BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
		BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
		BIOS-e820: [mem 0x0000000000100000-0x000000007ffdbfff] usable
		BIOS-e820: [mem 0x000000007ffdc000-0x000000007fffffff] reserved
		BIOS-e820: [mem 0x00000000b0000000-0x00000000bfffffff] reserved
		BIOS-e820: [mem 0x00000000fed1c000-0x00000000fed1ffff] reserved
		BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved
		BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
		BIOS-e820: [mem 0x000000fd00000000-0x000000ffffffffff] reserved
   After:
		BIOS-provided physical RAM map:
		BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff]  639   KB kernel usable RAM
		BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff]    1   KB device reserved
		BIOS-e820: [gap 0x00000000000a0000-0x00000000000effff]  320   KB ...
		BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff]   64   KB device reserved
		BIOS-e820: [mem 0x0000000000100000-0x000000007ffdbfff]    1.9 GB kernel usable RAM
		BIOS-e820: [mem 0x000000007ffdc000-0x000000007fffffff]  144   KB device reserved
		BIOS-e820: [gap 0x0000000080000000-0x00000000afffffff]  768   MB ...
		BIOS-e820: [mem 0x00000000b0000000-0x00000000bfffffff]  256   MB device reserved
		BIOS-e820: [gap 0x00000000c0000000-0x00000000fed1bfff] 1005.1 MB ...
		BIOS-e820: [mem 0x00000000fed1c000-0x00000000fed1ffff]   16   KB device reserved
		BIOS-e820: [gap 0x00000000fed20000-0x00000000feffbfff]    2.8 MB ...
		BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff]   16   KB device reserved
		BIOS-e820: [gap 0x00000000ff000000-0x00000000fffbffff]   15.7 MB ...
		BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff]  256   KB device reserved
		BIOS-e820: [gap 0x0000000100000000-0x000000fcffffffff] 1008   GB ...
		BIOS-e820: [mem 0x000000fd00000000-0x000000ffffffffff]   12   GB device reserved

Note how weirdly broken up ranges are printed with fractional size values, while 'round' ranges are printed as natural numbers.

- Assorted cleanups: type cleanups, simplifications, standardization of coding patterns, etc.

Thanks,

Ingo

===============>

Ingo Molnar (32):
x86/boot/e820: Remove inverted boolean logic from the e820_nomerge() function name, rename it to e820_type_mergeable() x86/boot/e820: Simplify e820__print_table() a bit
x86/boot/e820: Simplify the PPro Erratum #50 workaround
x86/boot/e820: Mark e820__print_table() static
x86/boot/e820: Print gaps in the E820 table
x86/boot/e820: Make the field separator space character part of e820_print_type()
x86/boot/e820: Print out sizes of E820 memory ranges
x86/boot/e820: Print E820_TYPE_RAM entries as ... RAM entries
x86/boot/e820: Call the PCI gap a 'gap' in the boot log printout
x86/boot/e820: Use 'u64' consistently instead of 'unsigned long long'
x86/boot/e820: Remove pointless early_panic() indirection
x86/boot/e820: Clean up confusing and self-contradictory verbiage around E820 related resource allocations x86/boot/e820: Improve e820_print_type() messages
x86/boot/e820: Clean up __e820__range_add() a bit
x86/boot/e820: Clean up __refdata use a bit
x86/boot/e820: Remove unnecessary header inclusions
x86/boot/e820: Standardize e820 table index variable names under 'idx'
x86/boot/e820: Standardize e820 table index variable types under 'u32'
x86/boot/e820: Change struct e820_table::nr_entries type from __u32 to u32
x86/boot/e820: Clean up e820__setup_pci_gap()/e820_search_gap() a bit
x86/boot/e820: Change e820_search_gap() to search for the highest-address PCI gap
x86/boot/e820: Rename gap_start/gap_size to max_gap_start/max_gap_start in e820_search_gap() et al x86/boot/e820: Simplify & clarify __e820__range_add() a bit
x86/boot/e820: Standardize __init/__initdata tag placement
x86/boot/e820: Simplify append_e820_table() and remove restriction on single-entry tables x86/boot/e820: Remove e820__range_remove()'s unused return parameter
x86/boot/e820: Simplify the e820__range_remove() API
x86/boot/e820: Make sure e820_search_gap() finds all gaps
x86/boot/e820: Introduce E820_TYPE_13 and treat it as a device region
x86/boot/e820: Change e820_type_to_string() to take a 'type' parameter
x86/boot/e820: Unify e820_print_type() and e820_type_to_string()
x86/boot/e820: Move index increments outside accessors in e820__update_table()

 arch/x86/include/asm/e820/api.h   |   3 +-
 arch/x86/include/asm/e820/types.h |   6 +-
 arch/x86/kernel/e820.c            | 555 ++++++++++++++++++++++----------------
 arch/x86/kernel/setup.c           |  10 +-
 arch/x86/platform/efi/efi.c       |   3 +-
 5 files changed, 328 insertions(+), 249 deletions(-)
Signature · 1 line
2.45.2