Skip to content

x86: Clean up and reorganize the E820 table handling code

Ingo Molnar lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest50 patches 13 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/50x86/boot/e820: Introduce arch/x86/include/asm/e820/types.harch/x86/include/asm/e820.h arch/x86/include/asm/e820/types.h+83 -29 replies
2/50x86/boot/e820: Clean up and improve comments in asm/e820/types.harch/x86/include/asm/e820/types.h+53 -310 replies
3/50x86/boot/e820: Move asm/e820.h to asm/e820/api.harch/x86/boot/header.S arch/x86/include/asm/e820/api.h arch/x86/include/asm/gart.h +38 more+43 -430 replies
4/50x86/boot/e820: Split minimal UAPI types out into uapi/asm/e820/types.harch/x86/include/asm/acpi.h arch/x86/include/asm/e820/types.h arch/x86/include/uapi/asm/bootparam.h +1 more+26 -140 replies
5/50x86/boot/e820: Clean up the E820_X_MAX definitionarch/x86/include/asm/e820/api.h arch/x86/include/asm/e820/types.h+7 -150 replies
6/50x86/boot/e820: Remove spurious asm/e820/api.h inclusionsarch/x86/boot/compressed/eboot.c arch/x86/include/asm/pci_x86.h arch/x86/include/asm/pgtable.h +9 more+15 -20 replies
7/50x86/boot/e820: Remove assembly guard from asm/e820/types.harch/x86/boot/header.S arch/x86/include/asm/e820/types.h+0 -60 replies
8/50x86/boot/e820: Clean up asm/e820/api.harch/x86/include/asm/e820/api.h+18 -280 replies
9/50x86/boot/e820: Remove unnecessary __ASSEMBLY__ guardarch/x86/include/asm/e820/api.h+0 -20 replies
10/50x86/boot/e820: Move HIGH_MEMORY define to asm/e820/types.harch/x86/include/asm/e820/api.h arch/x86/include/asm/e820/types.h+3 -20 replies
11/50x86/boot/e820: Rename the basic e820 data types to 'struct e820_entry' and 'struct e820_array'Documentation/x86/zero-page.txt arch/x86/boot/compressed/eboot.c arch/x86/boot/compressed/kaslr.c +13 more+66 -660 replies
12/50x86/boot/e820: Remove unnecessary #include <linux/ioport.h> from asm/e820/api.harch/x86/include/asm/e820/api.h arch/x86/mm/ioremap.c arch/x86/mm/pat.c+2 -20 replies
13/50x86/boot/e820: Remove e820_mark_nosave_regions() definition ugliesarch/x86/include/asm/e820/api.h arch/x86/kernel/e820.c+0 -80 replies
14/50x86/boot/e820: Rename 'e820_map' variables to 'e820_array'Documentation/x86/zero-page.txt arch/x86/boot/compressed/eboot.c arch/x86/boot/compressed/kaslr.c +16 more+158 -1580 replies
15/50x86/boot/e820: Rename everything to e820_tableDocumentation/x86/zero-page.txt arch/x86/boot/compressed/eboot.c arch/x86/boot/compressed/kaslr.c +16 more+163 -1630 replies
16/50x86/boot/e820: Harmonize the 'struct e820_table' fieldsarch/x86/include/asm/e820/types.h arch/x86/kernel/e820.c arch/x86/kernel/early-quirks.c +7 more+77 -810 replies
17/50x86/boot/e820: Rename default_machine_specific_memory_setup() to e820__memory_setup_default()arch/x86/include/asm/e820/api.h arch/x86/kernel/e820.c arch/x86/kernel/setup.c +1 more+11 -60 replies
18/50x86/boot/e820: Rename e820_table_saved to e820_table_firmware and improve the descriptionarch/x86/include/asm/e820/api.h arch/x86/kernel/e820.c arch/x86/kernel/kexec-bzimage64.c +2 more+56 -370 replies
19/50x86/boot/e820: Basic cleanup of e820.carch/x86/kernel/e820.c+207 -2400 replies
20/50x86/boot/e820: Rename memblock_x86_fill() to e820__memblock_setup() and improve the explanationsarch/x86/include/asm/e820/api.h arch/x86/kernel/e820.c arch/x86/kernel/setup.c+12 -80 replies
21/50x86/boot/e820: Consolidate 'struct e820_entry *entry' local variable namesarch/x86/kernel/e820.c+55 -550 replies
22/50x86/boot/e820: Convert printk(KERN_* ...) to pr_*()arch/x86/kernel/e820.c+25 -251 reply
23/50x86/boot/e820: Move the memblock_find_dma_reserve() function and rename it to memblock_set_dma_reserve()arch/x86/include/asm/e820/api.h arch/x86/include/asm/pgtable.h arch/x86/kernel/e820.c +1 more+48 -320 replies
24/50x86/boot/e820: Rename parse_e820_ext() to e820__memory_setup_extended()arch/x86/include/asm/e820/api.h arch/x86/kernel/e820.c arch/x86/kernel/setup.c+3 -30 replies
25/50x86/boot/e820: Move e820_reserve_setup_data() to e820.carch/x86/include/asm/e820/api.h arch/x86/kernel/e820.c arch/x86/kernel/setup.c+23 -230 replies
26/50x86/boot/e820: Clarify the role of finish_e820_parsing() and rename it to e820__finish_early_params()arch/x86/include/asm/e820/api.h arch/x86/kernel/e820.c arch/x86/kernel/setup.c+8 -30 replies
27/50x86/boot/e820: Rename early_reserve_e820() to e820__memblock_alloc() and document itarch/x86/include/asm/e820/api.h arch/x86/include/asm/mpspec.h arch/x86/kernel/e820.c +2 more+14 -90 replies
28/50x86/boot/e820: Rename update_e820() to e820__update_table()arch/x86/include/asm/e820/api.h arch/x86/kernel/acpi/boot.c arch/x86/kernel/aperture_64.c +2 more+7 -70 replies
29/50x86/boot/e820: Rename sanitize_e820_table() to e820__update_table()arch/x86/include/asm/e820/api.h arch/x86/include/asm/e820/types.h arch/x86/kernel/e820.c +4 more+17 -170 replies
30/50x86/boot/e820: Rename e820_any_mapped()/e820_all_mapped() to e820__mapped_any()/e820__mapped_all()arch/x86/include/asm/e820/api.h arch/x86/include/asm/gart.h arch/x86/kernel/aperture_64.c +6 more+18 -180 replies
31/50x86/boot/e820: Rename e820_setup_gap() to e820__setup_pci_gap()arch/x86/include/asm/e820/api.h arch/x86/kernel/e820.c arch/x86/kernel/setup.c+3 -30 replies
32/50x86/boot/e820: Create coherent API function names for E820 range operationsarch/x86/include/asm/e820/api.h arch/x86/kernel/acpi/boot.c arch/x86/kernel/aperture_64.c +8 more+44 -420 replies
33/50x86/boot/e820: Rename e820_print_map() to e820__print_table()arch/x86/include/asm/e820/api.h arch/x86/kernel/e820.c arch/x86/kernel/setup.c+8 -80 replies
34/50x86/boot/e820: Reorder the function prototypes in api.harch/x86/include/asm/e820/api.h+7 -20 replies
35/50x86/boot/e820: Simplify e820_reserve_resources()arch/x86/kernel/e820.c+19 -170 replies
36/50x86/boot/e820: Introduce 'enum e820_type'arch/x86/include/asm/e820/types.h+31 -260 replies
37/50x86/boot/e820: Use 'enum e820_type' in 'struct e820_entry'arch/x86/include/asm/e820/types.h arch/x86/include/uapi/asm/e820/types.h arch/x86/kernel/e820.c+37 -344 replies
38/50x86/boot/e820: Use 'enum e820_type' when handling the e820 region typearch/x86/include/asm/e820/api.h arch/x86/kernel/e820.c+16 -160 replies
39/50x86/boot/e820: Prefix the E820_* type names with "E820_TYPE_"arch/x86/boot/compressed/eboot.c arch/x86/boot/compressed/kaslr.c arch/x86/include/asm/gart.h +17 more+123 -1230 replies
40/50x86/boot/e820: Clean up the E820 table size define namesarch/x86/include/asm/e820/types.h arch/x86/include/uapi/asm/bootparam.h arch/x86/include/uapi/asm/e820/types.h +7 more+27 -300 replies
41/50x86/boot/e820: Clean up and standardize sizeof() usesarch/x86/kernel/e820.c+6 -60 replies
42/50xen, x86/boot/e820: Simplify Xen's xen_e820_table constructarch/x86/xen/setup.c+33 -370 replies
43/50x86/boot/e820: Simplify the e820__update_table() interfacearch/x86/include/asm/e820/api.h arch/x86/kernel/e820.c arch/x86/kernel/early-quirks.c +3 more+21 -170 replies
44/50x86/boot/e820: Clean up __e820__update_table() et alarch/x86/kernel/e820.c+61 -590 replies
45/50x86/boot/e820: Document e820__reserve_setup_data()arch/x86/include/asm/e820/api.h arch/x86/kernel/e820.c arch/x86/kernel/setup.c+12 -60 replies
46/50x86/boot/e820: Use bool in query APIsarch/x86/include/asm/e820/api.h arch/x86/kernel/e820.c arch/x86/pci/mmconfig-shared.c+15 -150 replies
47/50x86/boot/e820: Rename e820_reserve_resources*() to e820__reserve_resources*()arch/x86/include/asm/e820/api.h arch/x86/kernel/apic/apic.c arch/x86/kernel/e820.c +2 more+14 -120 replies
48/50x86/boot/e820: Rename e820_mark_nosave_regions() to e820__register_nosave_regions()arch/x86/include/asm/e820/api.h arch/x86/kernel/e820.c arch/x86/kernel/setup.c+7 -70 replies
49/50x86/boot/e820: Remove unnecessary #include'sarch/x86/kernel/e820.c+0 -70 replies
50/50x86/boot/e820: Rename the remaining E820 APIs to the e820__*() prefixarch/x86/include/asm/e820/api.h arch/x86/kernel/e820.c arch/x86/kernel/setup.c +1 more+11 -110 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/50] x86: Clean up and reorganize the E820 table handling code

