public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
* [RFT PATCH] efi/x86: move x86 back to libstub
@ 2014-10-06 11:06 Ard Biesheuvel
       [not found] ` <1412593603-6945-1-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Ard Biesheuvel @ 2014-10-06 11:06 UTC (permalink / raw)
  To: matt.fleming-ral2JQCrhuEAvxtiuMwx3w
  Cc: leif.lindholm-QSEj5FYQhm4dnm+yROfE0A,
	roy.franz-QSEj5FYQhm4dnm+yROfE0A, mingo-DgEjT+Ai2ygdnm+yROfE0A,
	x86-DgEjT+Ai2ygdnm+yROfE0A, hpa-YMNOUZJC4hwAvxtiuMwx3w,
	linux-efi-u79uwXL29TY76Z2rM5mHXA, Ard Biesheuvel,
	Maarten Lankhorst, Josh Boyer, Linus Torvalds

This reverts commit 84be880560fb, which itself reverted my original
attempt to move x86 from #include'ing .c files from across the tree
to using the EFI stub built as a static library.

The issue that affected the original approach was that splitting
the implementation into several .o files resulted in the variable
'efi_early' becoming a global with external linkage, which under
-fPIC implies that references to it must go through the GOT. However,
dealing with this additional GOT entry turned out to be troublesome
on some EFI implementations. (GCC's visibility=hidden attribute is
supposed to lift this requirement, but it turned out not to work on
the 32-bit build.)

Instead, use a pure getter function to get a reference to efi_early.
This approach results in no additional GOT entries being generated,
so there is no need for any changes in the early GOT handling.

Cc: Maarten Lankhorst <maarten.lankhorst-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
Cc: Josh Boyer <jwboyer-rxtnV0ftBwyoClj4AeEUq9i2O/JbrIOy@public.gmane.org>
Cc: Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---

Gents,

This is a request for testing: I would like to find out if this patch
fixes Maarten's issue without breaking anything like it did for Josh
and Linus the first time around.


 arch/x86/boot/compressed/Makefile |  3 ++-
 arch/x86/boot/compressed/eboot.c  |  8 ++++----
 arch/x86/boot/compressed/eboot.h  | 16 ----------------
 arch/x86/include/asm/efi.h        | 24 ++++++++++++++++++++++++
 drivers/firmware/efi/Makefile     |  2 +-
 5 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 0fcd9133790c..7a801a310e37 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -33,7 +33,8 @@ 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
+	VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o \
+				$(objtree)/drivers/firmware/efi/libstub/lib.a
 endif
 
 $(obj)/vmlinux: $(VMLINUX_OBJS) FORCE
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index de8eebd6f67c..58ea406f5d60 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -21,8 +21,10 @@ static efi_system_table_t *sys_table;
 
 static struct efi_config *efi_early;
 
-#define efi_call_early(f, ...)						\
-	efi_early->call(efi_early->f, __VA_ARGS__);
+__pure const struct efi_config *__efi_early(void)
+{
+	return efi_early;
+}
 
 #define BOOT_SERVICES(bits)						\
 static void setup_boot_services##bits(struct efi_config *c)		\
@@ -285,8 +287,6 @@ 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;
diff --git a/arch/x86/boot/compressed/eboot.h b/arch/x86/boot/compressed/eboot.h
index c88c31ecad12..d487e727f1ec 100644
--- a/arch/x86/boot/compressed/eboot.h
+++ b/arch/x86/boot/compressed/eboot.h
@@ -103,20 +103,4 @@ 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 */
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 0ec241ede5a2..b2c854a0f5ca 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -159,6 +159,30 @@ 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;
+
+__pure const struct efi_config *__efi_early(void);
+
+#define efi_call_early(f, ...)						\
+	__efi_early()->call(__efi_early()->f, __VA_ARGS__);
+
 extern bool efi_reboot_required(void);
 
 #else
diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
index aef6a95adef5..d8be608a9f3b 100644
--- a/drivers/firmware/efi/Makefile
+++ b/drivers/firmware/efi/Makefile
@@ -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_ARM_STUB)		+= libstub/
+obj-$(CONFIG_EFI_STUB)			+= libstub/
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [RFT PATCH] efi/x86: move x86 back to libstub
       [not found] ` <1412593603-6945-1-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2014-10-06 12:00   ` Josh Boyer
  2014-10-10  6:35   ` Ard Biesheuvel
  2014-10-16 14:42   ` Matt Fleming
  2 siblings, 0 replies; 10+ messages in thread
From: Josh Boyer @ 2014-10-06 12:00 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Matt Fleming, leif.lindholm-QSEj5FYQhm4dnm+yROfE0A,
	roy.franz-QSEj5FYQhm4dnm+yROfE0A, Ingo Molnar, x86,
	H. Peter Anvin, linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Maarten Lankhorst, Linus Torvalds

On Mon, Oct 6, 2014 at 7:06 AM, Ard Biesheuvel
<ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> This reverts commit 84be880560fb, which itself reverted my original
> attempt to move x86 from #include'ing .c files from across the tree
> to using the EFI stub built as a static library.
>
> The issue that affected the original approach was that splitting
> the implementation into several .o files resulted in the variable
> 'efi_early' becoming a global with external linkage, which under
> -fPIC implies that references to it must go through the GOT. However,
> dealing with this additional GOT entry turned out to be troublesome
> on some EFI implementations. (GCC's visibility=hidden attribute is
> supposed to lift this requirement, but it turned out not to work on
> the 32-bit build.)
>
> Instead, use a pure getter function to get a reference to efi_early.
> This approach results in no additional GOT entries being generated,
> so there is no need for any changes in the early GOT handling.
>
> Cc: Maarten Lankhorst <maarten.lankhorst-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
> Cc: Josh Boyer <jwboyer-rxtnV0ftBwyoClj4AeEUq9i2O/JbrIOy@public.gmane.org>
> Cc: Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
>
> Gents,
>
> This is a request for testing: I would like to find out if this patch
> fixes Maarten's issue without breaking anything like it did for Josh
> and Linus the first time around.

I probably won't get to testing this today, but I will try tomorrow.

josh

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFT PATCH] efi/x86: move x86 back to libstub
       [not found] ` <1412593603-6945-1-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  2014-10-06 12:00   ` Josh Boyer
@ 2014-10-10  6:35   ` Ard Biesheuvel
       [not found]     ` <CAKv+Gu9rdPujXqfWhJt=76V8Lemf2FuVoa75KH-TWh+2_a=Ghg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2014-10-16 14:42   ` Matt Fleming
  2 siblings, 1 reply; 10+ messages in thread
