x86 fixes
Linus,
Please pull the latest x86-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-for-linus
# HEAD: 5ac385d83525fb8924ef87c18a4dc49998366394 Merge tag 'efi-urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi into x86/urgent
Misc fixes: EFI fixes, a build fix, a page table dumping (debug) fix and a clang build fix.
out-of-topic modifications in x86-urgent-for-linus:
-----------------------------------------------------
arch/arm64/mm/init.c # 0ceac9e094b0: efi/arm64: Fix fdt-related m
drivers/firmware/efi/libstub/fdt.c # 0ceac9e094b0: efi/arm64: Fix fdt-related m
Thanks,
Ingo
------------------>
Jan-Simon Möller (1):
x86/mm: Apply the section attribute to the variable, not its type
Jiang Liu (1):
x86, irq: Fix build error caused by 9eabc99a635a77cbf09
Mark Salter (1):
efi/arm64: Fix fdt-related memory reservation
Mathias Krause (1):
x86-64, ptdump: Mark espfix area only if existent
Matt Fleming (1):
x86/efi: Fixup GOT in all boot code paths
Yinghai Lu (1):
x86/efi: Only load initrd above 4g on second try
arch/arm64/mm/init.c | 3 +- arch/x86/boot/compressed/eboot.c | 18 +++++++----- arch/x86/boot/compressed/head_32.S | 54 ++++++++++++++++++++++++++---------- arch/x86/boot/compressed/head_64.S | 56 ++++++++++++++++++++++++++++---------- arch/x86/include/asm/io_apic.h | 1 + arch/x86/mm/dump_pagetables.c | 4 +++ arch/x86/mm/mmap.c | 2 +- drivers/firmware/efi/libstub/fdt.c | 10 ++++++- 8 files changed, 108 insertions(+), 40 deletions(-)
arch/arm64/mm/init.c +1 -2
@@ -149,8 +149,7 @@ void __init arm64_memblock_init(void)memblock_reserve (__virt_to_phys (initrd_start), initrd_end - initrd_start);#endif -if (!efi_enabled (EFI_MEMMAP )) -early_init_fdt_scan_reserved_mem (); +early_init_fdt_scan_reserved_mem ();/* 4GB maximum for 32-bit only capable devices */ if (IS_ENABLED (CONFIG_ZONE_DMA ))
arch/x86/boot/compressed/eboot.c +11 -7
@@ -1032,7 +1032,6 @@ struct boot_params *make_boot_params(struct efi_config *c)int i;unsigned long ramdisk_addr;unsigned long ramdisk_size; -unsigned long initrd_addr_max; efi_early = c; sys_table = (efi_system_table_t *)(unsigned long )efi_early->table;
@@ -1095,15 +1094,20 @@ struct boot_params *make_boot_params(struct efi_config *c)memset (sdt,0 ,sizeof (*sdt)); -if (hdr->xloadflags &XLF_CAN_BE_LOADED_ABOVE_4G ) - initrd_addr_max =-1UL ; -else - initrd_addr_max = hdr->initrd_addr_max; - status =handle_cmdline_files (sys_table, image, (char *)(unsigned long )hdr->cmd_line_ptr, -"initrd=" , initrd_addr_max, +"initrd=" , hdr->initrd_addr_max, &ramdisk_addr, &ramdisk_size); + +if (status !=EFI_SUCCESS && + hdr->xloadflags &XLF_CAN_BE_LOADED_ABOVE_4G ) { +efi_printk (sys_table,"Trying to load files to higher address\n" ); + status =handle_cmdline_files (sys_table, image, + (char *)(unsigned long )hdr->cmd_line_ptr, +"initrd=" ,-1UL , + &ramdisk_addr, &ramdisk_size); + } +if (status !=EFI_SUCCESS ) goto fail2; hdr->ramdisk_image = ramdisk_addr &0xffffffff ;
arch/x86/boot/compressed/head_32.S +40 -14
85 lines not on this page · raw message
arch/x86/boot/compressed/head_64.S +41 -15
92 lines not on this page · raw message
arch/x86/include/asm/io_apic.h +1 -0
@@ -239,6 +239,7 @@ static inline int mp_find_ioapic(u32 gsi) { return 0; }static inline u32 mp_pin_to_gsi (int ioapic,int pin) {return UINT_MAX ; }static inline int mp_map_gsi_to_irq (u32 gsi,unsigned int flags) {return gsi; }static inline void mp_unmap_irq (int irq) { } +static inline bool mp_should_keep_irq (struct device *dev) {return 1 ; }static inline int save_ioapic_entries (void ) {
arch/x86/mm/dump_pagetables.c +4 -0
@@ -48,7 +48,9 @@ enum address_markers_idx {LOW_KERNEL_NR ,VMALLOC_START_NR ,VMEMMAP_START_NR , +# ifdef CONFIG_X86_ESPFIX64ESPFIX_START_NR , +# endifHIGH_KERNEL_NR ,MODULES_VADDR_NR , MODULES_END_NR,
@@ -71,7 +73,9 @@ static struct addr_marker address_markers[] = { { PAGE_OFFSET, "Low Kernel Mapping" }, { VMALLOC_START, "vmalloc() Area" }, { VMEMMAP_START, "Vmemmap" }, +# ifdef CONFIG_X86_ESPFIX64 { ESPFIX_BASE_ADDR, "ESPfix Area", 16 }, +# endif { __START_KERNEL_map, "High Kernel Mapping" }, { MODULES_VADDR, "Modules" }, { MODULES_END, "End Modules" },
arch/x86/mm/mmap.c +1 -1
@@ -31,7 +31,7 @@#include <linux/sched.h> #include <asm/elf.h> -struct __read_mostly va_alignment va_align = { +struct va_alignment __read_mostly va_align = { .flags =-1 , };
drivers/firmware/efi/libstub/fdt.c +9 -1
@@ -22,7 +22,7 @@ efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, unsigned long map_size, unsigned long desc_size, u32 desc_ver) { - int node, prev; + int node, prev, num_rsv;int status;u32 fdt_val32;u64 fdt_val64;
@@ -73,6 +73,14 @@ efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, prev = node; } +/* +* Delete all memory reserve map entries. When booting via UEFI, +* kernel will use the UEFI memory map to find reserved regions. +*/ + num_rsv =fdt_num_mem_rsv (fdt); +while (num_rsv-- >0 ) +fdt_del_mem_rsv (fdt, num_rsv); + node =fdt_subnode_offset (fdt,0 ,"chosen" );if (node <0 ) { node =fdt_add_subnode (fdt,0 ,"chosen" );
Quoted 2 lines · Ingo Molnar
Please pull the latest x86-urgent-for-linus git tree from:
I only just noticed, but this pull request causes my Sony Vaio laptop to immediately reboot at startup.
I'm assuming it's one of the efi changes, but I'm bisecting now to say exactly where it happens. It will get reverted.
Linus
Quoted 9 lines · Linus Torvalds
Quoted 2 lines · Ingo Molnar
Please pull the latest x86-urgent-for-linus git tree from:
I only just noticed, but this pull request causes my Sony Vaio laptop to immediately reboot at startup.
I'm assuming it's one of the efi changes, but I'm bisecting now to say exactly where it happens. It will get reverted.
I've Cc:-ed Matt.
My guess would be one of these two EFI commits:
* Fix early boot regression affecting x86 EFI boot stub when loading initrds above 4GB - Yinghai Lu
47226ad4f4cf x86/efi: Only load initrd above 4g on second try
* Relocate GOT entries in the x86 EFI boot stub now that we have symbols with global visibility - Matt Fleming
9cb0e394234d x86/efi: Fixup GOT in all boot code paths
If it's 9cb0e394234d - then it's perhaps a build quirk, or a bug in the assembly code. If so then we'd have to revert this, and reintroduce another regression, caused by EFI commit f23cf8bd5c1f49 in this merge window. The most recent commit is easy to revert, the older one not.
If it's 47226ad4f4cf then we'd reintroduce the regression caused by 4bf7111f501 in the previous merge window. They both revert cleanly after each other - but it might be safer to just revert the most recent one.
My guess is that your regression is caused by 47226ad4f4cf.
Sorry about this, the timing is unfortunate.
Thanks,
Ingo
Quoted 33 lines · Ingo Molnar
Quoted 9 lines · Linus Torvalds
Quoted 2 lines · Ingo Molnar
Please pull the latest x86-urgent-for-linus git tree from:
I only just noticed, but this pull request causes my Sony Vaio laptop to immediately reboot at startup.
I'm assuming it's one of the efi changes, but I'm bisecting now to say exactly where it happens. It will get reverted.
I've Cc:-ed Matt.
My guess would be one of these two EFI commits:
* Fix early boot regression affecting x86 EFI boot stub when loading initrds above 4GB - Yinghai Lu
47226ad4f4cfx86/efi: Only load initrd above 4g on second try* Relocate GOT entries in the x86 EFI boot stub now that we have symbols with global visibility - Matt Fleming
9cb0e394234dx86/efi: Fixup GOT in all boot code pathsIf it's
9cb0e394234d- then it's perhaps a build quirk, or a bug in the assembly code. If so then we'd have to revert this, and reintroduce another regression, caused by EFI commitf23cf8bd5c1f49in this merge window. The most recent commit is easy to revert, the older one not.
Quoted 6 lines
If it's
47226ad4f4cfthen we'd reintroduce the regression caused by4bf7111f501in the previous merge window. They both revert cleanly after each other - but it might be safer to just revert the most recent one.My guess is that your regression is caused by
47226ad4f4cf.
Wrong sha1: my guess is on 9cb0e394234d, the GOT fixup.
Thanks,
Ingo
H. Peter Anvin
reviewerThat would be my guess, too.
Quoted 51 lines · Ingo Molnar
Quoted 4 lines · Ingo Molnar
Quoted 1 line · Linus Torvalds
On Fri, Sep 19, 2014 at 3:40 AM, Ingo Molnar <[email protected]>
Quoted 6 lines · wrote:
Quoted 6 lines
Quoted 2 lines
Please pull the latest x86-urgent-for-linus git tree from:
I only just noticed, but this pull request causes my Sony Vaio laptop to immediately reboot at startup.
Quoted 8 lines
Quoted 2 lines
I'm assuming it's one of the efi changes, but I'm bisecting now to say exactly where it happens. It will get reverted.
I've Cc:-ed Matt.
My guess would be one of these two EFI commits:
* Fix early boot regression affecting x86 EFI boot stub when
loading
Quoted 5 lines
initrds above 4GB - Yinghai Lu
47226ad4f4cfx86/efi: Only load initrd above 4g on second try* Relocate GOT entries in the x86 EFI boot stub now that we
have
Quoted 10 lines
symbols with global visibility - Matt Fleming
9cb0e394234dx86/efi: Fixup GOT in all boot code pathsIf it's
9cb0e394234d- then it's perhaps a build quirk, or a bug in the assembly code. If so then we'd have to revert this, and reintroduce another regression, caused by EFI commitf23cf8bd5c1f49in this merge window. The most recent commit is easy to revert, the older one not.Quoted 6 lines
If it's
47226ad4f4cfthen we'd reintroduce the regression caused by4bf7111f501in the previous merge window. They both revert cleanly after each other - but it might be safer to just revert the most recent one.My guess is that your regression is caused by
47226ad4f4cf.Wrong sha1: my guess is on
9cb0e394234d, the GOT fixup.Thanks,
Ingo
Signature · 1 line
Sent from my mobile phone. Please pardon brevity and lack of formatting.
Yup. It's 9cb0e394234d ("x86/efi: Fixup GOT in all boot code paths") according to bisect.
Now building current git with that reverted, just to double-check, before pushing the revert out.
Linus
Quoted 5 lines · H. Peter Anvin
That would be my guess, too.
Quoted 2 lines · Ingo Molnar
Wrong sha1: my guess is on
9cb0e394234d, the GOT fixup.
Quoted 3 lines · Linus Torvalds
Now building current git with that reverted, just to double-check, before pushing the revert out.
Double-checked and verified. Revert pushed out,
Linus
Quoted 5 lines · Linus Torvalds
Yup. It's
9cb0e394234d("x86/efi: Fixup GOT in all boot code paths") according to bisect.Now building current git with that reverted, just to double-check, before pushing the revert out.
Crap. Sorry about that. I did get a report last night from Josh (Cc'd) that the above commit caused hangs during boot on a bunch of his machines. All grub2 and all secure boot enabled, I think.
Linus, what are the particulars of your Sony machine? Are you running with secure boot on? Is is a regular grub2/Fedora machine?
Reverting this is obviously the way to go, but it would be useful to diagnose this failure some more - there's clearly a gap in my testing.
A message that is not in the archive (sent off-list or not yet received): CA+55aFz+2tf7zEGjVmkVuncZssiDdVRKJ=OUfgnDFf2TYN-KvA@mail.gmail.com
Quoted 4 lines · Linus Torvalds
Quoted 1 line · Matt Fleming
Quoted 8 lines
Quoted 1 line
Linus, what are the particulars of your Sony machine? Are you
running
Quoted 1 line
with secure boot on? Is is a regular grub2/Fedora machine?
It's a regular fedora 20 install with grub2, yes, and set for EFI boot rather than legacy bios. But I don't play around with signing stuff, so it ends up saying "booting in insecure mode" at startup (our something like that, I'm not at the machine right now).
OK that's good at least. There seems to be a pattern here, booting with Fedora's grub2.
Quoted 6 lines
Quoted 2 lines
Reverting this is obviously the way to go, but it would be useful to diagnose this failure some more - there's clearly a gap in my
testing.
It literally just reboots after loading the kernel, so not a lot to go on. I can try things out if you want to, though.
Thanks! I'll let you know. I'm gonna try and recreate the problem here first since this early boot debugging is a massive PITA.
Quoted 10 lines · Matt Fleming
Quoted 5 lines · Linus Torvalds
Yup. It's
9cb0e394234d("x86/efi: Fixup GOT in all boot code paths") according to bisect.Now building current git with that reverted, just to double-check, before pushing the revert out.
Crap. Sorry about that. I did get a report last night from Josh (Cc'd) that the above commit caused hangs during boot on a bunch of his machines. All grub2 and all secure boot enabled, I think.
All shim/grub2, but only one machine has SB enabled. All of the kernels are signed still.
josh
Quoted 35 lines · Ingo Molnar
Quoted 33 lines · Ingo Molnar
Quoted 9 lines · Linus Torvalds
Quoted 2 lines · Ingo Molnar
Please pull the latest x86-urgent-for-linus git tree from:
I only just noticed, but this pull request causes my Sony Vaio laptop to immediately reboot at startup.
I'm assuming it's one of the efi changes, but I'm bisecting now to say exactly where it happens. It will get reverted.
I've Cc:-ed Matt.
My guess would be one of these two EFI commits:
* Fix early boot regression affecting x86 EFI boot stub when loading initrds above 4GB - Yinghai Lu
47226ad4f4cfx86/efi: Only load initrd above 4g on second try* Relocate GOT entries in the x86 EFI boot stub now that we have symbols with global visibility - Matt Fleming
9cb0e394234dx86/efi: Fixup GOT in all boot code pathsIf it's
9cb0e394234d- then it's perhaps a build quirk, or a bug in the assembly code. If so then we'd have to revert this, and reintroduce another regression, caused by EFI commitf23cf8bd5c1f49in this merge window. The most recent commit is easy to revert, the older one not.
Quoted 8 lines
Quoted 6 lines
If it's
47226ad4f4cfthen we'd reintroduce the regression caused by4bf7111f501in the previous merge window. They both revert cleanly after each other - but it might be safer to just revert the most recent one.My guess is that your regression is caused by
47226ad4f4cf.Wrong sha1: my guess is on
9cb0e394234d, the GOT fixup.
So if it's the GOT fixup then I feel the safest option is to revert 9cb0e394234d straight away, and then to do a functional revert of f23cf8bd5c1f49 as a separate step, perhaps via something really crude like:
#include "../..../drivers/firmware/efi/libstub/efi-stub-helper.c"
or so. (Maybe someone else can think of something cleaner/simpler, because this method is really ugly, as we'd have to #include the whole libstub library into eboot.c AFAICS...)
Thanks,
Ingo
Quoted 11 lines · Ingo Molnar
So if it's the GOT fixup then I feel the safest option is to revert
9cb0e394234dstraight away, and then to do a functional revert off23cf8bd5c1f49as a separate step, perhaps via something really crude like:#include "../..../drivers/firmware/efi/libstub/efi-stub-helper.c"or so. (Maybe someone else can think of something cleaner/simpler, because this method is really ugly, as we'd have to #include the whole libstub library into
eboot.cAFAICS...)
Yeah, I think at this point in the release cycle it would be safest to revert back to the original scheme of #including the .c files. I'm not sure if we can do any better in a robust way, i.e. without introducing more regressions. Then take a look at doing the boot stub unification with fresh eyes (and improved testing) after v3.17.
What I want to avoid is reverting the arm64 side of things too, so I'm gonna take a stab at doing the necessary reverts/partial reverts/whatever to get x86 back to the pre-merge window boot stub duplicated code scheme.
Quoted 7 lines · Matt Fleming
Quoted 6 lines · Ingo Molnar
So if it's the GOT fixup then I feel the safest option is to revert
9cb0e394234dstraight away, and then to do a functional revert off23cf8bd5c1f49as a separate step, perhaps via something really crude like:
Quoted 8 lines
Quoted 5 lines
#include "../..../drivers/firmware/efi/libstub/efi-stub-helper.c"or so. (Maybe someone else can think of something cleaner/simpler, because this method is really ugly, as we'd have to #include the whole libstub library into
eboot.cAFAICS...)Yeah, I think at this point in the release cycle it would be safest to revert back to the original scheme of #including the .c files. I'm not
Agreed
Quoted 9 lines
sure if we can do any better in a robust way, i.e. without introducing more regressions. Then take a look at doing the boot stub unification with fresh eyes (and improved testing) after v3.17.
What I want to avoid is reverting the arm64 side of things too, so I'm gonna take a stab at doing the necessary reverts/partial reverts/whatever to get x86 back to the pre-merge window boot stub duplicated code scheme.
The stub unification was already working fine in 3.16, it is the libstub cleanup I did that is causing this, so we could revert just all of that if it makes it easier to get this fixed for the release.
Unless your last patch was incorrect (which I don't think it was), the only way to solve this conclusively is finding a way (i.e., through visibility=hidden attributes for efi_early etc) to share those symbols between .o files without introducing any new GOT entries. Anyone in team x86 that can shed some light on why hidden globals still generate GOT entries on 32 bit?
It will be difficult for me to keep up with this thread over the next days, so I have added Leif and Roy on cc. If you need to make any changes that affect arm64, they should be able to confirm whether it causes any problems or not.
Thanks,
Ard.
Quoted 5 lines · Ard Biesheuvel
It will be difficult for me to keep up with this thread over the next days, so I have added Leif and Roy on cc. If you need to make any changes that affect arm64, they should be able to confirm whether it causes any problems or not.
OK, below is what I've got on top of commit f3670394c29f in Linus' tree. Please don't anyone pick this up yet, I'm still testing it on my machines and it desperately needs some Tested-by tags.
Josh, your machines probably boot fine after the revert from Linus but it'd be good to verify that this patch doesn't make things any worse.
Maarten, please verify that your Macbook pro boots with this patch. I very much want to be able to add a Tested-by from you.
Ard, Leif, Roy, can you please validate this for arm64? The thing to look out for is whether the changes to drivers/firmware/efi/Makefile make sense, and in particular, whether it's ever possible to have CONFIG_EFI_STUB=y and CONFIG_EFI_ARM_STUB=n.
If the answer is yes, then this patch might break your build and we probably want to do something like unconditionally select CONFIG_EFI_ARM_STUB when CONFIG_EFI_STUB=y.
---
Quoted 1 line
From
8054c405f0acc8ecb74b7e29675a1e6894afedb0Mon Sep 17 00:00:00 2001
From: Matt Fleming <[email protected]>
Date: Tue, 23 Sep 2014 10:37:43 +0100
Subject: [PATCH] Revert "efi/x86: efistub: Move shared dependencies to
<asm/efi.h>"
This reverts commit f23cf8bd5c1f ("efi/x86: efistub: Move shared dependencies to <asm/efi.h>") as well as the x86 parts of commit f4f75ad5741f ("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 9cb0e394234d ("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 f3670394c29f.
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
--- arch/x86/boot/compressed/Makefile | 3 +-- arch/x86/boot/compressed/eboot.c | 7 ++++++- arch/x86/boot/compressed/eboot.h | 16 ++++++++++++++++ arch/x86/include/asm/efi.h | 24 ------------------------ drivers/firmware/efi/Makefile | 2 +- 5 files changed, 24 insertions(+), 28 deletions(-)
arch/x86/boot/compressed/Makefile +1 -2
@@ -33,8 +33,7 @@ VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \ $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone ifeq ($(CONFIG_EFI_STUB), y) - VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o \ - $(objtree)/drivers/firmware/efi/libstub/lib.a + VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o endif $(obj)/vmlinux: $(VMLINUX_OBJS) FORCE
arch/x86/boot/compressed/eboot.c +6 -1
@@ -19,7 +19,10 @@static efi_system_table_t *sys_table; -struct efi_config *efi_early; +static struct efi_config *efi_early; + +#define efi_call_early (f, ...) \ + efi_early->call(efi_early->f, __VA_ARGS__);#define BOOT_SERVICES (bits) \ 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) } } +#include "../../../../drivers/firmware/efi/libstub/efi-stub-helper.c" +static void find_bits (unsigned long mask,u8 *pos,u8 *size) {u8 first, len;
arch/x86/boot/compressed/eboot.h +16 -0
@@ -103,4 +103,20 @@ struct efi_uga_draw_protocol { void *blt; }; +struct efi_config { +u64 image_handle; +u64 table; +u64 allocate_pool; +u64 allocate_pages; +u64 get_memory_map; +u64 free_pool; +u64 free_pages; +u64 locate_handle; +u64 handle_protocol; +u64 exit_boot_services; +u64 text_output; +efi_status_t (*call)(unsigned long , ...); +bool is64; +} __packed; +#endif /* BOOT_COMPRESSED_EBOOT_H */
arch/x86/include/asm/efi.h +0 -24
@@ -159,30 +159,6 @@ static inline efi_status_t efi_thunk_set_virtual_address_map( }#endif /* CONFIG_EFI_MIXED */ - -/* arch specific definitions used by the stub code */ - -struct efi_config { -u64 image_handle; -u64 table; -u64 allocate_pool; -u64 allocate_pages; -u64 get_memory_map; -u64 free_pool; -u64 free_pages; -u64 locate_handle; -u64 handle_protocol; -u64 exit_boot_services; -u64 text_output; -efi_status_t (*call)(unsigned long , ...); -bool is64; -} __packed; - -extern struct efi_config *efi_early; - -#define efi_call_early (f, ...) \ - efi_early->call(efi_early->f, __VA_ARGS__); -extern bool efi_reboot_required (void );#else
drivers/firmware/efi/Makefile +1 -1
@@ -7,4 +7,4 @@ obj-$(CONFIG_EFI_VARS_PSTORE) += efi-pstore.o obj-$(CONFIG_UEFI_CPER) += cper.o obj-$(CONFIG_EFI_RUNTIME_MAP) += runtime-map.o obj-$(CONFIG_EFI_RUNTIME_WRAPPERS) += runtime-wrappers.o -obj-$(CONFIG_EFI_STUB) += libstub/ +obj-$(CONFIG_EFI_ARM_STUB) += libstub/
Signature · 4 lines
1.9.3 -- Matt Fleming, Intel Open Source Technology Center
Leif Lindholm
Tested-byQuoted 13 lines · Matt Fleming
Quoted 4 lines · Ard Biesheuvel
It will be difficult for me to keep up with this thread over the next days, so I have added Leif and Roy on cc. If you need to make any changes that affect arm64, they should be able to confirm whether it causes any problems or not.
OK, below is what I've got on top of commit
f3670394c29fin Linus' tree. Please don't anyone pick this up yet, I'm still testing it on my machines and it desperately needs some Tested-by tags.Josh, your machines probably boot fine after the revert from Linus but it'd be good to verify that this patch doesn't make things any worse.
Quoted 7 lines
Maarten, please verify that your Macbook pro boots with this patch. I very much want to be able to add a Tested-by from you.
Ard, Leif, Roy, can you please validate this for arm64? The thing to look out for is whether the changes to
drivers/firmware/efi/Makefilemake sense, and in particular, whether it's ever possible to haveCONFIG_EFI_STUB=yandCONFIG_EFI_ARM_STUB=n.
Currently, these are both selected automatically by CONFIG_EFI, and are not selectable through the user interface. There is no relevant case for them being individually selectable, so perhaps _EFI_ARM_STUB should simply be set to the value of _EFI_STUB.
Quoted 3 lines
If the answer is yes, then this patch might break your build and we probably want to do something like unconditionally select
CONFIG_EFI_ARM_STUBwhenCONFIG_EFI_STUB=y.
For arm64:
Quoted 169 lines
---
From
8054c405f0acc8ecb74b7e29675a1e6894afedb0Mon Sep 17 00:00:00 2001
From: Matt Fleming <[email protected]>
Date: Tue, 23 Sep 2014 10:37:43 +0100
Subject: [PATCH] Revert "efi/x86: efistub: Move shared dependencies to
<asm/efi.h>"This reverts commit
f23cf8bd5c1f("efi/x86: efistub: Move shared dependencies to <asm/efi.h>") as well as the x86 parts of commitf4f75ad5741f("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
9cb0e394234d("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 commitf3670394c29f.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.cinstead 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.hCc H. Peter Anvin <[email protected]>Cc Ard Biesheuvel <[email protected]>,Cc Josh Boyer <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Ingo Molnar <[email protected]>Cc Linus Torvalds <[email protected]>Signed-off-by Matt Fleming <[email protected]>--- arch/x86/boot/compressed/Makefile | 3 +-- arch/x86/boot/compressed/eboot.c | 7 ++++++- arch/x86/boot/compressed/eboot.h | 16 ++++++++++++++++ arch/x86/include/asm/efi.h | 24 ------------------------ drivers/firmware/efi/Makefile | 2 +- 5 files changed, 24 insertions(+), 28 deletions(-)arch/x86/boot/compressed/Makefile +1
-2@@ -33,8 +33,7 @@ VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \ $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone ifeq ($(CONFIG_EFI_STUB), y) - VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o \ - $(objtree)/drivers/firmware/efi/libstub/lib.a + VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o endif $(obj)/vmlinux: $(VMLINUX_OBJS) FORCEarch/x86/boot/compressed/eboot.c +6
-1@@ -19,7 +19,10 @@static efi_system_table_t *sys_table; -struct efi_config *efi_early; +static struct efi_config *efi_early; + +#define efi_call_early (f, ...) \ + efi_early->call(efi_early->f, __VA_ARGS__);#define BOOT_SERVICES (bits) \ 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) } } +#include "../../../../drivers/firmware/efi/libstub/efi-stub-helper.c" +static void find_bits (unsigned long mask,u8 *pos,u8 *size) {u8 first, len;arch/x86/boot/compressed/eboot.h +16
-0@@ -103,4 +103,20 @@ struct efi_uga_draw_protocol { void *blt; }; +struct efi_config { +u64 image_handle; +u64 table; +u64 allocate_pool; +u64 allocate_pages; +u64 get_memory_map; +u64 free_pool; +u64 free_pages; +u64 locate_handle; +u64 handle_protocol; +u64 exit_boot_services; +u64 text_output; +efi_status_t (*call)(unsigned long , ...); +bool is64; +} __packed; +#endif /* BOOT_COMPRESSED_EBOOT_H */ arch/x86/include/asm/efi.h +0
-24@@ -159,30 +159,6 @@ static inline efi_status_t efi_thunk_set_virtual_address_map( }#endif /* CONFIG_EFI_MIXED */ - -/* arch specific definitions used by the stub code */ - -struct efi_config { -u64 image_handle; -u64 table; -u64 allocate_pool; -u64 allocate_pages; -u64 get_memory_map; -u64 free_pool; -u64 free_pages; -u64 locate_handle; -u64 handle_protocol; -u64 exit_boot_services; -u64 text_output; -efi_status_t (*call)(unsigned long , ...); -bool is64; -} __packed; - -extern struct efi_config *efi_early; - -#define efi_call_early (f, ...) \ - efi_early->call(efi_early->f, __VA_ARGS__); -extern bool efi_reboot_required (void );#else drivers/firmware/efi/Makefile +1
-1@@ -7,4 +7,4 @@ obj-$(CONFIG_EFI_VARS_PSTORE) += efi-pstore.o obj-$(CONFIG_UEFI_CPER) += cper.o obj-$(CONFIG_EFI_RUNTIME_MAP) += runtime-map.o obj-$(CONFIG_EFI_RUNTIME_WRAPPERS) += runtime-wrappers.o -obj-$(CONFIG_EFI_STUB) += libstub/ +obj-$(CONFIG_EFI_ARM_STUB) += libstub/Signature · 4 lines
1.9.3 -- Matt Fleming, Intel Open Source Technology Center
Hey,
Op 23-09-14 om 15:18 schreef Matt Fleming:
Quoted 15 lines · Ard Biesheuvel
Quoted 4 lines
It will be difficult for me to keep up with this thread over the next days, so I have added Leif and Roy on cc. If you need to make any changes that affect arm64, they should be able to confirm whether it causes any problems or not.
OK, below is what I've got on top of commit
f3670394c29fin Linus' tree. Please don't anyone pick this up yet, I'm still testing it on my machines and it desperately needs some Tested-by tags.Josh, your machines probably boot fine after the revert from Linus but it'd be good to verify that this patch doesn't make things any worse.
Maarten, please verify that your Macbook pro boots with this patch. I very much want to be able to add a Tested-by from you.
Quoted 9 lines
Ard, Leif, Roy, can you please validate this for arm64? The thing to look out for is whether the changes to
drivers/firmware/efi/Makefilemake sense, and in particular, whether it's ever possible to haveCONFIG_EFI_STUB=yandCONFIG_EFI_ARM_STUB=n.If the answer is yes, then this patch might break your build and we probably want to do something like unconditionally select
CONFIG_EFI_ARM_STUBwhenCONFIG_EFI_STUB=y.
It seems to boot for me with direct efi netboot. But when I'm doing a local boot through refind instead I also hit that setup_efi_pci() failed bug, it doesn't look like it's fixed by reverting all the efi stub patches though. This might need more bisecting first...
~Maarten
Quoted 4 lines · Maarten Lankhorst
It seems to boot for me with direct efi netboot. But when I'm doing a local boot through refind instead I also hit that
setup_efi_pci()failed bug, it doesn't look like it's fixed by reverting all the efi stub patches though. This might need more bisecting first...
Thanks for testing!
The "setup_efi_pci() failed!" message doesn't indicate a bug, it's superfluous and I've queued up the below patch for v3.18.
But maybe we should merge it sooner since people are likely to interpret it as indicating there's some boot bug (there isn't).
I know Josh was in favour of getting this message dropped and treating this as a regression fix, but I was erring on the side of caution because it's not critical.
tip folks, if I sent this patch to you in a pull request, would you merge it?
---
Quoted 1 line
From
c988616127c10d8c68dd1b9b946cddf51e4ca718Mon Sep 17 00:00:00 2001
From: Matt Fleming <[email protected]>
Date: Thu, 11 Sep 2014 09:04:25 +0100
Subject: [PATCH] x86/efi: Delete misleading efi_printk() error message
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
A number of people are reporting seeing the "setup_efi_pci() failed!" error message in what used to be a quiet boot,
https://bugzilla.kernel.org/show_bug.cgi?id=81891
The message isn't all that helpful because setup_efi_pci() can return a non-success error code for a variety of reasons, not all of them fatal.
Drop the efi_printk() now that we have more fine-grained, and more specific, error messages throughout the *setup_efi_pci*() code paths.
--- arch/x86/boot/compressed/eboot.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/x86/boot/compressed/eboot.c +1 -4
@@ -1394,10 +1394,7 @@ struct boot_params *efi_main(struct efi_config *c,setup_graphics (boot_params); - status =setup_efi_pci (boot_params); -if (status !=EFI_SUCCESS ) { -efi_printk (sys_table,"setup_efi_pci() failed!\n" ); - } +setup_efi_pci (boot_params); status =efi_call_early (allocate_pool,EFI_LOADER_DATA ,sizeof (*gdt), (void **)&gdt);
Signature · 4 lines
1.9.3 -- Matt Fleming, Intel Open Source Technology Center
Quoted 4 lines · Matt Fleming
I know Josh was in favour of getting this message dropped and treating this as a regression fix, but I was erring on the side of caution because it's not critical.
I'd certainly prefer this too, because UI also see the annoying "setup_efi_pci() failed!" at bootup. I've ignored it, but I would certainly not mind having it gone either. It seems to result in no actual value.
Linus
arch/x86/boot/compressed/eboot.c struct boot_params *efi_main(struct efi_config *c, · line 1400
Quoted 12 lines · Matt Fleming
arch/x86/boot/compressed/eboot.c +1
-4@@ -1394,10 +1394,7 @@ struct boot_params *efi_main(struct efi_config *c,setup_graphics (boot_params); - status =setup_efi_pci (boot_params); -if (status !=EFI_SUCCESS ) { -efi_printk (sys_table,"setup_efi_pci() failed!\n" ); - } +setup_efi_pci (boot_params); status =efi_call_early (allocate_pool,EFI_LOADER_DATA ,sizeof (*gdt), (void **)&gdt);
So 'status' is unused - either use it for a less threatening message, or remove the return code from the function and document that failure is an option?
Thanks,
Ingo
Quoted 4 lines · Ingo Molnar
So 'status' is unused - either use it for a less threatening message, or remove the return code from the function and document that failure is an option?
I think removing the return code is the way to go (I have a patch queued for v3.18 that adds call-site error messages).
Something like this?
---
Quoted 1 line
From
737ed0ea66f79fe1e5343f9f4cbdf7c0f57e1a0fMon Sep 17 00:00:00 2001
From: Matt Fleming <[email protected]>
Date: Thu, 11 Sep 2014 09:04:25 +0100
Subject: [PATCH] x86/efi: Delete misleading efi_printk() error message
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
A number of people are reporting seeing the "setup_efi_pci() failed!" error message in what used to be a quiet boot,
https://bugzilla.kernel.org/show_bug.cgi?id=81891
The message isn't all that helpful because setup_efi_pci() can return a non-success error code for a variety of reasons, not all of them fatal.
Let's drop the return code from setup_efi_pci*() altogether, since there's no way to process it in any meaningful way outside of the inner __setup_efi_pci*() functions.
--- arch/x86/boot/compressed/eboot.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)
arch/x86/boot/compressed/eboot.c +16 -15
@@ -365,7 +365,7 @@ free_struct:return status; } -static efi_status_t +static void setup_efi_pci32 (struct boot_params *params,void **pci_handle,unsigned long size) {
@@ -408,8 +408,6 @@ setup_efi_pci32(struct boot_params *params, void **pci_handle, data = (struct setup_data *)rom; } - -return status; } static efi_status_t
@@ -468,7 +466,7 @@ free_struct: } -static efi_status_t +static void setup_efi_pci64 (struct boot_params *params,void **pci_handle,unsigned long size) {
@@ -511,11 +509,18 @@ setup_efi_pci64(struct boot_params *params, void **pci_handle, data = (struct setup_data *)rom; } - -return status; } -static efi_status_t setup_efi_pci (struct boot_params *params) +/* +* There's no way to return an informative status from this function, +* because any analysis (and printing of error messages) needs to be +* done directly at the EFI function call-site. +* +* For example, EFI_INVALID_PARAMETER could indicate a bug or maybe we +* just didn't find any PCI devices, but there's no way to tell outside +* the context of the call. +*/ +static void setup_efi_pci (struct boot_params *params) {efi_status_t status;void **pci_handle =NULL ;
@@ -532,7 +537,7 @@ static efi_status_t setup_efi_pci(struct boot_params *params) size, (void **)&pci_handle);if (status !=EFI_SUCCESS ) -return status; +return ; status = efi_call_early(locate_handle, EFI_LOCATE_BY_PROTOCOL, &pci_proto,
@@ -543,13 +548,12 @@ static efi_status_t setup_efi_pci(struct boot_params *params) goto free_handle;if (efi_early->is64) - status =setup_efi_pci64 (params, pci_handle, size); +setup_efi_pci64 (params, pci_handle, size);else - status =setup_efi_pci32 (params, pci_handle, size); +setup_efi_pci32 (params, pci_handle, size); free_handle:efi_call_early (free_pool, pci_handle); -return status; } static void
@@ -1385,10 +1389,7 @@ struct boot_params *efi_main(struct efi_config *c,setup_graphics (boot_params); - status =setup_efi_pci (boot_params); -if (status !=EFI_SUCCESS ) { -efi_printk (sys_table,"setup_efi_pci() failed!\n" ); - } +setup_efi_pci (boot_params); status =efi_call_early (allocate_pool,EFI_LOADER_DATA ,sizeof (*gdt), (void **)&gdt);
Signature · 4 lines
1.9.3 -- Matt Fleming, Intel Open Source Technology Center
arch/x86/boot/compressed/eboot.c setup_efi_pci64(struct boot_params *params, void **pci_handle, · line 523
Quoted 10 lines · Matt Fleming
arch/x86/boot/compressed/eboot.c +10
-0+/* +* There's no way to return an informative status from this function, +* because any analysis (and printing of error messages) needs to be +* done directly at the EFI function call-site. +* +* For example, EFI_INVALID_PARAMETER could indicate a bug or maybe we +* just didn't find any PCI devices, but there's no way to tell outside +* the context of the call. +*/ +static void setup_efi_pci (struct boot_params *params)
Btw., do we print proper complaints at the EFI call sites if such failures do happen (and if that failure is unexpected/bad)?
If that's a given then your patch looks good to me.
Thanks,
Ingo
Quoted 16 lines · Ingo Molnar
arch/x86/boot/compressed/eboot.c setup_efi_pci64(struct boot_params *params, void **pci_handle, · line 523
Quoted 10 lines · Matt Fleming
arch/x86/boot/compressed/eboot.c +10
-0+/* +* There's no way to return an informative status from this function, +* because any analysis (and printing of error messages) needs to be +* done directly at the EFI function call-site. +* +* For example, EFI_INVALID_PARAMETER could indicate a bug or maybe we +* just didn't find any PCI devices, but there's no way to tell outside +* the context of the call. +*/ +static void setup_efi_pci (struct boot_params *params)Btw., do we print proper complaints at the EFI call sites if such failures do happen (and if that failure is unexpected/bad)?
Not yet, but I've got a patch queued up for v3.18 that does this.
Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
Quoted 18 lines · Matt Fleming
Quoted 16 lines · Ingo Molnar
arch/x86/boot/compressed/eboot.c setup_efi_pci64(struct boot_params *params, void **pci_handle, · line 523
Quoted 10 lines · Matt Fleming
arch/x86/boot/compressed/eboot.c +10
-0+/* +* There's no way to return an informative status from this function, +* because any analysis (and printing of error messages) needs to be +* done directly at the EFI function call-site. +* +* For example, EFI_INVALID_PARAMETER could indicate a bug or maybe we +* just didn't find any PCI devices, but there's no way to tell outside +* the context of the call. +*/ +static void setup_efi_pci (struct boot_params *params)Btw., do we print proper complaints at the EFI call sites if such failures do happen (and if that failure is unexpected/bad)?
Quoted 1 line
Not yet, but I've got a patch queued up for v3.18 that does this.
Great, thanks!
Ingo
Quoted 4 lines · Matt Fleming
OK, below is what I've got on top of commit
f3670394c29fin Linus' tree. Please don't anyone pick this up yet, I'm still testing it on my machines and it desperately needs some Tested-by tags.
Well, it boots on my Vaio, fwiw. I'm assume that isn't all that interesting, since presumably it's the macbooks that you expected to still have problems.
Linus
Quoted 4 lines · Linus Torvalds
Well, it boots on my Vaio, fwiw. I'm assume that isn't all that interesting, since presumably it's the macbooks that you expected to still have problems.
Yeah, though I'm still interested in hearing success stories since it indicates I didn't screw anything else up while doing the revert.
So, thanks for testing - I feel a bit better about the patch now.
Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
Quoted 8 lines · Matt Fleming
Quoted 4 lines · Linus Torvalds
Well, it boots on my Vaio, fwiw. I'm assume that isn't all that interesting, since presumably it's the macbooks that you expected to still have problems.
Yeah, though I'm still interested in hearing success stories since it indicates I didn't screw anything else up while doing the revert.
I have it building right now. I'll test it on both my SB machine, and my macbook using shim/grub2.
josh
Quoted 7 lines · Josh Boyer
Quoted 6 lines · Matt Fleming
Quoted 4 lines · Linus Torvalds
Well, it boots on my Vaio, fwiw. I'm assume that isn't all that interesting, since presumably it's the macbooks that you expected to still have problems.
Quoted 5 lines
Quoted 2 lines
Yeah, though I'm still interested in hearing success stories since it indicates I didn't screw anything else up while doing the revert.
I have it building right now. I'll test it on both my SB machine, and my macbook using shim/grub2.
All of the machines that were broken and subsequently fixed by reverting the EFI GOT change still boot fine with this patch. That includes the macbook and SB enabled machines.
So results as expected. Thanks.
josh
Quoted 6 lines · Josh Boyer
All of the machines that were broken and subsequently fixed by reverting the EFI GOT change still boot fine with this patch. That includes the macbook and SB enabled machines.
So results as expected. Thanks.
Great, thanks Josh.
I'm gonna queue up this revert to fix Maarten's boot issue, along with the patch to drop the "setup_efi_pci() failed!" message, and send a pull request to the tip folks.
Meanwhile, I've upgraded one of my test machines to Fedora 20 with grub2 and can reproduce the issue that you and Linus were hitting before the GOT patch revert. I'll take a look at figuring out what on earth is going on there.
Signature · 1 line
Matt Fleming, Intel Open Source Technology Center