Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1480134

[PATCH 28/29] x86/efi: Optimize away setup_gop32/64 if unused

From Matt Fleming <matt@codeblueprint.co.uk>
Newsgroups linux.kernel
Subject [PATCH 28/29] x86/efi: Optimize away setup_gop32/64 if unused
Date 2016-09-09 17:30 +0200
Message-ID <sfvUC-4IV-53@gated-at.bofh.it> (permalink)
References <sfvKV-4Fq-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Lukas Wunner <lukas@wunner.de>

Commit 2c23b73c2d02 ("x86/efi: Prepare GOP handling code for reuse
as generic code") introduced an efi_is_64bit() macro to x86 which
previously only existed for arm arches.  The macro is used to
choose between the 64 bit or 32 bit code path in gop.c at runtime.

However the code path that's going to be taken is known at compile
time when compiling for x86_32 or for x86_64 with mixed mode disabled.
Amend the macro to eliminate the unused code path in those cases.

Size of gop.o text section:
CONFIG_X86_32:                         1758 before, 1299 after
CONFIG_X86_64 && !CONFIG_EFI_MIXED:    2201 before, 1406 after
CONFIG_X86_64 &&  CONFIG_EFI_MIXED:    2201 before and after

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
---
 arch/x86/include/asm/efi.h | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 4630e2bfa8fb..f14655e7726a 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -206,14 +206,23 @@ struct efi_config {
 
 __pure const struct efi_config *__efi_early(void);
 
+static inline bool efi_is_64bit(void)
+{
+	if (!IS_ENABLED(CONFIG_X86_64))
+		return false;
+
+	if (!IS_ENABLED(CONFIG_EFI_MIXED))
+		return true;
+
+	return __efi_early()->is64;
+}
+
 #define efi_call_early(f, ...)						\
 	__efi_early()->call(__efi_early()->f, __VA_ARGS__);
 
 #define __efi_call_early(f, ...)					\
 	__efi_early()->call((unsigned long)f, __VA_ARGS__);
 
-#define efi_is_64bit()		__efi_early()->is64
-
 extern bool efi_reboot_required(void);
 
 #else
-- 
2.9.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL 00/29] EFI changes for v4.9 Matt Fleming <matt@codeblueprint.co.uk> - 2016-09-09 17:30 +0200
  [PATCH 20/29] x86/efi: Map in physical addresses in efi_map_region_fixed Matt Fleming <matt@codeblueprint.co.uk> - 2016-09-09 17:30 +0200
  [PATCH 27/29] x86/efi: Use kmalloc_array() in efi_call_phys_prolog() Matt Fleming <matt@codeblueprint.co.uk> - 2016-09-09 17:30 +0200
  [PATCH 04/29] efi: Add efi_memmap_init_late() for permanent EFI memmap Matt Fleming <matt@codeblueprint.co.uk> - 2016-09-09 17:30 +0200
  [PATCH 12/29] efi/esrt: Use memremap not ioremap to access ESRT table in memory Matt Fleming <matt@codeblueprint.co.uk> - 2016-09-09 17:30 +0200
  [PATCH 25/29] efi: Add efi_test driver for exporting UEFI runtime service interfaces Matt Fleming <matt@codeblueprint.co.uk> - 2016-09-09 17:30 +0200
  [PATCH 23/29] efi/arm64: Add debugfs node to dump UEFI runtime page tables Matt Fleming <matt@codeblueprint.co.uk> - 2016-09-09 17:30 +0200
  [PATCH 08/29] efi: Allow drivers to reserve boot services forever Matt Fleming <matt@codeblueprint.co.uk> - 2016-09-09 17:30 +0200
  [PATCH 22/29] x86/efi: Remove unused find_bits() function Matt Fleming <matt@codeblueprint.co.uk> - 2016-09-09 17:30 +0200
  [PATCH 10/29] efi/esrt: Use efi_mem_reserve() and avoid a kmalloc() Matt Fleming <matt@codeblueprint.co.uk> - 2016-09-09 17:30 +0200
  [PATCH 16/29] efi: Replace runtime services spinlock with semaphore Matt Fleming <matt@codeblueprint.co.uk> - 2016-09-09 17:30 +0200
  [PATCH 28/29] x86/efi: Optimize away setup_gop32/64 if unused Matt Fleming <matt@codeblueprint.co.uk> - 2016-09-09 17:30 +0200
  [PATCH 17/29] x86/efi: Initialize status to ensure garbage is not returned on small size Matt Fleming <matt@codeblueprint.co.uk> - 2016-09-09 17:30 +0200
  [PATCH 18/29] firmware-gsmi: Delete an unnecessary check before the function call "dma_pool_destroy" Matt Fleming <matt@codeblueprint.co.uk> - 2016-09-09 17:30 +0200
  [PATCH 21/29] fs/efivarfs: Fix double kfree() in error path Matt Fleming <matt@codeblueprint.co.uk> - 2016-09-09 17:30 +0200
  Re: [GIT PULL 00/29] EFI changes for v4.9 Matt Fleming <matt@codeblueprint.co.uk> - 2016-09-12 13:00 +0200
    Re: [GIT PULL 00/29] EFI changes for v4.9 Ingo Molnar <mingo@kernel.org> - 2016-09-12 13:50 +0200
  Re: [GIT PULL 00/29] EFI changes for v4.9 Ingo Molnar <mingo@kernel.org> - 2016-09-13 20:40 +0200

csiph-web