When reviewing an E820 patch two days ago I noticed that our E820 code in arch/x86/kernel/e820.c has bitrotten quite a bit, and started cleaning it up a bit.

Didn't suspect that I'd end up with 50 patches, but oh well ...

The code got the usual treatments to turn it into a modern, cleanly structured kernel facility:

- split the e820.h header split into asm/e820/types.h and asm/e820/api.h and moved most of it out of the UAPI export,

- eliminated a number of header dependency hell related to the E820 code,

- clarified and standardized the API names, the variable names, the overall code style and the comments,

- cleaned up and modernized the various basic types used,

- fixed a ton of comments and weird constructs and added comments where they were missing.

There's a lot more: see the individual patches for details. There's no big functional changes, but the overall diffstat is pretty significant, due to cleaning out of 10+ years of gradually accumulated cruft.

It should now be possible for someone to understand the code from first principles, without too much hassle.

The patches can also be accessed in the following Git tree:

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

The code has been through a fair amount of testing, but only on a limited number of test systems.

Ingo Molnar (50):
x86/boot/e820: Introduce arch/x86/include/asm/e820/types.h
x86/boot/e820: Clean up and improve comments in asm/e820/types.h
x86/boot/e820: Move asm/e820.h to asm/e820/api.h
x86/boot/e820: Split minimal UAPI types out into uapi/asm/e820/types.h
x86/boot/e820: Clean up the E820_X_MAX definition
x86/boot/e820: Remove spurious asm/e820/api.h inclusions
x86/boot/e820: Remove assembly guard from asm/e820/types.h
x86/boot/e820: Clean up asm/e820/api.h
x86/boot/e820: Remove unnecessary __ASSEMBLY__ guard
x86/boot/e820: Move HIGH_MEMORY define to asm/e820/types.h
x86/boot/e820: Rename the basic e820 data types to 'struct e820_entry' and 'struct e820_array' x86/boot/e820: Remove unnecessary #include <linux/ioport.h> from asm/e820/api.h x86/boot/e820: Remove e820_mark_nosave_regions() definition uglies
x86/boot/e820: Rename 'e820_map' variables to 'e820_array'
x86/boot/e820: Rename everything to e820_table
x86/boot/e820: Harmonize the 'struct e820_table' fields
x86/boot/e820: Rename default_machine_specific_memory_setup() to e820__memory_setup_default() x86/boot/e820: Rename e820_table_saved to e820_table_firmware and improve the description x86/boot/e820: Basic cleanup of e820.c
x86/boot/e820: Rename memblock_x86_fill() to e820__memblock_setup() and improve the explanations x86/boot/e820: Consolidate 'struct e820_entry *entry' local variable names x86/boot/e820: Convert printk(KERN_* ...) to pr_*()
x86/boot/e820: Move the memblock_find_dma_reserve() function and rename it to memblock_set_dma_reserve() x86/boot/e820: Rename parse_e820_ext() to e820__memory_setup_extended()
x86/boot/e820: Move e820_reserve_setup_data() to e820.c
x86/boot/e820: Clarify the role of finish_e820_parsing() and rename it to e820__finish_early_params() x86/boot/e820: Rename early_reserve_e820() to e820__memblock_alloc() and document it x86/boot/e820: Rename update_e820() to e820__update_table()
x86/boot/e820: Rename sanitize_e820_table() to e820__update_table()
x86/boot/e820: Rename e820_any_mapped()/e820_all_mapped() to e820__mapped_any()/e820__mapped_all() x86/boot/e820: Rename e820_setup_gap() to e820__setup_pci_gap()
x86/boot/e820: Create coherent API function names for E820 range operations x86/boot/e820: Rename e820_print_map() to e820__print_table()
x86/boot/e820: Reorder the function prototypes in api.h
x86/boot/e820: Simplify e820_reserve_resources()
x86/boot/e820: Introduce 'enum e820_type'
x86/boot/e820: Use 'enum e820_type' in 'struct e820_entry'
x86/boot/e820: Use 'enum e820_type' when handling the e820 region type
x86/boot/e820: Prefix the E820_* type names with "E820_TYPE_"
x86/boot/e820: Clean up the E820 table size define names
x86/boot/e820: Clean up and standardize sizeof() uses
xen, x86/boot/e820: Simplify Xen's xen_e820_table construct
x86/boot/e820: Simplify the e820__update_table() interface
x86/boot/e820: Clean up __e820__update_table() et al
x86/boot/e820: Document e820__reserve_setup_data()
x86/boot/e820: Use bool in query APIs
x86/boot/e820: Rename e820_reserve_resources*() to e820__reserve_resources*() x86/boot/e820: Rename e820_mark_nosave_regions() to e820__register_nosave_regions() x86/boot/e820: Remove unnecessary #include's
x86/boot/e820: Rename the remaining E820 APIs to the e820__*() prefix

 Documentation/x86/zero-page.txt        |    6 +-
 arch/x86/boot/compressed/eboot.c       |   44 +--
 arch/x86/boot/compressed/kaslr.c       |    6 +-
 arch/x86/boot/header.S                 |    1 -
 arch/x86/boot/memory.c                 |    6 +-
 arch/x86/include/asm/acpi.h            |    2 +
 arch/x86/include/asm/e820.h            |   73 ----
 arch/x86/include/asm/e820/api.h        |   50 +++
 arch/x86/include/asm/e820/types.h      |   58 +++
 arch/x86/include/asm/gart.h            |    4 +-
 arch/x86/include/asm/mpspec.h          |    4 +-
 arch/x86/include/asm/pci_x86.h         |    2 +
 arch/x86/include/asm/pgtable.h         |    3 +-
 arch/x86/include/uapi/asm/bootparam.h  |    4 +-
 arch/x86/include/uapi/asm/e820/types.h |   55 +++
 arch/x86/kernel/acpi/boot.c            |    5 +-
 arch/x86/kernel/aperture_64.c          |   10 +-
 arch/x86/kernel/apic/apic.c            |    2 +-
 arch/x86/kernel/apic/apic_noop.c       |    2 +-
 arch/x86/kernel/apic/probe_32.c        |    2 +-
 arch/x86/kernel/apic/x2apic_uv_x.c     |    1 +
 arch/x86/kernel/cpu/centaur.c          |    2 +-
 arch/x86/kernel/cpu/mtrr/cleanup.c     |    6 +-
 arch/x86/kernel/cpu/mtrr/main.c        |    2 +-
 arch/x86/kernel/crash.c                |   23 +-
 arch/x86/kernel/e820.c                 | 1032 ++++++++++++++++++++++++++--------------------------
 arch/x86/kernel/early-quirks.c         |    4 +-
 arch/x86/kernel/head32.c               |    2 +-
 arch/x86/kernel/head64.c               |    2 +-
 arch/x86/kernel/kexec-bzimage64.c      |   18 +-
 arch/x86/kernel/mpparse.c              |    6 +-
 arch/x86/kernel/probe_roms.c           |    2 +-
 arch/x86/kernel/resource.c             |    8 +-
 arch/x86/kernel/setup.c                |   78 ++--
 arch/x86/kernel/tboot.c                |   16 +-
 arch/x86/kernel/x86_init.c             |    4 +-
 arch/x86/lguest/boot.c                 |    8 +-
 arch/x86/lib/kaslr.c                   |    2 +-
 arch/x86/mm/amdtopology.c              |    2 +-
 arch/x86/mm/init.c                     |   59 ++-
 arch/x86/mm/init_32.c                  |    2 +-
 arch/x86/mm/init_64.c                  |   26 +-
 arch/x86/mm/ioremap.c                  |    3 +-
 arch/x86/mm/kasan_init_64.c            |    5 +-
 arch/x86/mm/mmio-mod.c                 |    2 +-
 arch/x86/mm/numa.c                     |    2 +-
 arch/x86/mm/pageattr.c                 |    2 +-
 arch/x86/mm/pat.c                      |    3 +-
 arch/x86/mm/pgtable_32.c               |    2 +-
 arch/x86/mm/srat.c                     |    2 +-
 arch/x86/pci/i386.c                    |    4 +-
 arch/x86/pci/mmconfig-shared.c         |   22 +-
 arch/x86/pci/mmconfig_32.c             |    2 +-
 arch/x86/pci/mmconfig_64.c             |    2 +-
 arch/x86/pci/pcbios.c                  |    2 +
 arch/x86/platform/efi/efi.c            |   19 +-
 arch/x86/platform/efi/efi_64.c         |    2 +-
 arch/x86/platform/efi/quirks.c         |    8 +-
 arch/x86/power/hibernate_64.c          |   16 +-
 arch/x86/xen/mmu.c                     |    2 +-
 arch/x86/xen/setup.c                   |   97 +++--
 drivers/acpi/tables.c                  |    2 +-
 drivers/char/agp/amd64-agp.c           |    2 +-
 include/xen/page.h                     |    2 +-
 tools/lguest/lguest.c                  |    2 +-
 65 files changed, 989 insertions(+), 860 deletions(-)
 delete mode 100644 arch/x86/include/asm/e820.h
 create mode 100644 arch/x86/include/asm/e820/api.h
 create mode 100644 arch/x86/include/asm/e820/types.h
 create mode 100644 arch/x86/include/uapi/asm/e820/types.h
Signature · 1 line
2.7.4