diff mbox series

efi: EFI_EARLYCON should depend on EFI

Message ID 20201124191646.3559757-1-geert@linux-m68k.org (mailing list archive)
State New, archived
Headers show
Series efi: EFI_EARLYCON should depend on EFI | expand

Commit Message

Geert Uytterhoeven Nov. 24, 2020, 7:16 p.m. UTC
CONFIG_EFI_EARLYCON defaults to yes, and thus is enabled on systems that
do not support EFI, or do not have EFI support enabled, but do satisfy
the symbol's other dependencies.

While drivers/firmware/efi/ won't be entered during the build phase if
CONFIG_EFI=n, and drivers/firmware/efi/earlycon.c itself thus won't be
built, enabling EFI_EARLYCON does force-enable CONFIG_FONT_SUPPORT and
CONFIG_ARCH_USE_MEMREMAP_PROT, and CONFIG_FONT_8x16, which is
undesirable.

Fix this by making CONFIG_EFI_EARLYCON depend on CONFIG_EFI.

This reduces kernel size on headless systems by more than 4 KiB.

Fixes: 69c1f396f25b805a ("efi/x86: Convert x86 EFI earlyprintk into generic earlycon implementation")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 drivers/firmware/efi/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Damien Le Moal Nov. 25, 2020, 8:21 a.m. UTC | #1
On Tue, 2020-11-24 at 20:16 +0100, Geert Uytterhoeven wrote:
> CONFIG_EFI_EARLYCON defaults to yes, and thus is enabled on systems that
> do not support EFI, or do not have EFI support enabled, but do satisfy
> the symbol's other dependencies.
> 
> While drivers/firmware/efi/ won't be entered during the build phase if
> CONFIG_EFI=n, and drivers/firmware/efi/earlycon.c itself thus won't be
> built, enabling EFI_EARLYCON does force-enable CONFIG_FONT_SUPPORT and
> CONFIG_ARCH_USE_MEMREMAP_PROT, and CONFIG_FONT_8x16, which is
> undesirable.
> 
> Fix this by making CONFIG_EFI_EARLYCON depend on CONFIG_EFI.
> 
> This reduces kernel size on headless systems by more than 4 KiB.
> 
> Fixes: 69c1f396f25b805a ("efi/x86: Convert x86 EFI earlyprintk into generic earlycon implementation")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
>  drivers/firmware/efi/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
> index b452cfa2100b401c..1dd1f7784f0888ff 100644
> --- a/drivers/firmware/efi/Kconfig
> +++ b/drivers/firmware/efi/Kconfig
> @@ -270,7 +270,7 @@ config EFI_DEV_PATH_PARSER
>  
> 
>  config EFI_EARLYCON
>  	def_bool y
> -	depends on SERIAL_EARLYCON && !ARM && !IA64
> +	depends on EFI && SERIAL_EARLYCON && !ARM && !IA64
>  	select FONT_SUPPORT
>  	select ARCH_USE_MEMREMAP_PROT
>  
> 

Looks good to me.
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Ard Biesheuvel Nov. 25, 2020, 8:23 a.m. UTC | #2
On Wed, 25 Nov 2020 at 09:21, Damien Le Moal <Damien.LeMoal@wdc.com> wrote:
>
> On Tue, 2020-11-24 at 20:16 +0100, Geert Uytterhoeven wrote:
> > CONFIG_EFI_EARLYCON defaults to yes, and thus is enabled on systems that
> > do not support EFI, or do not have EFI support enabled, but do satisfy
> > the symbol's other dependencies.
> >
> > While drivers/firmware/efi/ won't be entered during the build phase if
> > CONFIG_EFI=n, and drivers/firmware/efi/earlycon.c itself thus won't be
> > built, enabling EFI_EARLYCON does force-enable CONFIG_FONT_SUPPORT and
> > CONFIG_ARCH_USE_MEMREMAP_PROT, and CONFIG_FONT_8x16, which is
> > undesirable.
> >
> > Fix this by making CONFIG_EFI_EARLYCON depend on CONFIG_EFI.
> >
> > This reduces kernel size on headless systems by more than 4 KiB.
> >
> > Fixes: 69c1f396f25b805a ("efi/x86: Convert x86 EFI earlyprintk into generic earlycon implementation")
> > Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> > ---
> >  drivers/firmware/efi/Kconfig | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
> > index b452cfa2100b401c..1dd1f7784f0888ff 100644
> > --- a/drivers/firmware/efi/Kconfig
> > +++ b/drivers/firmware/efi/Kconfig
> > @@ -270,7 +270,7 @@ config EFI_DEV_PATH_PARSER
> >
> >
> >  config EFI_EARLYCON
> >       def_bool y
> > -     depends on SERIAL_EARLYCON && !ARM && !IA64
> > +     depends on EFI && SERIAL_EARLYCON && !ARM && !IA64
> >       select FONT_SUPPORT
> >       select ARCH_USE_MEMREMAP_PROT
> >
> >
>
> Looks good to me.
> Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
>

Thanks all

I'll queue this as a fix.
diff mbox series

Patch

diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
index b452cfa2100b401c..1dd1f7784f0888ff 100644
--- a/drivers/firmware/efi/Kconfig
+++ b/drivers/firmware/efi/Kconfig
@@ -270,7 +270,7 @@  config EFI_DEV_PATH_PARSER
 
 config EFI_EARLYCON
 	def_bool y
-	depends on SERIAL_EARLYCON && !ARM && !IA64
+	depends on EFI && SERIAL_EARLYCON && !ARM && !IA64
 	select FONT_SUPPORT
 	select ARCH_USE_MEMREMAP_PROT