Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit e55037c

Browse files
committed
Merge tag 'efi-next-for-v6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi
Pull EFI updates from Ard Biesheuvel: "Note the removal of the EFI fake memory map support - this is believed to be unused and no longer worth supporting. However, we could easily bring it back if needed. With recent developments regarding confidential VMs and unaccepted memory, combined with kexec, creating a known inaccurate view of the firmware's memory map and handing it to the OS is a feature we can live without, hence the removal. Alternatively, I could imagine making this feature mutually exclusive with those confidential VM related features, but let's try simply removing it first. Summary: - Drop support for the 'fake' EFI memory map on x86 - Add an SMBIOS based tweak to the EFI stub instructing the firmware on x86 Macbook Pros to keep both GPUs enabled - Replace 0-sized array with flexible array in EFI memory attributes table handling - Drop redundant BSS clearing when booting via the native PE entrypoint on x86 - Avoid returning EFI_SUCCESS when aborting on an out-of-memory condition - Cosmetic tweak for arm64 KASLR loading logic" * tag 'efi-next-for-v6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi: efi: Replace efi_memory_attributes_table_t 0-sized array with flexible array efi: Rename efi_early_memdesc_ptr() to efi_memdesc_ptr() arm64/efistub: Clean up KASLR logic x86/efistub: Drop redundant clearing of BSS x86/efistub: Avoid returning EFI_SUCCESS on error x86/efistub: Call Apple set_os protocol on dual GPU Intel Macs x86/efistub: Enable SMBIOS protocol handling for x86 efistub/smbios: Simplify SMBIOS enumeration API x86/efi: Drop support for fake EFI memory maps
2 parents d80f299 + 4a2ebb0 commit e55037c

File tree

20 files changed

+146
-356
lines changed

20 files changed

+146
-356
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,27 +1435,6 @@
14351435
you are really sure that your UEFI does sane gc and
14361436
fulfills the spec otherwise your board may brick.
14371437

1438-
efi_fake_mem= nn[KMG]@ss[KMG]:aa[,nn[KMG]@ss[KMG]:aa,..] [EFI,X86,EARLY]
1439-
Add arbitrary attribute to specific memory range by
1440-
updating original EFI memory map.
1441-
Region of memory which aa attribute is added to is
1442-
from ss to ss+nn.
1443-
1444-
If efi_fake_mem=2G@4G:0x10000,2G@0x10a0000000:0x10000
1445-
is specified, EFI_MEMORY_MORE_RELIABLE(0x10000)
1446-
attribute is added to range 0x100000000-0x180000000 and
1447-
0x10a0000000-0x1120000000.
1448-
1449-
If efi_fake_mem=8G@9G:0x40000 is specified, the
1450-
EFI_MEMORY_SP(0x40000) attribute is added to
1451-
range 0x240000000-0x43fffffff.
1452-
1453-
Using this parameter you can do debugging of EFI memmap
1454-
related features. For example, you can do debugging of
1455-
Address Range Mirroring feature even if your box
1456-
doesn't support it, or mark specific memory as
1457-
"soft reserved".
1458-
14591438
efivar_ssdt= [EFI; X86] Name of an EFI variable that contains an SSDT
14601439
that is to be dynamically loaded by Linux. If there are
14611440
multiple variables with the same name but with different

arch/x86/Kconfig

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2045,26 +2045,6 @@ config EFI_MIXED
20452045

20462046
If unsure, say N.
20472047

2048-
config EFI_FAKE_MEMMAP
2049-
bool "Enable EFI fake memory map"
2050-
depends on EFI
2051-
help
2052-
Saying Y here will enable "efi_fake_mem" boot option. By specifying
2053-
this parameter, you can add arbitrary attribute to specific memory
2054-
range by updating original (firmware provided) EFI memmap. This is
2055-
useful for debugging of EFI memmap related feature, e.g., Address
2056-
Range Mirroring feature.
2057-
2058-
config EFI_MAX_FAKE_MEM
2059-
int "maximum allowable number of ranges in efi_fake_mem boot option"
2060-
depends on EFI_FAKE_MEMMAP
2061-
range 1 128
2062-
default 8
2063-
help
2064-
Maximum allowable number of ranges in efi_fake_mem boot option.
2065-
Ranges can be set up to this value using comma-separated list.
2066-
The default value is 8.
2067-
20682048
config EFI_RUNTIME_MAP
20692049
bool "Export EFI runtime maps to sysfs" if EXPERT
20702050
depends on EFI

arch/x86/boot/compressed/kaslr.c

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,8 @@ char *skip_spaces(const char *str)
119119
#include "../../../../lib/ctype.c"
120120
#include "../../../../lib/cmdline.c"
121121

