Skip to content

Commit 44087d3

Browse files
committed
Merge tag 'x86-urgent-2025-12-21' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Ingo Molnar: - Fix FPU core dumps on certain CPU models - Fix htmldocs build warning - Export TLB tracing event name via header - Remove unused constant from <linux/mm_types.h> - Fix comments - Fix whitespace noise in documentation - Fix variadic structure's definition to un-confuse UBSAN - Fix posted MSI interrupts irq_retrigger() bug - Fix asm build failure with older GCC builds * tag 'x86-urgent-2025-12-21' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/bug: Fix old GCC compile fails x86/msi: Make irq_retrigger() functional for posted MSI x86/platform/uv: Fix UBSAN array-index-out-of-bounds mm: Remove tlb_flush_reason::NR_TLB_FLUSH_REASONS from <linux/mm_types.h> x86/mm/tlb/trace: Export the TLB_REMOTE_WRONG_CPU enum in <trace/events/tlb.h> x86/sgx: Remove unmatched quote in __sgx_encl_extend function comment x86/boot/Documentation: Fix whitespace noise in boot.rst x86/fpu: Fix FPU state core dump truncation on CPUs with no extended xfeatures x86/boot/Documentation: Fix htmldocs build warning due to malformed table in boot.rst
2 parents 610192c + c56a12c commit 44087d3

10 files changed

Lines changed: 141 additions & 111 deletions

File tree

Documentation/arch/x86/boot.rst

Lines changed: 99 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -95,26 +95,26 @@ Memory Layout
9595
The traditional memory map for the kernel loader, used for Image or
9696
zImage kernels, typically looks like::
9797

98-
| |
98+
| |
9999
0A0000 +------------------------+
100-
| Reserved for BIOS | Do not use. Reserved for BIOS EBDA.
100+
| Reserved for BIOS | Do not use. Reserved for BIOS EBDA.
101101
09A000 +------------------------+
102-
| Command line |
103-
| Stack/heap | For use by the kernel real-mode code.
102+
| Command line |
103+
| Stack/heap | For use by the kernel real-mode code.
104104
098000 +------------------------+
105-
| Kernel setup | The kernel real-mode code.
105+
| Kernel setup | The kernel real-mode code.
106106
090200 +------------------------+
107-
| Kernel boot sector | The kernel legacy boot sector.
107+
| Kernel boot sector | The kernel legacy boot sector.
108108
090000 +------------------------+
109-
| Protected-mode kernel | The bulk of the kernel image.
109+
| Protected-mode kernel | The bulk of the kernel image.
110110
010000 +------------------------+
111-
| Boot loader | <- Boot sector entry point 0000:7C00
111+
| Boot loader | <- Boot sector entry point 0000:7C00
112112
001000 +------------------------+
113-
| Reserved for MBR/BIOS |
113+
| Reserved for MBR/BIOS |
114114
000800 +------------------------+
115-
| Typically used by MBR |
115+
| Typically used by MBR |
116116
000600 +------------------------+
117-
| BIOS use only |
117+
| BIOS use only |
118118
000000 +------------------------+
119119

120120
When using bzImage, the protected-mode kernel was relocated to
@@ -142,27 +142,27 @@ above the 0x9A000 point; too many BIOSes will break above that point.
142142
For a modern bzImage kernel with boot protocol version >= 2.02, a
143143
memory layout like the following is suggested::
144144

145-
~ ~
146-
| Protected-mode kernel |
145+
~ ~
146+
| Protected-mode kernel |
147147
100000 +------------------------+
148-
| I/O memory hole |
148+
| I/O memory hole |
149149
0A0000 +------------------------+
150-
| Reserved for BIOS | Leave as much as possible unused
151-
~ ~
152-
| Command line | (Can also be below the X+10000 mark)
150+
| Reserved for BIOS | Leave as much as possible unused
151+
~ ~
152+
| Command line | (Can also be below the X+10000 mark)
153153
X+10000 +------------------------+
154-
| Stack/heap | For use by the kernel real-mode code.
154+
| Stack/heap | For use by the kernel real-mode code.
155155
X+08000 +------------------------+
156-
| Kernel setup | The kernel real-mode code.
157-
| Kernel boot sector | The kernel legacy boot sector.
156+
| Kernel setup | The kernel real-mode code.
157+
| Kernel boot sector | The kernel legacy boot sector.
158158
X +------------------------+
159-
| Boot loader | <- Boot sector entry point 0000:7C00
159+
| Boot loader | <- Boot sector entry point 0000:7C00
160160
001000 +------------------------+
161-
| Reserved for MBR/BIOS |
161+
| Reserved for MBR/BIOS |
162162
000800 +------------------------+
163-
| Typically used by MBR |
163+
| Typically used by MBR |
164164
000600 +------------------------+
165-
| BIOS use only |
165+
| BIOS use only |
166166
000000 +------------------------+
167167

