linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Atish Patra <Atish.Patra@wdc.com>
To: "ardb@kernel.org" <ardb@kernel.org>
Cc: "alexios.zavras@intel.com" <alexios.zavras@intel.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"mchehab+samsung@kernel.org" <mchehab+samsung@kernel.org>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"michal.simek@xilinx.com" <michal.simek@xilinx.com>,
	"linux@armlinux.org.uk" <linux@armlinux.org.uk>,
	"abner.chang@hpe.com" <abner.chang@hpe.com>,
	"linux-riscv@lists.infradead.org"
	<linux-riscv@lists.infradead.org>,
	"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"daniel.schaefer@hpe.com" <daniel.schaefer@hpe.com>,
	Anup Patel <Anup.Patel@wdc.com>,
	"kstewart@linuxfoundation.org" <kstewart@linuxfoundation.org>,
	"palmer@dabbelt.com" <palmer@dabbelt.com>,
	"aou@eecs.berkeley.edu" <aou@eecs.berkeley.edu>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"rppt@linux.ibm.com" <rppt@linux.ibm.com>,
	"linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
	"bp@suse.de" <bp@suse.de>,
	"greentime.hu@sifive.com" <greentime.hu@sifive.com>,
	"keescook@chromium.org" <keescook@chromium.org>,
	"agraf@csgraf.de" <agraf@csgraf.de>,
	"will@kernel.org" <will@kernel.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"mingo@kernel.org" <mingo@kernel.org>,
	"allison@lohutok.net" <allison@lohutok.net>,
	"han_mao@c-sky.com" <han_mao@c-sky.com>,
	"paul.walmsley@sifive.com" <paul.walmsley@sifive.com>,
	"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
	"leif@nuviainc.com" <leif@nuviainc.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Subject: Re: [RFC PATCH 1/5] efi: Move arm-stub to a common file
Date: Thu, 27 Feb 2020 01:16:48 +0000	[thread overview]
Message-ID: <eab4bf04c586afca31a95818fd8dc60404f1b1f5.camel@wdc.com> (raw)
In-Reply-To: <CAKv+Gu-Dk4hOobKhOEn1Wpbc4Ta2F5anZQ4rRmjpkPfT2g1L3w@mail.gmail.com>

On Wed, 2020-02-26 at 08:04 +0100, Ard Biesheuvel wrote:
> Hi Atish,
> 
> On Wed, 26 Feb 2020 at 02:10, Atish Patra <atish.patra@wdc.com>
> wrote:
> > Most of the arm-stub code is written in an architecture independent
> > manner.
> > As a result, RISC-V can reuse most of the arm-stub code.
> > 
> > Rename the arm-stub.c to efi-stub.c so that ARM, ARM64 and RISC-V
> > can use it.
> > This patch doesn't introduce any functional changes.
> > 
> > Signed-off-by: Atish Patra <atish.patra@wdc.com>
> > ---
> >  arch/arm/Kconfig                                     |  2 +-
> >  arch/arm64/Kconfig                                   |  2 +-
> >  drivers/firmware/efi/Kconfig                         |  6 +++---
> >  drivers/firmware/efi/libstub/Makefile                | 12 ++++++
> > ------
> >  .../firmware/efi/libstub/{arm-stub.c => efi-stub.c}  |  7 ++++++-
> >  5 files changed, 17 insertions(+), 12 deletions(-)
> >  rename drivers/firmware/efi/libstub/{arm-stub.c => efi-stub.c}
> > (98%)
> > 
> > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > index 97864aabc2a6..9931fea06076 100644
> > --- a/arch/arm/Kconfig
> > +++ b/arch/arm/Kconfig
> > @@ -1955,7 +1955,7 @@ config EFI
> >         select UCS2_STRING
> >         select EFI_PARAMS_FROM_FDT
> >         select EFI_STUB
> > -       select EFI_ARMSTUB
> > +       select EFI_GENERIC_ARCH_STUB
> >         select EFI_RUNTIME_WRAPPERS
> >         ---help---
> >           This option provides support for runtime services
> > provided
> > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> > index 0b30e884e088..ae776d8ef2f9 100644
> > --- a/arch/arm64/Kconfig
> > +++ b/arch/arm64/Kconfig
> > @@ -1720,7 +1720,7 @@ config EFI
> >         select EFI_PARAMS_FROM_FDT
> >         select EFI_RUNTIME_WRAPPERS
> >         select EFI_STUB
> > -       select EFI_ARMSTUB
> > +       select EFI_GENERIC_ARCH_STUB
> >         default y
> >         help
> >           This option provides support for runtime services
> > provided
> > diff --git a/drivers/firmware/efi/Kconfig
> > b/drivers/firmware/efi/Kconfig
> > index ecc83e2f032c..1bcedb7812da 100644
> > --- a/drivers/firmware/efi/Kconfig
> > +++ b/drivers/firmware/efi/Kconfig
> > @@ -106,12 +106,12 @@ config EFI_PARAMS_FROM_FDT
> >  config EFI_RUNTIME_WRAPPERS
> >         bool
> > 
> > -config EFI_ARMSTUB
> > +config EFI_GENERIC_ARCH_STUB
> 
> Let's call it EFI_GENERIC_STUB
> 
> >         bool
> > 
> > -config EFI_ARMSTUB_DTB_LOADER
> > +config EFI_STUB_DTB_LOADER
> >         bool "Enable the DTB loader"
> > -       depends on EFI_ARMSTUB
> > +       depends on EFI_GENERIC_ARCH_STUB
> 
> Do you actually need the DTB loader? I feel adding this for ARM was a
> mistake, so you may want to make this depend on !RISCV while you're
> at
> it.
> 