From: Ard Biesheuvel @ 2014-10-10  6:35 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Leif Lindholm, Roy Franz, Ingo Molnar,
	x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org,
	linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Ard Biesheuvel,
	Maarten Lankhorst, Josh Boyer, Linus Torvalds

On 6 October 2014 13:06, Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> This reverts commit 84be880560fb, which itself reverted my original
> attempt to move x86 from #include'ing .c files from across the tree
> to using the EFI stub built as a static library.
>
> The issue that affected the original approach was that splitting
> the implementation into several .o files resulted in the variable
> 'efi_early' becoming a global with external linkage, which under
> -fPIC implies that references to it must go through the GOT. However,
> dealing with this additional GOT entry turned out to be troublesome
> on some EFI implementations. (GCC's visibility=hidden attribute is
> supposed to lift this requirement, but it turned out not to work on
> the 32-bit build.)
>
> Instead, use a pure getter function to get a reference to efi_early.
> This approach results in no additional GOT entries being generated,
> so there is no need for any changes in the early GOT handling.
>
> Cc: Maarten Lankhorst <maarten.lankhorst-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
> Cc: Josh Boyer <jwboyer-rxtnV0ftBwyoClj4AeEUq9i2O/JbrIOy@public.gmane.org>
> Cc: Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
>
> Gents,
>
> This is a request for testing: I would like to find out if this patch
> fixes Maarten's issue without breaking anything like it did for Josh
> and Linus the first time around.
>

Any takers?


