From patchwork Wed Apr 15 19:54:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 206413 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=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 4B92AC3815B for ; Wed, 15 Apr 2020 19:55:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 20D2020787 for ; Wed, 15 Apr 2020 19:55:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="NQvD5FhS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2441903AbgDOTyo (ORCPT ); Wed, 15 Apr 2020 15:54:44 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:22138 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406322AbgDOTym (ORCPT ); Wed, 15 Apr 2020 15:54:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1586980481; x=1618516481; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Djqlg8Cv1gfYTZdwhPlUmPWsMdIBfQD89t54SYqYujA=; b=NQvD5FhSnjenJ7luBTQQW/dyXJp/3w2sxL2zvYUOQrRObIL41IVrAUGL YvVqzEXuXh2CMugz17XGoFlssEwju3fQwK/FodkluLJRSVJ1EBauRctYw zoke8FkzAoVCvtKeuDA34cL5gHIo57OOJw8Wo6UV8digvNlJsYlesjray GDP3SBfoud6Ui6wpbiB5NJYm4ITQnvsEj6SPvKYdNTZCRr0JgreR9ITXD g37fSmsw3Z3HNHtnu7ZvRZTCWsAdTLJaYe/bldiUq1AZ+VYbl9+8PNN7B mz9lc4YQlic3G64jueUxe666BSyNGU2Z4yI/KXn/PpXkzCvLovFQRFYMA w==; IronPort-SDR: lL32ABlfPZot9oxR0x6sRuRrJDayfBNMx3m1FABY3Tx5ra2DyFpax9RrSdiJLbb3UibBlQ3sPp VdiJjXK/ewpp1OYCX/LBzMTw3vB49Q+GbQIBFgGJ8LjVWyhx3/9GdSt79oLGf+ox87zK/1lqf3 3Uy7ECC4LyaqmlqooxyICcvdy8uURf31PUjPYbK6QNZXWOfiC6RFw4w//0bxm2Hdcj79fUU18z efFIEUOc0I5ZjAkPCV637D6/OMvyfH2cRvIK/9BraulIEzK6GqlhKqwA42rEHtDuBExQrIh8eN C6Y= X-IronPort-AV: E=Sophos;i="5.72,388,1580745600"; d="scan'208";a="244077016" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 16 Apr 2020 03:54:40 +0800 IronPort-SDR: 7VQRJwHY9jqjUF3M08RAZpGRD1V7QH/3T9WRECSmzot0qO/tEUyOzfl2zCrXgTS5ioVBWnmUiW 1CFmiuSxX1Lf95derYJMCbQui+WyWsBcewnqZOphzzPf37z9ELxFYyg/fJMrK9I/guyPQe/7NR 6hJ/68AYRem4s5KD8IAGtrxgpkql8J1zrUa2dpbIveeLWvhpooWCxKkTUFbb1vzQAgAXJZIlY8 mgB3YRY1py8tqHIAFzttl2e//5EgapHpRrCYw093mNz3lbF9G0/3aAYxUYjTYqxATFknKA+9kR 4QbQMR+DmtZ+EqIwd4k96SKm Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Apr 2020 12:45:08 -0700 IronPort-SDR: nSxPAvAlQJjzhHxPbWNQxGt8iiqTRn/CFCJkP1IW2hN5kyO5x8A0nRolmARO8ejzgeKfne+XP+ YhJ4lrEiUZ37oaoV0GyXFhQYDJ03SuhpCh0NrV2VvwhAhUgoNRfuHaBpEE/l/USJX50yxiOqJy YTTxdcr6U/EaTqWNrfb+QPwLTSOhaX7knnoFdhHsKeiBV4tKN+5T0zEH4dBF0qLaMALMgKuIbZ 7HNCWtfgqizgzP0T4PThCN2aQ7PrhPH4yMg4hhf5fq9zYKTHHBylCByOHlSkTlfb6aJV+U9QcM MVE= WDCIronportException: Internal Received: from 6hj08h2.ad.shared (HELO jedi-01.hgst.com) ([10.86.55.244]) by uls-op-cesaip02.wdc.com with ESMTP; 15 Apr 2020 12:54:40 -0700 From: Atish Patra To: linux-kernel@vger.kernel.org Cc: Atish Patra , Ard Biesheuvel , Arnd Bergmann , Catalin Marinas , Greg Kroah-Hartman , linux-efi@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Masahiro Yamada , Palmer Dabbelt , Russell King , Will Deacon Subject: [v3 PATCH 1/5] efi: Move arm-stub to a common file Date: Wed, 15 Apr 2020 12:54:18 -0700 Message-Id: <20200415195422.19866-2-atish.patra@wdc.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200415195422.19866-1-atish.patra@wdc.com> References: <20200415195422.19866-1-atish.patra@wdc.com> MIME-Version: 1.0 Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org 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 --- arch/arm/Kconfig | 2 +- arch/arm64/Kconfig | 2 +- drivers/firmware/efi/Kconfig | 4 ++-- drivers/firmware/efi/libstub/Makefile | 12 ++++++------ .../firmware/efi/libstub/{arm-stub.c => efi-stub.c} | 0 5 files changed, 10 insertions(+), 10 deletions(-) rename drivers/firmware/efi/libstub/{arm-stub.c => efi-stub.c} (100%) 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 2dbe4394f818..2b4e09bf987c 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 \ @@ -46,13 +46,13 @@ lib-y := efi-stub-helper.o gop.o secureboot.o tpm.o \ alignedmem.o relocate.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 @@ -74,8 +74,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 From patchwork Wed Apr 15 19:54:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 206412 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=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 A32A9C3815B for ; Wed, 15 Apr 2020 19:55:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 73C342078B for ; Wed, 15 Apr 2020 19:55:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="Cd8OcSsZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2634625AbgDOTzF (ORCPT ); Wed, 15 Apr 2020 15:55:05 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:22134 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406346AbgDOTyn (ORCPT ); Wed, 15 Apr 2020 15:54:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1586980483; x=1618516483; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=I/GiEGyOV5rt1rc9GnsBz8XcyhOtNk7wcIG4+FIGGnk=; b=Cd8OcSsZnz08tqmK/myPEmA8FoeeRloxs1cbx1OtuGGykpbVspnjdHav wLApJioSAfHG+68FhH7+0LObPZy6fr04YBibFYy2ChrzXfCFSTtVkgwhw kjW+uaMxEkAxxAmURbUN+6DYxazW++xKQqxxuZv7+n+LLsxElHvLsRa0v U0ge6WsBkKybvnkr7JXRWOyUBTaiXIXSQnfo11sKocqz+hn0+SOiHRbkF DZ8VGf7Qcuvkme8rY2/ii8b/A3SE4FO1348BkDoYZHPRdNaRFGsBsgtd1 R5XQPgikIZ5hv544C0PZzs0qeADZbcDKWtVrBKQB2B34xsqrfa5WREK1x g==; IronPort-SDR: RoI2rMKPdtlwIxwA7CILMhaEw/gtOpmApFbuIUZ0lVHcsrV+hLzUF+FDAntiIIZC6yOeCmURRw P6cXYi3W76YDO6tunahY16r7J2pZEnEu7+oSaOhMPGCVbCM/Ei2wyz+DQok+qQtKSgde6ol1X+ YNdKK/qGcwS5SZi4p0pehiwHG5EHLq/2+9miUDbDhQiKG2zGIs9GU+Uf6LOSgrDU7JcJyXDZup iQz4cEHw4LB7TYrmN79XukA6h88nYLBJ9UozF4T0mVWRKchvNpjpbEUO8ALRVVnT8Fy4V9gPYO aUU= X-IronPort-AV: E=Sophos;i="5.72,388,1580745600"; d="scan'208";a="244077018" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 16 Apr 2020 03:54:41 +0800 IronPort-SDR: VgPKtlCN6Snir5MwPcs/qf33hBVgbbE0/P/QATy/BY7uVq4496H2B2/o6V6CxudKEuRxs3qNYX eCBVnvUHupuXvLZBZ1kqyGaDxMpk3n9yZkXSvarT+07Snc61gUPBySo6fpo5Sii3Y052jW3R4K VjXV6G7omyF9OqtaYqmx1MOxvhZ7QicTEVKintcz3fKJBk4WGxJnAh6AJca3JDhq0SaBHvLOM1 zpXZ9g7RnDQhwiR7JIsnaCxRXQllolkUziMNBwz+3/fHXBGYcsyxraYNuJbm9L9vdEz7XoUNBs 5PJ7kmcYiztV/Z540HnY+v6H Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Apr 2020 12:45:10 -0700 IronPort-SDR: Pjy567yOzeM1bdT0GQqoGVowVxs6q7IBZl9SQHXkO3QkXpd+chuWhK+yjTisbi+VNX91SjvBnV GxEwlGV52czlYA1QiMCes6giLsRZptIWqNwQLGaUVCzbNyJ5USgkfDMSo0A+CPiD8/839jEeC8 rq12xRqTN3Mqu23X8EQ2bUPV5lpeA7+X4zFGWV3eU7jKjr1zayWZf5qVNdguKVu94FgPKEHTvD hdndP2UkRg/AN/9Hol45h4K3BSkE3BArGEmTR+MtRy637lcQqgIwxWzbT5MJsz0GuUvuaC0fbt VQk= WDCIronportException: Internal Received: from 6hj08h2.ad.shared (HELO jedi-01.hgst.com) ([10.86.55.244]) by uls-op-cesaip02.wdc.com with ESMTP; 15 Apr 2020 12:54:41 -0700 From: Atish Patra To: linux-kernel@vger.kernel.org Cc: Atish Patra , Ard Biesheuvel , Arnd Bergmann , Catalin Marinas , Greg Kroah-Hartman , linux-efi@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Masahiro Yamada , Palmer Dabbelt , Russell King , Will Deacon Subject: [v3 PATCH 3/5] RISC-V: Define fixmap bindings for generic early ioremap support Date: Wed, 15 Apr 2020 12:54:20 -0700 Message-Id: <20200415195422.19866-4-atish.patra@wdc.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200415195422.19866-1-atish.patra@wdc.com> References: <20200415195422.19866-1-atish.patra@wdc.com> MIME-Version: 1.0 Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org UEFI uses early IO or memory mappings for runtime services before normal ioremap() is usable. This patch only adds minimum necessary fixmap bindings and headers for generic ioremap support to work. Signed-off-by: Atish Patra Acked-by: Ard Biesheuvel --- arch/riscv/Kconfig | 1 + arch/riscv/include/asm/Kbuild | 1 + arch/riscv/include/asm/fixmap.h | 18 ++++++++++++++++++ arch/riscv/include/asm/io.h | 1 + 4 files changed, 21 insertions(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index a197258595ef..f39e326a7a42 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -68,6 +68,7 @@ config RISCV select ARCH_HAS_GCOV_PROFILE_ALL select HAVE_COPY_THREAD_TLS select HAVE_ARCH_KASAN if MMU && 64BIT + select GENERIC_EARLY_IOREMAP config ARCH_MMAP_RND_BITS_MIN default 18 if 64BIT diff --git a/arch/riscv/include/asm/Kbuild b/arch/riscv/include/asm/Kbuild index 3d9410bb4de0..59dd7be55005 100644 --- a/arch/riscv/include/asm/Kbuild +++ b/arch/riscv/include/asm/Kbuild @@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 +generic-y += early_ioremap.h generic-y += extable.h generic-y += flat.h generic-y += kvm_para.h diff --git a/arch/riscv/include/asm/fixmap.h b/arch/riscv/include/asm/fixmap.h index 2368d49eb4ef..ba5096d65fb0 100644 --- a/arch/riscv/include/asm/fixmap.h +++ b/arch/riscv/include/asm/fixmap.h @@ -30,6 +30,24 @@ enum fixed_addresses { FIX_TEXT_POKE1, FIX_TEXT_POKE0, FIX_EARLYCON_MEM_BASE, + /* + * Make sure that it is 2MB aligned. + */ +#define NR_FIX_SZ_2M (SZ_2M / PAGE_SIZE) + FIX_THOLE = NR_FIX_SZ_2M - FIX_PMD - 1, + + __end_of_permanent_fixed_addresses, + /* + * Temporary boot-time mappings, used by early_ioremap(), + * before ioremap() is functional. + */ +#define NR_FIX_BTMAPS (SZ_256K / PAGE_SIZE) +#define FIX_BTMAPS_SLOTS 7 +#define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS) + + FIX_BTMAP_END = __end_of_permanent_fixed_addresses, + FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1, + __end_of_fixed_addresses }; diff --git a/arch/riscv/include/asm/io.h b/arch/riscv/include/asm/io.h index 0f477206a4ed..047f414b6948 100644 --- a/arch/riscv/include/asm/io.h +++ b/arch/riscv/include/asm/io.h @@ -14,6 +14,7 @@ #include #include #include +#include /* * MMIO access functions are separated out to break dependency cycles