Skip to content

Commit 84be880

Browse files
author
Matt Fleming
committed
Revert "efi/x86: efistub: Move shared dependencies to <asm/efi.h>"
This reverts commit f23cf8b ("efi/x86: efistub: Move shared dependencies to <asm/efi.h>") as well as the x86 parts of commit f4f75ad ("efi: efistub: Convert into static library"). The road leading to these two reverts is long and winding. The above two commits were merged during the v3.17 merge window and turned the common EFI boot stub code into a static library. This necessitated making some symbols global in the x86 boot stub which introduced new entries into the early boot GOT. The problem was that we weren't fixing up the newly created GOT entries before invoking the EFI boot stub, which sometimes resulted in hangs or resets. This failure was reported by Maarten on his Macbook pro. The proposed fix was commit 9cb0e39 ("x86/efi: Fixup GOT in all boot code paths"). However, that caused issues for Linus when booting his Sony Vaio Pro 11. It was subsequently reverted in commit f367039. So that leaves us back with Maarten's Macbook pro not booting. At this stage in the release cycle the least risky option is to revert the x86 EFI boot stub to the pre-merge window code structure where we explicitly #include efi-stub-helper.c instead of linking with the static library. The arm64 code remains unaffected. We can take another swing at the x86 parts for v3.18. Conflicts: arch/x86/include/asm/efi.h Tested-by: Josh Boyer <jwboyer@fedoraproject.org> Tested-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Tested-by: Leif Lindholm <leif.lindholm@linaro.org> [arm64] Tested-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>, Cc: Ingo Molnar <mingo@kernel.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
1 parent 3eddc69 commit 84be880

5 files changed

Lines changed: 24 additions & 28 deletions

File tree

‎arch/x86/boot/compressed/Makefile‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
3333
$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
3434

3535
ifeq ($(CONFIG_EFI_STUB), y)
36-
VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o \
37-
$(objtree)/drivers/firmware/efi/libstub/lib.a
36+
VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o
3837
endif
3938

4039
$(obj)/vmlinux: $(VMLINUX_OBJS) FORCE

‎arch/x86/boot/compressed/eboot.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919

2020
static efi_system_table_t *sys_table;
2121

22-
struct efi_config *efi_early;
22+
static struct efi_config *efi_early;
23+
24+
#define efi_call_early(f, ...) \
25+
efi_early->call(efi_early->f, __VA_ARGS__);
2326

2427
#define BOOT_SERVICES(bits) \
2528
static void setup_boot_services##bits(struct efi_config *c) \
@@ -280,6 +283,8 @@ void efi_char16_printk(efi_system_table_t *table, efi_char16_t *str)
280283
}
281284
}
282285

286+
#include "../../../../drivers/firmware/efi/libstub/efi-stub-helper.c"
287+
283288
static void find_bits(unsigned long mask, u8 *pos, u8 *size)
284289
{
285290
u8 first, len;

‎arch/x86/boot/compressed/eboot.h‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,20 @@ struct efi_uga_draw_protocol {
103103
void *blt;
104104
};
105105

106+
struct efi_config {
107+
u64 image_handle;
108+
u64 table;
109+
u64 allocate_pool;
110+
u64 allocate_pages;
111+
u64 get_memory_map;
112+
u64 free_pool;
113+
u64 free_pages;
114+
u64 locate_handle;
115+
u64 handle_protocol;
116+
u64 exit_boot_services;
117+
u64 text_output;
118+
efi_status_t (*call)(unsigned long, ...);
119+
bool is64;
120+
} __packed;
121+
106122
#endif /* BOOT_COMPRESSED_EBOOT_H */

‎arch/x86/include/asm/efi.h‎

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -159,30 +159,6 @@ static inline efi_status_t efi_thunk_set_virtual_address_map(
159159
}
160160
#endif /* CONFIG_EFI_MIXED */
161161

162-
163-
/* arch specific definitions used by the stub code */
164-
165-
struct efi_config {
166-
u64 image_handle;
167-
u64 table;
168-
u64 allocate_pool;
169-
u64 allocate_pages;
170-
u64 get_memory_map;
171-
u64 free_pool;
172-
u64 free_pages;
173-
u64 locate_handle;
174-
u64 handle_protocol;
175-
u64 exit_boot_services;
176-
u64 text_output;
177-
efi_status_t (*call)(unsigned long, ...);
178-
bool is64;
179-
} __packed;
180-
181-
extern struct efi_config *efi_early;
182-
183-
#define efi_call_early(f, ...) \
184-
efi_early->call(efi_early->f, __VA_ARGS__);
185-
186162
extern bool efi_reboot_required(void);
187163

188164
#else

‎drivers/firmware/efi/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ obj-$(CONFIG_EFI_VARS_PSTORE) += efi-pstore.o
77
obj-$(CONFIG_UEFI_CPER) += cper.o
88
obj-$(CONFIG_EFI_RUNTIME_MAP) += runtime-map.o
99
obj-$(CONFIG_EFI_RUNTIME_WRAPPERS) += runtime-wrappers.o
10-
obj-$(CONFIG_EFI_STUB) += libstub/
10+
obj-$(CONFIG_EFI_ARM_STUB) += libstub/

0 commit comments

Comments
 (0)