>
>  arch/x86/boot/compressed/Makefile |  3 ++-
>  arch/x86/boot/compressed/eboot.c  |  8 ++++----
>  arch/x86/boot/compressed/eboot.h  | 16 ----------------
>  arch/x86/include/asm/efi.h        | 24 ++++++++++++++++++++++++
>  drivers/firmware/efi/Makefile     |  2 +-
>  5 files changed, 31 insertions(+), 22 deletions(-)
>
> diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
> index 0fcd9133790c..7a801a310e37 100644
> --- a/arch/x86/boot/compressed/Makefile
> +++ b/arch/x86/boot/compressed/Makefile
> @@ -33,7 +33,8 @@ 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
> +       VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o \
> +                               $(objtree)/drivers/firmware/efi/libstub/lib.a
>  endif
>
>  $(obj)/vmlinux: $(VMLINUX_OBJS) FORCE
> diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
> index de8eebd6f67c..58ea406f5d60 100644
> --- a/arch/x86/boot/compressed/eboot.c
> +++ b/arch/x86/boot/compressed/eboot.c
> @@ -21,8 +21,10 @@ static efi_system_table_t *sys_table;
>
>  static struct efi_config *efi_early;
>
> -#define efi_call_early(f, ...)                                         \
> -       efi_early->call(efi_early->f, __VA_ARGS__);
> +__pure const struct efi_config *__efi_early(void)
> +{
> +       return efi_early;
> +}
>
>  #define BOOT_SERVICES(bits)                                            \
>  static void setup_boot_services##bits(struct efi_config *c)            \
> @@ -285,8 +287,6 @@ 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;
> diff --git a/arch/x86/boot/compressed/eboot.h b/arch/x86/boot/compressed/eboot.h
> index c88c31ecad12..d487e727f1ec 100644
> --- a/arch/x86/boot/compressed/eboot.h
> +++ b/arch/x86/boot/compressed/eboot.h
> @@ -103,20 +103,4 @@ 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 */
> diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
> index 0ec241ede5a2..b2c854a0f5ca 100644
> --- a/arch/x86/include/asm/efi.h
> +++ b/arch/x86/include/asm/efi.h
> @@ -159,6 +159,30 @@ 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;
> +
> +__pure const struct efi_config *__efi_early(void);
> +
> +#define efi_call_early(f, ...)                                         \
> +       __efi_early()->call(__efi_early()->f, __VA_ARGS__);
> +
>  extern bool efi_reboot_required(void);
>
>  #else
> diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
> index aef6a95adef5..d8be608a9f3b 100644
> --- a/drivers/firmware/efi/Makefile
> +++ b/drivers/firmware/efi/Makefile
> @@ -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_ARM_STUB)             += libstub/
> +obj-$(CONFIG_EFI_STUB)                 += libstub/
> --
> 1.9.1
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFT PATCH] efi/x86: move x86 back to libstub
       [not found]     ` <CAKv+Gu9rdPujXqfWhJt=76V8Lemf2FuVoa75KH-TWh+2_a=Ghg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-10-10  8:30       ` Maarten Lankhorst
       [not found]         ` <5437990C.7050402-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Maarten Lankhorst @ 2014-10-10  8:30 UTC (permalink / raw)
  To: Ard Biesheuvel, Matt Fleming
  Cc: Leif Lindholm, Roy Franz, Ingo Molnar,
	x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org,
	linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Josh Boyer,
	Linus Torvalds

Hey,

On 10-10-14 08:35, Ard Biesheuvel wrote:
> On 6 October 2014 13:06, Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
>> This reverts commit 84be880560fb, which itself reverted my original
>> attempt to move x86 from #include'ing .c files from across the tree
>> to using the EFI stub built as a static library.
>>
>> The issue that affected the original approach was that splitting
>> the implementation into several .o files resulted in the variable
>> 'efi_early' becoming a global with external linkage, which under
>> -fPIC implies that references to it must go through the GOT. However,
>> dealing with this additional GOT entry turned out to be troublesome
>> on some EFI implementations. (GCC's visibility=hidden attribute is
>> supposed to lift this requirement, but it turned out not to work on
>> the 32-bit build.)
>>
>> Instead, use a pure getter function to get a reference to efi_early.
>> This approach results in no additional GOT entries being generated,
>> so there is no need for any changes in the early GOT handling.
>>
>> Cc: Maarten Lankhorst <maarten.lankhorst-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
>> Cc: Josh Boyer <jwboyer-rxtnV0ftBwyoClj4AeEUq9i2O/JbrIOy@public.gmane.org>
>> Cc: Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>> ---
>>
>> Gents,
>>
>> This is a request for testing: I would like to find out if this patch
>> fixes Maarten's issue without breaking anything like it did for Josh
>> and Linus the first time around.
>>
> 
> Any takers?
Sorry it was on my todo list but I lost access to my laptop for a while.
Normal EFI boot through refind works at least, but I think netboot may use a slightly
different codepath which I can't test right now.

Tested-By: Maarten Lankhorst <maarten.lankhorst-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFT PATCH] efi/x86: move x86 back to libstub
       [not found]         ` <5437990C.7050402-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
