From patchwork Wed Apr 22 17:24:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 206400 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C221C55185 for ; Wed, 22 Apr 2020 17:24:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ED3A22082E for ; Wed, 22 Apr 2020 17:24:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587576281; bh=yv2bl+Hq1keub6bCzkKRPWqyodgDktK3n895VhwBQQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=M3eprdqmjIc5PHw+MaJIzqRktTsuXeSq/UYVU47vSMbQdNEH4yzSi9YNr230MBXat ZNDUveyuJZeWQv4cukJSgFrefkTh6ZfNCh1rCr+kThYoruJjEMszVc51Np70ZI5uHH LNTZucOBW2v+w+5NduQNbfH7/5rRxc2NSXE0GxcQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726632AbgDVRYk (ORCPT ); Wed, 22 Apr 2020 13:24:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:41152 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726372AbgDVRYj (ORCPT ); Wed, 22 Apr 2020 13:24:39 -0400 Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 39C112098B; Wed, 22 Apr 2020 17:24:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587576278; bh=yv2bl+Hq1keub6bCzkKRPWqyodgDktK3n895VhwBQQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gcfw8CwsYg6YDfvVOFpR1tk9R28SQ1zAuMaCmmQzPDMdKTWLCi2F6dytm1Oc1z5gL qvFLOoBpdicA0zuFsuLnL5lbZ4da+K3tcbxQIDsEPLi7v7O9J2pUBVhcTiKGUAbWVO L+zwS3vjFrEYtxXxm5erUbobgeuMaspN50ejRJ5s= From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: Ard Biesheuvel , Atish Patra , Palmer Dabbelt , Paul Walmsley , Albert Ou , linux-riscv@lists.infradead.org Subject: [PATCH v5 1/7] efi/libstub: Move arm-stub to a common file Date: Wed, 22 Apr 2020 19:24:08 +0200 Message-Id: <20200422172414.6662-2-ardb@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200422172414.6662-1-ardb@kernel.org> References: <20200422172414.6662-1-ardb@kernel.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org From: Atish Patra 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 Reviewed-by: Palmer Dabbelt Link: https://lore.kernel.org/r/20200415195422.19866-2-atish.patra@wdc.com Signed-off-by: Ard Biesheuvel --- arch/arm/Kconfig | 2 +- arch/arm64/Kconfig | 2 +- drivers/firmware/efi/Kconfig | 4 ++-- drivers/firmware/efi/libstub/Makefile | 12 ++++++------ drivers/firmware/efi/libstub/{arm-stub.c => efi-stub.c} | 0 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 66a04f6f4775..165987aa5bcd 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1954,7 +1954,7 @@ config EFI select UCS2_STRING select EFI_PARAMS_FROM_FDT select EFI_STUB - select EFI_ARMSTUB + select EFI_GENERIC_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 40fb05d96c60..32d818c5ccda 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -1785,7 +1785,7 @@ config EFI select EFI_PARAMS_FROM_FDT select EFI_RUNTIME_WRAPPERS select EFI_STUB - select EFI_ARMSTUB + select EFI_GENERIC_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 613828d3f106..2a2b2b96a1dc 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_STUB bool config EFI_ARMSTUB_DTB_LOADER bool "Enable the DTB loader" - depends on EFI_ARMSTUB + depends on EFI_GENERIC_STUB 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 094eabdecfe6..75cb2c3a1519 100644 --- a/drivers/firmware/efi/libstub/Makefile +++ b/drivers/firmware/efi/libstub/Makefile @@ -23,7 +23,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_STUB) += -I$(srctree)/scripts/dtc/libfdt KBUILD_CFLAGS := $(cflags-y) -DDISABLE_BRANCH_PROFILING \ -include $(srctree)/drivers/firmware/efi/libstub/hidden.h \ @@ -45,13 +45,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_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 @@ -73,8 +73,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_STUB) := $(lib-y) +lib-$(CONFIG_EFI_GENERIC_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 100% rename from drivers/firmware/efi/libstub/arm-stub.c rename to drivers/firmware/efi/libstub/efi-stub.c