168168
... where the address X is as low as the design of the boot loader permits.
@@ -433,7 +433,7 @@ Protocol: 2.00+
433433

434434
Assigned boot loader IDs:
435435

436-
== =======================================
436+
==== =======================================
437437
0x0 LILO
438438
(0x00 reserved for pre-2.00 bootloader)
439439
0x1 Loadlin
@@ -456,7 +456,7 @@ Protocol: 2.00+
456456
<http://sebastian-plotz.blogspot.de>
457457
0x12 OVMF UEFI virtualization stack
458458
0x13 barebox
459-
== =======================================
459+
==== =======================================
460460

461461
Please contact <hpa@zytor.com> if you need a bootloader ID value assigned.
462462

@@ -809,12 +809,12 @@ Protocol: 2.09+
809809
as follow::
810810

811811
struct setup_data {
812-
__u64 next;
813-
__u32 type;
814-
__u32 len;
815-
__u8 data[];
812+
__u64 next;
813+
__u32 type;
814+
__u32 len;
815+
__u8 data[];
816816
}
817-
817+
818818
Where, the next is a 64-bit physical pointer to the next node of
819819
linked list, the next field of the last node is 0; the type is used
820820
to identify the contents of data; the len is the length of data
@@ -835,10 +835,10 @@ Protocol: 2.09+
835835
protocol 2.15::
836836

837837
struct setup_indirect {
838-
__u32 type;
839-
__u32 reserved; /* Reserved, must be set to zero. */
840-
__u64 len;
841-
__u64 addr;
838+
__u32 type;
839+
__u32 reserved; /* Reserved, must be set to zero. */
840+
__u64 len;
841+
__u64 addr;
842842
};
843843
844844
The type member is a SETUP_INDIRECT | SETUP_* type. However, it cannot be
@@ -850,15 +850,15 @@ Protocol: 2.09+
850850
In this case setup_data and setup_indirect will look like this::
851851

852852
struct setup_data {
853-
.next = 0, /* or <addr_of_next_setup_data_struct> */
854-
.type = SETUP_INDIRECT,
855-
.len = sizeof(setup_indirect),
856-
.data[sizeof(setup_indirect)] = (struct setup_indirect) {
857-
.type = SETUP_INDIRECT | SETUP_E820_EXT,
858-
.reserved = 0,
859-
.len = <len_of_SETUP_E820_EXT_data>,
860-
.addr = <addr_of_SETUP_E820_EXT_data>,
861-
},
853+
.next = 0, /* or <addr_of_next_setup_data_struct> */
854+
.type = SETUP_INDIRECT,
855+
.len = sizeof(setup_indirect),
856+
.data[sizeof(setup_indirect)] = (struct setup_indirect) {
857+
.type = SETUP_INDIRECT | SETUP_E820_EXT,
858+
.reserved = 0,
859+
.len = <len_of_SETUP_E820_EXT_data>,
860+
.addr = <addr_of_SETUP_E820_EXT_data>,
861+
},
862862
}
863863
864864
.. note::
@@ -897,11 +897,11 @@ Offset/size: 0x260/4
897897
The kernel runtime start address is determined by the following algorithm::
898898

899899
if (relocatable_kernel) {
900-
if (load_address < pref_address)
901-
load_address = pref_address;
902-
runtime_start = align_up(load_address, kernel_alignment);
900+
if (load_address < pref_address)
901+
load_address = pref_address;
902+
runtime_start = align_up(load_address, kernel_alignment);
903903
} else {
904-
runtime_start = pref_address;
904+
runtime_start = pref_address;
905905
}
906906