@ 2014-10-10  8:37           ` Ard Biesheuvel
       [not found]             ` <CAKv+Gu_5tHNB=YOS0Kz2i2ap2n8PvzmvGD6-J7MzxptoG_zHQw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Ard Biesheuvel @ 2014-10-10  8:37 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: Matt Fleming, Leif Lindholm, Roy Franz, Ingo Molnar,
	x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org,
	linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Josh Boyer,
	Linus Torvalds

On 10 October 2014 10:30, Maarten Lankhorst
<maarten.lankhorst-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org> wrote:
> Hey,
>
> On 10-10-14 08:35, Ard Biesheuvel wrote:
>> On 6 October 2014 13:06, Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
>>> This reverts commit 84be880560fb, which itself reverted my original
>>> attempt to move x86 from #include'ing .c files from across the tree
>>> to using the EFI stub built as a static library.
>>>
>>> The issue that affected the original approach was that splitting
>>> the implementation into several .o files resulted in the variable
>>> 'efi_early' becoming a global with external linkage, which under
>>> -fPIC implies that references to it must go through the GOT. However,
>>> dealing with this additional GOT entry turned out to be troublesome
>>> on some EFI implementations. (GCC's visibility=hidden attribute is
>>> supposed to lift this requirement, but it turned out not to work on
>>> the 32-bit build.)
>>>
>>> Instead, use a pure getter function to get a reference to efi_early.
>>> This approach results in no additional GOT entries being generated,
>>> so there is no need for any changes in the early GOT handling.
>>>
>>> Cc: Maarten Lankhorst <maarten.lankhorst-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
>>> Cc: Josh Boyer <jwboyer-rxtnV0ftBwyoClj4AeEUq9i2O/JbrIOy@public.gmane.org>
>>> Cc: Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
>>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>>> ---
>>>
>>> Gents,
>>>
>>> This is a request for testing: I would like to find out if this patch
>>> fixes Maarten's issue without breaking anything like it did for Josh
>>> and Linus the first time around.
>>>
>>
>> Any takers?
> Sorry it was on my todo list but I lost access to my laptop for a while.
> Normal EFI boot through refind works at least, but I think netboot may use a slightly
> different codepath which I can't test right now.
>
> Tested-By: Maarten Lankhorst <maarten.lankhorst-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>