122-
enum parse_mode {
123-
PARSE_MEMMAP,
124-
PARSE_EFI,
125-
};
126-
127122
static int
128-
parse_memmap(char *p, u64 *start, u64 *size, enum parse_mode mode)
123+
parse_memmap(char *p, u64 *start, u64 *size)
129124
{
130125
char *oldp;
131126

@@ -148,29 +143,11 @@ parse_memmap(char *p, u64 *start, u64 *size, enum parse_mode mode)
148143
*start = memparse(p + 1, &p);
149144
return 0;
150145
case '@':
151-
if (mode == PARSE_MEMMAP) {
152-
/*
153-
* memmap=nn@ss specifies usable region, should
154-
* be skipped
155-
*/
156-
*size = 0;
157-
} else {
158-
u64 flags;
159-
160-
/*
161-
* efi_fake_mem=nn@ss:attr the attr specifies
162-
* flags that might imply a soft-reservation.
163-
*/
164-
*start = memparse(p + 1, &p);
165-
if (p && *p == ':') {
166-
p++;
167-
if (kstrtoull(p, 0, &flags) < 0)
168-
*size = 0;
169-
else if (flags & EFI_MEMORY_SP)
170-
return 0;
171-
}
172-
*size = 0;
173-
}
146+
/*
147+
* memmap=nn@ss specifies usable region, should
148+
* be skipped
149+
*/
150+
*size = 0;
174151
fallthrough;
175152
default:
176153
/*
@@ -185,7 +162,7 @@ parse_memmap(char *p, u64 *start, u64 *size, enum parse_mode mode)
185162
return -EINVAL;
186163
}
187164

188-
static void mem_avoid_memmap(enum parse_mode mode, char *str)
165+
static void mem_avoid_memmap(char *str)
189166
{
190167
static int i;
191168

@@ -200,7 +177,7 @@ static void mem_avoid_memmap(enum parse_mode mode, char *str)
200177
if (k)
201178
*k++ = 0;
202179

203-
rc = parse_memmap(str, &start, &size, mode);
180+
rc = parse_memmap(str, &start, &size);
204181
if (rc < 0)
205182
break;
206183
str = k;
@@ -281,7 +258,7 @@ static void handle_mem_options(void)
281258
break;
282259

283260
if (!strcmp(param, "memmap")) {
284-
mem_avoid_memmap(PARSE_MEMMAP, val);
261+
mem_avoid_memmap(val);
285262
} else if (IS_ENABLED(CONFIG_X86_64) && strstr(param, "hugepages")) {
286263
parse_gb_huge_pages(param, val);
287264
} else if (!strcmp(param, "mem")) {
@@ -295,8 +272,6 @@ static void handle_mem_options(void)
295272

296273
if (mem_size < mem_limit)
297274
mem_limit = mem_size;
298-
} else if (!strcmp(param, "efi_fake_mem")) {
299-
mem_avoid_memmap(PARSE_EFI, val);
300275
}
301276
}
302277

arch/x86/include/asm/efi.h

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ static inline bool efi_is_native(void)
229229

230230
static inline void *efi64_zero_upper(void *p)
231231
{
232-
((u32 *)p)[1] = 0;
232+
if (p)
233+
((u32 *)p)[1] = 0;
233234
return p;
234235
}
235236

@@ -315,6 +316,10 @@ static inline u32 efi64_convert_status(efi_status_t status)
315316
#define __efi64_argmap_clear_memory_attributes(protocol, phys, size, flags) \
316317
((protocol), __efi64_split(phys), __efi64_split(size), __efi64_split(flags))
317318

319+
/* EFI SMBIOS protocol */
320+
#define __efi64_argmap_get_next(protocol, smbioshandle, type, record, phandle) \
321+
((protocol), (smbioshandle), (type), efi64_zero_upper(record), \
322+
efi64_zero_upper(phandle))
318323
/*
319324
* The macros below handle the plumbing for the argument mapping. To add a
320325
* mapping for a specific EFI method, simply define a macro
@@ -384,23 +389,8 @@ static inline void efi_reserve_boot_services(void)
384389
}
385390
#endif /* CONFIG_EFI */
386391

387-
#ifdef CONFIG_EFI_FAKE_MEMMAP
388-
extern void __init efi_fake_memmap_early(void);
389-
extern void __init efi_fake_memmap(void);
390-
#else
391-
static inline void efi_fake_memmap_early(void)
392-
{
393-
}
394-
395-
static inline void efi_fake_memmap(void)
396-
{
397-
}
398-
#endif
399-
400392
extern int __init efi_memmap_alloc(unsigned int num_entries,
401393
struct efi_memory_map_data *data);
402-
extern void __efi_memmap_free(u64 phys, unsigned long size,
403-
unsigned long flags);
404394

405395
extern int __init efi_memmap_install(struct efi_memory_map_data *data);
406396
extern int __init efi_memmap_split_count(efi_memory_desc_t *md,

arch/x86/kernel/setup.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,6 @@ void __init setup_arch(char **cmdline_p)
997997
mem_encrypt_setup_arch();
998998
cc_random_init();
999999

1000-
efi_fake_memmap();
10011000
efi_find_mirror();
10021001
efi_esrt_init();
10031002
efi_mokvar_table_init();

arch/x86/platform/efi/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ GCOV_PROFILE := n
55
obj-$(CONFIG_EFI) += memmap.o quirks.o efi.o efi_$(BITS).o \
66
efi_stub_$(BITS).o
77
obj-$(CONFIG_EFI_MIXED) += efi_thunk_$(BITS).o
8-
obj-$(CONFIG_EFI_FAKE_MEMMAP) += fake_mem.o
98
obj-$(CONFIG_EFI_RUNTIME_MAP) += runtime-map.o

arch/x86/platform/efi/efi.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,6 @@ int __init efi_memblock_x86_reserve_range(void)
226226
if (add_efi_memmap || do_efi_soft_reserve())
227227
do_add_efi_memmap();
228228

229-
efi_fake_memmap_early();
230-
231229
WARN(efi.memmap.desc_version != 1,
232230
"Unexpected EFI_MEMORY_DESCRIPTOR version %ld",
233231
efi.memmap.desc_version);

0 commit comments

Comments
 (0)