907907
Hence the necessary memory window location and size can be estimated by
@@ -975,22 +975,22 @@ after kernel_info_var_len_data label. Each chunk of variable size data has to
975975
be prefixed with header/magic and its size, e.g.::
976976

977977
kernel_info:
978-
.ascii "LToP" /* Header, Linux top (structure). */
979-
.long kernel_info_var_len_data - kernel_info
980-
.long kernel_info_end - kernel_info
981-
.long 0x01234567 /* Some fixed size data for the bootloaders. */
978+
.ascii "LToP" /* Header, Linux top (structure). */
979+
.long kernel_info_var_len_data - kernel_info
980+
.long kernel_info_end - kernel_info
981+
.long 0x01234567 /* Some fixed size data for the bootloaders. */
982982
kernel_info_var_len_data:
983983
example_struct: /* Some variable size data for the bootloaders. */
984-
.ascii "0123" /* Header/Magic. */
985-
.long example_struct_end - example_struct
986-
.ascii "Struct"
987-
.long 0x89012345
984+
.ascii "0123" /* Header/Magic. */
985+
.long example_struct_end - example_struct
986+
.ascii "Struct"
987+
.long 0x89012345
988988
example_struct_end:
989989
example_strings: /* Some variable size data for the bootloaders. */
990-
.ascii "ABCD" /* Header/Magic. */
991-
.long example_strings_end - example_strings
992-
.asciz "String_0"
993-
.asciz "String_1"
990+
.ascii "ABCD" /* Header/Magic. */
991+
.long example_strings_end - example_strings
992+
.asciz "String_0"
993+
.asciz "String_1"
994994
example_strings_end:
995995
kernel_info_end:
996996

@@ -1132,53 +1132,53 @@ Such a boot loader should enter the following fields in the header::
11321132
unsigned long base_ptr; /* base address for real-mode segment */
11331133
11341134
if (setup_sects == 0)
1135-
setup_sects = 4;
1135+
setup_sects = 4;
11361136

11371137
if (protocol >= 0x0200) {
1138-
type_of_loader = <type code>;
1139-
if (loading_initrd) {
1140-
ramdisk_image = <initrd_address>;
1141-
ramdisk_size = <initrd_size>;
1142-
}
1143-
1144-
if (protocol >= 0x0202 && loadflags & 0x01)
1145-
heap_end = 0xe000;
1146-
else
1147-
heap_end = 0x9800;
1148-
1149-
if (protocol >= 0x0201) {
1150-
heap_end_ptr = heap_end - 0x200;
1151-
loadflags |= 0x80; /* CAN_USE_HEAP */
1152-
}
1153-
1154-
if (protocol >= 0x0202) {
1155-
cmd_line_ptr = base_ptr + heap_end;
1156-
strcpy(cmd_line_ptr, cmdline);
1157-
} else {
1158-
cmd_line_magic = 0xA33F;
1159-
cmd_line_offset = heap_end;
1160-
setup_move_size = heap_end + strlen(cmdline) + 1;
1161-
strcpy(base_ptr + cmd_line_offset, cmdline);
1162-
}
1138+
type_of_loader = <type code>;
1139+
if (loading_initrd) {
1140+
ramdisk_image = <initrd_address>;
1141+
ramdisk_size = <initrd_size>;
1142+
}
1143+
1144+
if (protocol >= 0x0202 && loadflags & 0x01)
1145+
heap_end = 0xe000;
1146+
else
1147+
heap_end = 0x9800;
1148+
1149+
if (protocol >= 0x0201) {
1150+
heap_end_ptr = heap_end - 0x200;
1151+
loadflags |= 0x80; /* CAN_USE_HEAP */
1152+
}
1153+
1154+
if (protocol >= 0x0202) {
1155+
cmd_line_ptr = base_ptr + heap_end;
1156+
strcpy(cmd_line_ptr, cmdline);
1157+
} else {
1158+
cmd_line_magic = 0xA33F;
1159+
cmd_line_offset = heap_end;
1160+
setup_move_size = heap_end + strlen(cmdline) + 1;
1161+
strcpy(base_ptr + cmd_line_offset, cmdline);
1162+
}
11631163
} else {
1164-
/* Very old kernel */
1164+
/* Very old kernel */
11651165
1166-
heap_end = 0x9800;
1166+
heap_end = 0x9800;
11671167

1168-
cmd_line_magic = 0xA33F;
1169-
cmd_line_offset = heap_end;
1168+
cmd_line_magic = 0xA33F;
1169+
cmd_line_offset = heap_end;
11701170

1171-
/* A very old kernel MUST have its real-mode code loaded at 0x90000 */
1172-
if (base_ptr != 0x90000) {
1173-
/* Copy the real-mode kernel */
1174-
memcpy(0x90000, base_ptr, (setup_sects + 1) * 512);
1175-
base_ptr = 0x90000; /* Relocated */
1176-
}
1171+
/* A very old kernel MUST have its real-mode code loaded at 0x90000 */
1172+
if (base_ptr != 0x90000) {
1173+
/* Copy the real-mode kernel */
1174+
memcpy(0x90000, base_ptr, (setup_sects + 1) * 512);
1175+
base_ptr = 0x90000; /* Relocated */
1176+
}
11771177
1178-
strcpy(0x90000 + cmd_line_offset, cmdline);
1178+
strcpy(0x90000 + cmd_line_offset, cmdline);
11791179

1180-
/* It is recommended to clear memory up to the 32K mark */
1181-
memset(0x90000 + (setup_sects + 1) * 512, 0, (64 - (setup_sects + 1)) * 512);
1180+
/* It is recommended to clear memory up to the 32K mark */
1181+
memset(0x90000 + (setup_sects + 1) * 512, 0, (64 - (setup_sects + 1)) * 512);
11821182
}
11831183
11841184

