All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] x86/efi: Fix 3DNow optimization build failure in EFI stub
@ 2014-08-04 23:12 ` Matt Fleming
  0 siblings, 0 replies; 3+ messages in thread
From: Matt Fleming @ 2014-08-04 23:12 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Ingo Molnar, linux-efi, linux-kernel, Matt Fleming,
	Borislav Petkov, Thomas Gleixner

From: Matt Fleming <matt.fleming@intel.com>

Building a 32-bit kernel with CONFIG_X86_USE_3DNOW and CONFIG_EFI_STUB
leads to the following build error,

  drivers/firmware/efi/libstub/lib.a(efi-stub-helper.o): In function `efi_relocate_kernel':
  efi-stub-helper.c:(.text+0xda5): undefined reference to `_mmx_memcpy'

This is due to the fact that the EFI boot stub pulls in the 3DNow
optimized versions of the memcpy() prototype from
arch/x86/include/asm/string_32.h, even though the _mmx_memcpy()
implementation isn't available in the EFI stub.

For now, predicate CONFIG_EFI_STUB on !CONFIG_X86_USE_3DNOW. This is
most definitely a temporary fix. A complete solution will involve
selectively including kernel headers/symbols into the early-boot
execution environment of the EFI boot stub, i.e. something analogous to
the way that the _SETUP symbol is used.

Previous attempts have been made to fix this kind of problem, though
none seem to have ever been merged,

  http://lkml.kernel.org/r/20120329104822.GA17233@x1.osrc.amd.com

Clearly, this problem has been around for a long time.

Reported-by: Ingo Molnar <mingo@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>

---

v2: Only disallow CONFIG_X86_USE_3DNOW for EFI_STUB, not for the EFI
runtime services.
 
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 801ed36c2e49..7ea8aaaab7fc 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1536,7 +1536,7 @@ config EFI
 
 config EFI_STUB
        bool "EFI stub support"
-       depends on EFI
+       depends on EFI && !X86_USE_3DNOW
        ---help---
           This kernel feature allows a bzImage to be loaded directly
 	  by EFI firmware without the use of a bootloader.
-- 
1.9.0


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

* [PATCH v2] x86/efi: Fix 3DNow optimization build failure in EFI stub
@ 2014-08-04 23:12 ` Matt Fleming
  0 siblings, 0 replies; 3+ messages in thread
From: Matt Fleming @ 2014-08-04 23:12 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Ingo Molnar, linux-efi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Matt Fleming,
	Borislav Petkov, Thomas Gleixner

From: Matt Fleming <matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Building a 32-bit kernel with CONFIG_X86_USE_3DNOW and CONFIG_EFI_STUB
leads to the following build error,

  drivers/firmware/efi/libstub/lib.a(efi-stub-helper.o): In function `efi_relocate_kernel':
  efi-stub-helper.c:(.text+0xda5): undefined reference to `_mmx_memcpy'

This is due to the fact that the EFI boot stub pulls in the 3DNow
optimized versions of the memcpy() prototype from
arch/x86/include/asm/string_32.h, even though the _mmx_memcpy()
implementation isn't available in the EFI stub.

For now, predicate CONFIG_EFI_STUB on !CONFIG_X86_USE_3DNOW. This is
most definitely a temporary fix. A complete solution will involve
selectively including kernel headers/symbols into the early-boot
execution environment of the EFI boot stub, i.e. something analogous to
the way that the _SETUP symbol is used.

Previous attempts have been made to fix this kind of problem, though
none seem to have ever been merged,

  http://lkml.kernel.org/r/20120329104822.GA17233-eWLsEhkZJs/kLsZ8J5Uweg@public.gmane.org

Clearly, this problem has been around for a long time.

Reported-by: Ingo Molnar <mingo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: H. Peter Anvin <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
Cc: Borislav Petkov <bp-l3A5Bk7waGM@public.gmane.org>
Cc: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Signed-off-by: Matt Fleming <matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

---

v2: Only disallow CONFIG_X86_USE_3DNOW for EFI_STUB, not for the EFI
runtime services.
 
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 801ed36c2e49..7ea8aaaab7fc 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1536,7 +1536,7 @@ config EFI
 
 config EFI_STUB
        bool "EFI stub support"
-       depends on EFI
+       depends on EFI && !X86_USE_3DNOW
        ---help---
           This kernel feature allows a bzImage to be loaded directly
 	  by EFI firmware without the use of a bootloader.
-- 
1.9.0

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

* [tip:x86/efi] x86/efi: Fix 3DNow optimization build failure in EFI stub
  2014-08-04 23:12 ` Matt Fleming
  (?)
@ 2014-08-04 23:31 ` tip-bot for Matt Fleming
  -1 siblings, 0 replies; 3+ messages in thread
From: tip-bot for Matt Fleming @ 2014-08-04 23:31 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, hpa, bp, matt.fleming

Commit-ID:  b16d8c231e4d03fefc7de1b8b62bad5659ee8070
Gitweb:     http://git.kernel.org/tip/b16d8c231e4d03fefc7de1b8b62bad5659ee8070
Author:     Matt Fleming <matt.fleming@intel.com>
AuthorDate: Tue, 5 Aug 2014 00:12:19 +0100
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Mon, 4 Aug 2014 16:26:46 -0700

x86/efi: Fix 3DNow optimization build failure in EFI stub

Building a 32-bit kernel with CONFIG_X86_USE_3DNOW and CONFIG_EFI_STUB
leads to the following build error,

  drivers/firmware/efi/libstub/lib.a(efi-stub-helper.o): In function `efi_relocate_kernel':
  efi-stub-helper.c:(.text+0xda5): undefined reference to `_mmx_memcpy'

This is due to the fact that the EFI boot stub pulls in the 3DNow
optimized versions of the memcpy() prototype from
arch/x86/include/asm/string_32.h, even though the _mmx_memcpy()
implementation isn't available in the EFI stub.

For now, predicate CONFIG_EFI_STUB on !CONFIG_X86_USE_3DNOW. This is
most definitely a temporary fix. A complete solution will involve
selectively including kernel headers/symbols into the early-boot
execution environment of the EFI boot stub, i.e. something analogous to
the way that the _SETUP symbol is used.

Previous attempts have been made to fix this kind of problem, though
none seem to have ever been merged,

  http://lkml.kernel.org/r/20120329104822.GA17233@x1.osrc.amd.com

Clearly, this problem has been around for a long time.

Reported-by: Ingo Molnar <mingo@kernel.org>
Cc: Borislav Petkov <bp@suse.de>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Link: http://lkml.kernel.org/r/1407193939-27813-1-git-send-email-matt@console-pimps.org
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 801ed36..7ea8aaa 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1536,7 +1536,7 @@ config EFI
 
 config EFI_STUB
        bool "EFI stub support"
-       depends on EFI
+       depends on EFI && !X86_USE_3DNOW
        ---help---
           This kernel feature allows a bzImage to be loaded directly
 	  by EFI firmware without the use of a bootloader.

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

end of thread, other threads:[~2014-08-04 23:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-04 23:12 [PATCH v2] x86/efi: Fix 3DNow optimization build failure in EFI stub Matt Fleming
2014-08-04 23:12 ` Matt Fleming
2014-08-04 23:31 ` [tip:x86/efi] " tip-bot for Matt Fleming

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.