Thanks! So I suppose the code path you did test is the code path that
produced the failure last time?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFT PATCH] efi/x86: move x86 back to libstub
       [not found]             ` <CAKv+Gu_5tHNB=YOS0Kz2i2ap2n8PvzmvGD6-J7MzxptoG_zHQw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-10-13 13:37               ` Maarten Lankhorst
       [not found]                 ` <543BD583.3050303-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Maarten Lankhorst @ 2014-10-13 13:37 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Matt Fleming, Leif Lindholm, Roy Franz, Ingo Molnar,
	x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org,
	linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Josh Boyer,
	Linus Torvalds

Op 10-10-14 om 10:37 schreef Ard Biesheuvel:
> On 10 October 2014 10:30, Maarten Lankhorst
> <maarten.lankhorst-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org> wrote:
>> Hey,
>>
>> On 10-10-14 08:35, Ard Biesheuvel wrote:
>>> On 6 October 2014 13:06, Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
>>>> This reverts commit 84be880560fb, which itself reverted my original
>>>> attempt to move x86 from #include'ing .c files from across the tree
>>>> to using the EFI stub built as a static library.
>>>>
>>>> The issue that affected the original approach was that splitting
>>>> the implementation into several .o files resulted in the variable
>>>> 'efi_early' becoming a global with external linkage, which under
>>>> -fPIC implies that references to it must go through the GOT. However,
>>>> dealing with this additional GOT entry turned out to be troublesome
>>>> on some EFI implementations. (GCC's visibility=hidden attribute is
>>>> supposed to lift this requirement, but it turned out not to work on
>>>> the 32-bit build.)
>>>>
>>>> Instead, use a pure getter function to get a reference to efi_early.
>>>> This approach results in no additional GOT entries being generated,
>>>> so there is no need for any changes in the early GOT handling.
>>>>
>>>> Cc: Maarten Lankhorst <maarten.lankhorst-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
>>>> Cc: Josh Boyer <jwboyer-rxtnV0ftBwyoClj4AeEUq9i2O/JbrIOy@public.gmane.org>
>>>> Cc: Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
>>>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>>>> ---
>>>>
>>>> Gents,
>>>>
>>>> This is a request for testing: I would like to find out if this patch
>>>> fixes Maarten's issue without breaking anything like it did for Josh
>>>> and Linus the first time around.
>>>>
>>> Any takers?
>> Sorry it was on my todo list but I lost access to my laptop for a while.
>> Normal EFI boot through refind works at least, but I think netboot may use a slightly
>> different codepath which I can't test right now.
>>
>> Tested-By: Maarten Lankhorst <maarten.lankhorst-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
> Thanks! So I suppose the code path you did test is the code path that
> produced the failure last time?
>
I tested netboot now to be sure, seems to be working ok.

~Maarten

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFT PATCH] efi/x86: move x86 back to libstub
       [not found]                 ` <543BD583.3050303-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
@ 2014-10-13 13:54                   ` Ard Biesheuvel
  2014-10-14 21:42                   ` Matt Fleming
  1 sibling, 0 replies; 10+ messages in thread
From: Ard Biesheuvel @ 2014-10-13 13:54 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: Matt Fleming, Leif Lindholm, Roy Franz, Ingo Molnar,
	x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org,
	linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Josh Boyer,
	Linus Torvalds

On 13 October 2014 15:37, Maarten Lankhorst
<maarten.lankhorst-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org> wrote:
> Op 10-10-14 om 10:37 schreef Ard Biesheuvel:
>> On 10 October 2014 10:30, Maarten Lankhorst
>> <maarten.lankhorst-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org> wrote:
>>> Hey,
>>>
>>> On 10-10-14 08:35, Ard Biesheuvel wrote:
>>>> On 6 October 2014 13:06, Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
>>>>> This reverts commit 84be880560fb, which itself reverted my original
>>>>> attempt to move x86 from #include'ing .c files from across the tree
>>>>> to using the EFI stub built as a static library.
>>>>>
>>>>> The issue that affected the original approach was that splitting
>>>>> the implementation into several .o files resulted in the variable
>>>>> 'efi_early' becoming a global with external linkage, which under
>>>>> -fPIC implies that references to it must go through the GOT. However,
>>>>> dealing with this additional GOT entry turned out to be troublesome
>>>>> on some EFI implementations. (GCC's visibility=hidden attribute is
>>>>> supposed to lift this requirement, but it turned out not to work on
>>>>> the 32-bit build.)
>>>>>
>>>>> Instead, use a pure getter function to get a reference to efi_early.
>>>>> This approach results in no additional GOT entries being generated,
>>>>> so there is no need for any changes in the early GOT handling.
>>>>>
>>>>> Cc: Maarten Lankhorst <maarten.lankhorst-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
>>>>> Cc: Josh Boyer <jwboyer-rxtnV0ftBwyoClj4AeEUq9i2O/JbrIOy@public.gmane.org>
>>>>> Cc: Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
>>>>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>>>>> ---
>>>>>
>>>>> Gents,
>>>>>
>>>>> This is a request for testing: I would like to find out if this patch
>>>>> fixes Maarten's issue without breaking anything like it did for Josh
>>>>> and Linus the first time around.
>>>>>
>>>> Any takers?
>>> Sorry it was on my todo list but I lost access to my laptop for a while.
>>> Normal EFI boot through refind works at least, but I think netboot may use a slightly
>>> different codepath which I can't test right now.
>>>
>>> Tested-By: Maarten Lankhorst <maarten.lankhorst-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
>> Thanks! So I suppose the code path you did test is the code path that
>> produced the failure last time?
>>
> I tested netboot now to be sure, seems to be working ok.
>