arch/x86/include/asm/bug.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ extern void __WARN_trap(struct bug_entry *bug, ...);
1515
/*
1616
* Despite that some emulators terminate on UD2, we use it for WARN().
1717
*/
18-
#define ASM_UD2 _ASM_BYTES(0x0f, 0x0b)
18+
#define ASM_UD2 __ASM_FORM(ud2)
1919
#define INSN_UD2 0x0b0f
2020
#define LEN_UD2 2
2121

arch/x86/include/asm/irq_remapping.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,11 @@ static inline void panic_if_irq_remap(const char *msg)
8787
}
8888

8989
#endif /* CONFIG_IRQ_REMAP */
90+
91+
#ifdef CONFIG_X86_POSTED_MSI
92+
void intel_ack_posted_msi_irq(struct irq_data *irqd);
93+
#else
94+
#define intel_ack_posted_msi_irq NULL
95+
#endif
96+
9097
#endif /* __X86_IRQ_REMAPPING_H */

arch/x86/include/asm/uv/bios.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ struct uv_systab {
122122
struct {
123123
u32 type:8; /* type of entry */
124124
u32 offset:24; /* byte offset from struct start to entry */
125-
} entry[1]; /* additional entries follow */
125+
} entry[]; /* additional entries follow */
126126
};
127127
extern struct uv_systab *uv_systab;
128128

arch/x86/kernel/cpu/sgx/ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ static int __sgx_encl_add_page(struct sgx_encl *encl,
242242
/*
243243
* If the caller requires measurement of the page as a proof for the content,
244244
* use EEXTEND to add a measurement for 256 bytes of the page. Repeat this
245-
* operation until the entire page is measured."
245+
* operation until the entire page is measured.
246246
*/
247247
static int __sgx_encl_extend(struct sgx_encl *encl,
248248
struct sgx_epc_page *epc_page)

arch/x86/kernel/fpu/xstate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,7 +1946,7 @@ static int dump_xsave_layout_desc(struct coredump_params *cprm)
19461946
};
19471947

19481948
if (!dump_emit(cprm, &xc, sizeof(xc)))
1949-
return 0;
1949+
return -1;
19501950

19511951
num_records++;
19521952
}
@@ -1984,7 +1984,7 @@ int elf_coredump_extra_notes_write(struct coredump_params *cprm)
19841984
return 1;
19851985

19861986
num_records = dump_xsave_layout_desc(cprm);
1987-
if (!num_records)
1987+
if (num_records < 0)
19881988
return 1;
19891989

19901990
/* Total size should be equal to the number of records */

0 commit comments

Comments
 (0)