[PATCH v7 19/27] x86, boot: add fields to support load bzImage and ramdisk above 4G
ext_ramdisk_image/size will record high 32bits for ramdisk info. xloadflags bit0 will be set if relocatable with 64bit. Let get_ramdisk_image/size to use ext_ramdisk_image/size to get right positon for ramdisk. bootloader will fill value to ext_ramdisk_image/size when it load ramdisk above 4G. Also bootloader will check if xloadflags bit0 is set to decicde if it could load ramdisk high above 4G. sentinel is used to make sure kernel have ext_* valid values set Update header version to 2.12. -v2: add ext_cmd_line_ptr for above 4G support. -v3: update to xloadflags from HPA. -v4: use fields from bootparam instead setup_header according to HPA. -v5: add checking for USE_EXT_BOOT_PARAMS -v6: use sentinel to check if ext_* are valid suggested by HPA. HPA said: 1. add a field in the uninitialized portion, call it "sentinel"; 2. make sure the byte position corresponding to the "sentinel" field is nonzero in the bzImage file; 3. if the kernel boots up and sentinel is nonzero, erase those fields that you identified as uninitialized; -v7: change to 0x1ef instead of 0x1f0, HPA said: it is quite plausible that someone may (fairly sanely) start the copy range at 0x1f0 instead of 0x1f1 Signed-off-by: Yinghai Lu Cc: Rob Landley Cc: Matt Fleming --- Documentation/x86/boot.txt| 15 ++- Documentation/x86/zero-page.txt |4 arch/x86/boot/compressed/cmdline.c|2 ++ arch/x86/boot/compressed/misc.c | 12 arch/x86/boot/header.S| 12 ++-- arch/x86/boot/setup.ld|7 +++ arch/x86/include/uapi/asm/bootparam.h | 13 ++--- arch/x86/kernel/head64.c |2 ++ arch/x86/kernel/setup.c |4 9 files changed, 65 insertions(+), 6 deletions(-) diff --git a/Documentation/x86/boot.txt b/Documentation/x86/boot.txt index 406d82d..18ca9fb 100644 --- a/Documentation/x86/boot.txt +++ b/Documentation/x86/boot.txt @@ -57,6 +57,9 @@ Protocol 2.10:(Kernel 2.6.31) Added a protocol for relaxed alignment Protocol 2.11: (Kernel 3.6) Added a field for offset of EFI handover protocol entry point. +Protocol 2.12: (Kernel 3.9) Added three fields for loading bzImage and +ramdisk above 4G with 64bit in bootparam. + MEMORY LAYOUT The traditional memory map for the kernel loader, used for Image or @@ -182,7 +185,7 @@ Offset Proto NameMeaning 0230/4 2.05+ kernel_alignment Physical addr alignment required for kernel 0234/1 2.05+ relocatable_kernel Whether kernel is relocatable or not 0235/1 2.10+ min_alignment Minimum alignment, as a power of two -0236/2 N/A pad3Unused +0236/2 2.12+ xloadflags Boot protocol option flags 0238/4 2.06+ cmdline_sizeMaximum size of the kernel command line 023C/4 2.07+ hardware_subarch Hardware subarchitecture 0240/8 2.07+ hardware_subarch_data Subarchitecture-specific data @@ -582,6 +585,16 @@ Protocol: 2.10+ misaligned kernel. Therefore, a loader should typically try each power-of-two alignment from kernel_alignment down to this alignment. +Field name: xloadflags +Type: modify (obligatory) +Offset/size:0x236/2 +Protocol: 2.12+ + + This field is a bitmask. + + Bit 0 (read): CAN_BE_LOADED_ABOVE_4G +- If 1, kernel/boot_params/cmdline/ramdisk can be above 4g, + Field name:cmdline_size Type: read Offset/size: 0x238/4 diff --git a/Documentation/x86/zero-page.txt b/Documentation/x86/zero-page.txt index cf5437d..1140e59 100644 --- a/Documentation/x86/zero-page.txt +++ b/Documentation/x86/zero-page.txt @@ -19,6 +19,9 @@ OffsetProto NameMeaning 090/010ALL hd1_infohd1 disk parameter, OBSOLETE!! 0A0/010ALL sys_desc_table System description table (struct sys_desc_table) 0B0/010ALL olpc_ofw_header OLPC's OpenFirmware CIF and friends +0C0/004ALL ext_ramdisk_image ramdisk_image high 32bits +0C4/004ALL ext_ramdisk_size ramdisk_size high 32bits +0C8/004ALL ext_cmd_line_ptr cmd_line_ptr high 32bits 140/080ALL edid_info Video mode setup (struct edid_info) 1C0/020ALL efi_infoEFI 32 information (struct efi_info) 1E0/004ALL alk_mem_k Alternative mem check, in KB @@ -27,6 +30,7 @@ OffsetProto NameMeaning 1E9/001ALL eddbuf_entries Number of entries in eddbuf (below) 1EA/001ALL edd_mbr_sig_buf_entries Number of entries in edd_mbr_sig_buffer (below) +1EF/001ALL sentinel0: states _ext_* fields are valid 290/040ALL edd_mbr_sig_buffer EDD MBR signatures 2D0/A00ALL e820_mapE820 memory map table (array of struct e820entry)
[PATCH v7 19/27] x86, boot: add fields to support load bzImage and ramdisk above 4G
ext_ramdisk_image/size will record high 32bits for ramdisk info. xloadflags bit0 will be set if relocatable with 64bit. Let get_ramdisk_image/size to use ext_ramdisk_image/size to get right positon for ramdisk. bootloader will fill value to ext_ramdisk_image/size when it load ramdisk above 4G. Also bootloader will check if xloadflags bit0 is set to decicde if it could load ramdisk high above 4G. sentinel is used to make sure kernel have ext_* valid values set Update header version to 2.12. -v2: add ext_cmd_line_ptr for above 4G support. -v3: update to xloadflags from HPA. -v4: use fields from bootparam instead setup_header according to HPA. -v5: add checking for USE_EXT_BOOT_PARAMS -v6: use sentinel to check if ext_* are valid suggested by HPA. HPA said: 1. add a field in the uninitialized portion, call it sentinel; 2. make sure the byte position corresponding to the sentinel field is nonzero in the bzImage file; 3. if the kernel boots up and sentinel is nonzero, erase those fields that you identified as uninitialized; -v7: change to 0x1ef instead of 0x1f0, HPA said: it is quite plausible that someone may (fairly sanely) start the copy range at 0x1f0 instead of 0x1f1 Signed-off-by: Yinghai Lu ying...@kernel.org Cc: Rob Landley r...@landley.net Cc: Matt Fleming matt.flem...@intel.com --- Documentation/x86/boot.txt| 15 ++- Documentation/x86/zero-page.txt |4 arch/x86/boot/compressed/cmdline.c|2 ++ arch/x86/boot/compressed/misc.c | 12 arch/x86/boot/header.S| 12 ++-- arch/x86/boot/setup.ld|7 +++ arch/x86/include/uapi/asm/bootparam.h | 13 ++--- arch/x86/kernel/head64.c |2 ++ arch/x86/kernel/setup.c |4 9 files changed, 65 insertions(+), 6 deletions(-) diff --git a/Documentation/x86/boot.txt b/Documentation/x86/boot.txt index 406d82d..18ca9fb 100644 --- a/Documentation/x86/boot.txt +++ b/Documentation/x86/boot.txt @@ -57,6 +57,9 @@ Protocol 2.10:(Kernel 2.6.31) Added a protocol for relaxed alignment Protocol 2.11: (Kernel 3.6) Added a field for offset of EFI handover protocol entry point. +Protocol 2.12: (Kernel 3.9) Added three fields for loading bzImage and +ramdisk above 4G with 64bit in bootparam. + MEMORY LAYOUT The traditional memory map for the kernel loader, used for Image or @@ -182,7 +185,7 @@ Offset Proto NameMeaning 0230/4 2.05+ kernel_alignment Physical addr alignment required for kernel 0234/1 2.05+ relocatable_kernel Whether kernel is relocatable or not 0235/1 2.10+ min_alignment Minimum alignment, as a power of two -0236/2 N/A pad3Unused +0236/2 2.12+ xloadflags Boot protocol option flags 0238/4 2.06+ cmdline_sizeMaximum size of the kernel command line 023C/4 2.07+ hardware_subarch Hardware subarchitecture 0240/8 2.07+ hardware_subarch_data Subarchitecture-specific data @@ -582,6 +585,16 @@ Protocol: 2.10+ misaligned kernel. Therefore, a loader should typically try each power-of-two alignment from kernel_alignment down to this alignment. +Field name: xloadflags +Type: modify (obligatory) +Offset/size:0x236/2 +Protocol: 2.12+ + + This field is a bitmask. + + Bit 0 (read): CAN_BE_LOADED_ABOVE_4G +- If 1, kernel/boot_params/cmdline/ramdisk can be above 4g, + Field name:cmdline_size Type: read Offset/size: 0x238/4 diff --git a/Documentation/x86/zero-page.txt b/Documentation/x86/zero-page.txt index cf5437d..1140e59 100644 --- a/Documentation/x86/zero-page.txt +++ b/Documentation/x86/zero-page.txt @@ -19,6 +19,9 @@ OffsetProto NameMeaning 090/010ALL hd1_infohd1 disk parameter, OBSOLETE!! 0A0/010ALL sys_desc_table System description table (struct sys_desc_table) 0B0/010ALL olpc_ofw_header OLPC's OpenFirmware CIF and friends +0C0/004ALL ext_ramdisk_image ramdisk_image high 32bits +0C4/004ALL ext_ramdisk_size ramdisk_size high 32bits +0C8/004ALL ext_cmd_line_ptr cmd_line_ptr high 32bits 140/080ALL edid_info Video mode setup (struct edid_info) 1C0/020ALL efi_infoEFI 32 information (struct efi_info) 1E0/004ALL alk_mem_k Alternative mem check, in KB @@ -27,6 +30,7 @@ OffsetProto NameMeaning 1E9/001ALL eddbuf_entries Number of entries in eddbuf (below) 1EA/001ALL edd_mbr_sig_buf_entries Number of entries in edd_mbr_sig_buffer (below) +1EF/001ALL sentinel0: states _ext_* fields are valid 290/040ALL edd_mbr_sig_buffer EDD MBR signatures 2D0/A00ALL e820_mapE820 memory map table