Thanks!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFT PATCH] efi/x86: move x86 back to libstub
       [not found]                 ` <543BD583.3050303-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
  2014-10-13 13:54                   ` Ard Biesheuvel
@ 2014-10-14 21:42                   ` Matt Fleming
  1 sibling, 0 replies; 10+ messages in thread
From: Matt Fleming @ 2014-10-14 21:42 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: Ard Biesheuvel, Matt Fleming, Leif Lindholm, Roy Franz,
	Ingo Molnar, x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org,
	linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Josh Boyer,
	Linus Torvalds

On Mon, 13 Oct, at 03:37:07PM, Maarten Lankhorst wrote:
> I tested netboot now to be sure, seems to be working ok.

Thanks guys, I'll take a look at this tomorrow.

-- 
Matt Fleming, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFT PATCH] efi/x86: move x86 back to libstub
       [not found] ` <1412593603-6945-1-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  2014-10-06 12:00   ` Josh Boyer
  2014-10-10  6:35   ` Ard Biesheuvel
@ 2014-10-16 14:42   ` Matt Fleming
       [not found]     ` <20141016144206.GH14343-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
  2 siblings, 1 reply; 10+ messages in thread
From: Matt Fleming @ 2014-10-16 14:42 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: matt.fleming-ral2JQCrhuEAvxtiuMwx3w,
	leif.lindholm-QSEj5FYQhm4dnm+yROfE0A,
	roy.franz-QSEj5FYQhm4dnm+yROfE0A, mingo-DgEjT+Ai2ygdnm+yROfE0A,
	x86-DgEjT+Ai2ygdnm+yROfE0A, hpa-YMNOUZJC4hwAvxtiuMwx3w,
	linux-efi-u79uwXL29TY76Z2rM5mHXA, Maarten Lankhorst, Josh Boyer,
	Linus Torvalds

On Mon, 06 Oct, at 01:06:43PM, Ard Biesheuvel wrote:
> This reverts commit 84be880560fb, which itself reverted my original
> attempt to move x86 from #include'ing .c files from across the tree
> to using the EFI stub built as a static library.
> 
> The issue that affected the original approach was that splitting
> the implementation into several .o files resulted in the variable
> 'efi_early' becoming a global with external linkage, which under
> -fPIC implies that references to it must go through the GOT. However,
> dealing with this additional GOT entry turned out to be troublesome
> on some EFI implementations. (GCC's visibility=hidden attribute is
> supposed to lift this requirement, but it turned out not to work on
> the 32-bit build.)
> 
> Instead, use a pure getter function to get a reference to efi_early.
> This approach results in no additional GOT entries being generated,
> so there is no need for any changes in the early GOT handling.
> 
> Cc: Maarten Lankhorst <maarten.lankhorst-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
> Cc: Josh Boyer <jwboyer-rxtnV0ftBwyoClj4AeEUq9i2O/JbrIOy@public.gmane.org>
> Cc: Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
> 
> Gents,
> 
> This is a request for testing: I would like to find out if this patch
> fixes Maarten's issue without breaking anything like it did for Josh
> and Linus the first time around.
> 
> 
>  arch/x86/boot/compressed/Makefile |  3 ++-
>  arch/x86/boot/compressed/eboot.c  |  8 ++++----
>  arch/x86/boot/compressed/eboot.h  | 16 ----------------
>  arch/x86/include/asm/efi.h        | 24 ++++++++++++++++++++++++
>  drivers/firmware/efi/Makefile     |  2 +-
>  5 files changed, 31 insertions(+), 22 deletions(-)

Ard, this is a very neat trick.

Thanks for taking the time to reimplement this, it's much appreciated.

Things work fine on my end, and I do have a Fedora 20/grub box in my
testing farm now, so I'm confident this is a good patch.

But if other people want to test it out, I'd be grateful of some more
Tested-by tags (I've already picked up Maarten's).