Actually we don't need it RISC-V. I think I added that that's a valid
option to have. But your recent cleaup seems otherwise. I will make it
depend on !RISCV. It also doesn't make sense to rename it to
EFI_STUB_DTB_LOADER. So I will just leave EFI_ARMSTUB_DTB_LOADER as it
is.

> >         default y
> >         help
> >           Select this config option to add support for the dtb=
> > command
> > diff --git a/drivers/firmware/efi/libstub/Makefile
> > b/drivers/firmware/efi/libstub/Makefile
> > index 4d6246c6f651..2c5b76787126 100644
> > --- a/drivers/firmware/efi/libstub/Makefile
> > +++ b/drivers/firmware/efi/libstub/Makefile
> > @@ -22,7 +22,7 @@ cflags-$(CONFIG_ARM)          := $(subst
> > $(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) \
> >                                    -fno-builtin -fpic \
> >                                    $(call cc-option,-mno-single-
> > pic-base)
> > 
> > -cflags-$(CONFIG_EFI_ARMSTUB)   += -I$(srctree)/scripts/dtc/libfdt
> > +cflags-$(CONFIG_EFI_GENERIC_ARCH_STUB) +=
> > -I$(srctree)/scripts/dtc/libfdt
> > 
> >  KBUILD_CFLAGS                  := $(cflags-y)
> > -DDISABLE_BRANCH_PROFILING \
> >                                    -include
> > $(srctree)/drivers/firmware/efi/libstub/hidden.h \
> > @@ -44,13 +44,13 @@ lib-y                               := efi-
> > stub-helper.o gop.o secureboot.o tpm.o \
> >                                    skip_spaces.o lib-cmdline.o lib-
> > ctype.o
> > 
> >  # include the stub's generic dependencies from lib/ when building
> > for ARM/arm64
> > -arm-deps-y := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c fdt_empty_tree.c
> > fdt_sw.c
> > +efi-deps-y := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c fdt_empty_tree.c
> > fdt_sw.c
> > 
> >  $(obj)/lib-%.o: $(srctree)/lib/%.c FORCE
> >         $(call if_changed_rule,cc_o_c)
> > 
> > -lib-$(CONFIG_EFI_ARMSTUB)      += arm-stub.o fdt.o string.o \
> > -                                  $(patsubst %.c,lib-%.o,$(arm-
> > deps-y))
> > +lib-$(CONFIG_EFI_GENERIC_ARCH_STUB)            += efi-stub.o fdt.o
> > string.o \
> > +                                  $(patsubst %.c,lib-%.o,$(efi-
> > deps-y))
> > 
> >  lib-$(CONFIG_ARM)              += arm32-stub.o
> >  lib-$(CONFIG_ARM64)            += arm64-stub.o
> > @@ -72,8 +72,8 @@ CFLAGS_arm64-stub.o           :=
> > -DTEXT_OFFSET=$(TEXT_OFFSET)
> >  # a verification pass to see if any absolute relocations exist in
> > any of the
> >  # object files.
> >  #
> > -extra-$(CONFIG_EFI_ARMSTUB)    := $(lib-y)
> > -lib-$(CONFIG_EFI_ARMSTUB)      := $(patsubst %.o,%.stub.o,$(lib-
> > y))
> > +extra-$(CONFIG_EFI_GENERIC_ARCH_STUB)  := $(lib-y)
> > +lib-$(CONFIG_EFI_GENERIC_ARCH_STUB)    := $(patsubst
> > %.o,%.stub.o,$(lib-y))
> > 
> >  STUBCOPY_FLAGS-$(CONFIG_ARM64) += --prefix-alloc-sections=.init \
> >                                    --prefix-symbols=__efistub_
> > diff --git a/drivers/firmware/efi/libstub/arm-stub.c
> > b/drivers/firmware/efi/libstub/efi-stub.c
> > similarity index 98%
> > rename from drivers/firmware/efi/libstub/arm-stub.c
> > rename to drivers/firmware/efi/libstub/efi-stub.c
> > index 13559c7e6643..b87c3f70430c 100644
> > --- a/drivers/firmware/efi/libstub/arm-stub.c
> > +++ b/drivers/firmware/efi/libstub/efi-stub.c
> > @@ -15,6 +15,7 @@
> > 
> >  #include "efistub.h"
> > 
> > +#if IS_ENABLED(CONFIG_ARM64) || IS_ENABLED(CONFIG_ARM)
> >  /*
> >   * This is the base address at which to start allocating virtual
> > memory ranges
> >   * for UEFI Runtime Services. This is in the low TTBR0 range so
> > that we can use
> > @@ -27,6 +28,10 @@
> >   * entire footprint of the UEFI runtime services memory regions)
> >   */
> >  #define EFI_RT_VIRTUAL_BASE    SZ_512M
> > +#else
> > +#define EFI_RT_VIRTUAL_BASE    SZ_2G
> > +#endif
> > +
> 
> Can we drop this hunk for now? It should be part of your runtime
> services series.
> 

Sure. Will do it.

> >  #define EFI_RT_VIRTUAL_SIZE    SZ_512M
> > 
> >  #ifdef CONFIG_ARM64
> > @@ -243,7 +248,7 @@ efi_status_t efi_entry(efi_handle_t handle,
> > efi_system_table_t *sys_table_arg)
> >          * 'dtb=' unless UEFI Secure Boot is disabled.  We assume
> > that secure
> >          * boot is enabled if we can't determine its state.
> >          */
> > -       if (!IS_ENABLED(CONFIG_EFI_ARMSTUB_DTB_LOADER) ||
> > +       if (!IS_ENABLED(CONFIG_EFI_STUB_DTB_LOADER) ||
> >              secure_boot != efi_secureboot_mode_disabled) {
> >                 if (strstr(cmdline_ptr, "dtb="))
> >                         pr_efi("Ignoring DTB from command
> > line.\n");
> > --
> > 2.24.0
> > 

-- 
Regards,
Atish

  reply	other threads:[~2020-02-27  1:17 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-26  1:10 [RFC PATCH 0/5] Add UEFI support for RISC-V Atish Patra
2020-02-26  1:10 ` [RFC PATCH 1/5] efi: Move arm-stub to a common file Atish Patra
2020-02-26  7:04   ` Ard Biesheuvel
2020-02-27  1:16     ` Atish Patra [this message]
2020-02-26  1:10 ` [RFC PATCH 2/5] include: pe.h: Add RISC-V related PE definition Atish Patra
2020-02-26  7:06   ` Ard Biesheuvel
2020-02-27  0:53     ` Atish Patra
2020-02-26  1:10 ` [RFC PATCH 3/5] RISC-V: Define fixmap bindings for generic early ioremap support Atish Patra
2020-02-26  7:08   ` Ard Biesheuvel
2020-02-27 19:58     ` Atish Patra
2020-02-27 20:00       ` Ard Biesheuvel
2020-02-26  1:10 ` [RFC PATCH 4/5] RISC-V: Add PE/COFF header for EFI stub Atish Patra
2020-02-26  7:14   ` Ard Biesheuvel
2020-02-27  1:29     ` Atish Patra
2020-02-27  7:44       ` Ard Biesheuvel
2020-02-26  1:10 ` [RFC PATCH 5/5] RISC-V: Add EFI stub support Atish Patra
2020-02-26  7:28   ` Ard Biesheuvel
2020-02-27 19:53     ` Atish Patra
2020-02-27 19:59       ` Ard Biesheuvel
2020-02-28  1:05         ` Atish Patra
2020-02-28  6:57           ` Ard Biesheuvel
2020-03-10  7:08             ` Atish Patra
2020-03-10  7:38               ` Anup Patel
2020-03-10 13:18               ` Ard Biesheuvel
2020-02-26 23:46 ` [RFC PATCH 0/5] Add UEFI support for RISC-V Palmer Dabbelt
2020-02-27  2:09   ` Atish Patra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eab4bf04c586afca31a95818fd8dc60404f1b1f5.camel@wdc.com \
    --to=atish.patra@wdc.com \
    --cc=Anup.Patel@wdc.com \
    --cc=abner.chang@hpe.com \
    --cc=agraf@csgraf.de \
    --cc=akpm@linux-foundation.org \
    --cc=alexios.zavras@intel.com \
    --cc=allison@lohutok.net \
    --cc=aou@eecs.berkeley.edu \
    --cc=ardb@kernel.org \
    --cc=arnd@arndb.de \
    --cc=bp@suse.de \
    --cc=catalin.marinas@arm.com \
    --cc=daniel.schaefer@hpe.com \
    --cc=greentime.hu@sifive.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=han_mao@c-sky.com \
    --cc=keescook@chromium.org \
    --cc=kstewart@linuxfoundation.org \
    --cc=leif@nuviainc.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=mchehab+samsung@kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=mingo@kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=pbonzini@redhat.com \
    --cc=rppt@linux.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).