-- 
Matt Fleming, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFT PATCH] efi/x86: move x86 back to libstub
       [not found]     ` <20141016144206.GH14343-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
@ 2014-10-16 15:29       ` Josh Boyer
  0 siblings, 0 replies; 10+ messages in thread
From: Josh Boyer @ 2014-10-16 15:29 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Ard Biesheuvel, Matt Fleming, Leif Lindholm, Roy Franz,
	Ingo Molnar, x86, H. Peter Anvin,
	linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Maarten Lankhorst, Linus Torvalds

On Thu, Oct 16, 2014 at 10:42 AM, Matt Fleming <matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org> wrote:
> On Mon, 06 Oct, at 01:06:43PM, Ard Biesheuvel wrote:
>> This reverts commit 84be880560fb, which itself reverted my original
>> attempt to move x86 from #include'ing .c files from across the tree
>> to using the EFI stub built as a static library.
>>
>> The issue that affected the original approach was that splitting
>> the implementation into several .o files resulted in the variable
>> 'efi_early' becoming a global with external linkage, which under
>> -fPIC implies that references to it must go through the GOT. However,
>> dealing with this additional GOT entry turned out to be troublesome
>> on some EFI implementations. (GCC's visibility=hidden attribute is
>> supposed to lift this requirement, but it turned out not to work on
>> the 32-bit build.)
>>
>> Instead, use a pure getter function to get a reference to efi_early.
>> This approach results in no additional GOT entries being generated,
>> so there is no need for any changes in the early GOT handling.
>>
>> Cc: Maarten Lankhorst <maarten.lankhorst-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
>> Cc: Josh Boyer <jwboyer-rxtnV0ftBwyoClj4AeEUq9i2O/JbrIOy@public.gmane.org>
>> Cc: Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>> ---
>>
>> Gents,
>>
>> This is a request for testing: I would like to find out if this patch
>> fixes Maarten's issue without breaking anything like it did for Josh
>> and Linus the first time around.
>>
>>
>>  arch/x86/boot/compressed/Makefile |  3 ++-
>>  arch/x86/boot/compressed/eboot.c  |  8 ++++----
>>  arch/x86/boot/compressed/eboot.h  | 16 ----------------
>>  arch/x86/include/asm/efi.h        | 24 ++++++++++++++++++++++++
>>  drivers/firmware/efi/Makefile     |  2 +-
>>  5 files changed, 31 insertions(+), 22 deletions(-)
>
> Ard, this is a very neat trick.
>
> Thanks for taking the time to reimplement this, it's much appreciated.
>
> Things work fine on my end, and I do have a Fedora 20/grub box in my
> testing farm now, so I'm confident this is a good patch.
>
> But if other people want to test it out, I'd be grateful of some more
> Tested-by tags (I've already picked up Maarten's).

I applied this (with minor massaging) on top if Linus' tree as of
commit 0429fbc0bdc297d64188483ba029a23773ae07b0 this morning.  It
built and booted on the macbook machine I originally reported the
problem with, so it does appear to be fixed in that case.  I'll try it
on some other machines likely tomorrow.

Sorry for the delay on this.  The merge window is particularly busy for me.

josh

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-10-16 15:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-06 11:06 [RFT PATCH] efi/x86: move x86 back to libstub Ard Biesheuvel
     [not found] ` <1412593603-6945-1-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-10-06 12:00   ` Josh Boyer
2014-10-10  6:35   ` Ard Biesheuvel
     [not found]     ` <CAKv+Gu9rdPujXqfWhJt=76V8Lemf2FuVoa75KH-TWh+2_a=Ghg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-10-10  8:30       ` Maarten Lankhorst
     [not found]         ` <5437990C.7050402-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2014-10-10  8:37           ` Ard Biesheuvel
     [not found]             ` <CAKv+Gu_5tHNB=YOS0Kz2i2ap2n8PvzmvGD6-J7MzxptoG_zHQw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-10-13 13:37               ` Maarten Lankhorst
     [not found]                 ` <543BD583.3050303-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2014-10-13 13:54                   ` Ard Biesheuvel
2014-10-14 21:42                   ` Matt Fleming
2014-10-16 14:42   ` Matt Fleming
     [not found]     ` <20141016144206.GH14343-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2014-10-16 15:29       ` Josh Boyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox