From patchwork Tue Oct 30 12:55:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990812 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ks1p53lsz9s3T for ; Tue, 30 Oct 2018 23:57:18 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 556E7C22105; Tue, 30 Oct 2018 12:57:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id DC2A8C220DC; Tue, 30 Oct 2018 12:57:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 365BDC220E1; Tue, 30 Oct 2018 12:57:10 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id 5E9B6C21F18 for ; Tue, 30 Oct 2018 12:57:09 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2E6AAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBVAMBAQELAYIEgg2MbZZGkBoNhGwCgyUiNwoNAQMBAQIBAQICAmkcDIU8BnkQUSE2Bg4FgyGBagMUAaotiAENghgJAYc3hCaBWD+GeYJ1hQ4CimeTey4HAoEOgQQEi0mDHQsYgUOHd4cOjXeJL4FZI4FVMxokgzuFfopabgGLdwEB X-IPAS-Result: A2E6AAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBVAMBAQELAYIEgg2MbZZGkBoNhGwCgyUiNwoNAQMBAQIBAQICAmkcDIU8BnkQUSE2Bg4FgyGBagMUAaotiAENghgJAYc3hCaBWD+GeYJ1hQ4CimeTey4HAoEOgQQEi0mDHQsYgUOHd4cOjXeJL4FZI4FVMxokgzuFfopabgGLdwEB X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904626" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:09 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CnAACMVNhb/xBhWMBkHAEBAQQBAQcEAQGBVAQBAQsBg1c6jG2WRpAaDYRsAoNGNwoNAQMBAQIBAQJtHAyFOwZ5EFEhNgYOBYMhgWoDFaouiAENghgJAYc3hX4/hnmCdYUOAopnk3suBwKBDoEEBItJgx0LGIFDh3eHDo13iS+BWSKBVTMaJIM7hX6KWj4wAYt3AQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525632" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:08 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:07 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:24 +0100 Message-ID: <20181030125553.5230-2-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--1.916700-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Cc: Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v2 01/29] tools: .gitignore: add prelink-riscv X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Ignore tools/prelink-riscv. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng Reviewed-by: Rick Chen --- Changes in v2: None tools/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/.gitignore b/tools/.gitignore index c8cdaef90c..e5ede22842 100644 --- a/tools/.gitignore +++ b/tools/.gitignore @@ -24,6 +24,7 @@ /mksunxiboot /mxsboot /ncb +/prelink-riscv /proftool /relocate-rela /sunxi-spl-image-builder From patchwork Tue Oct 30 12:55:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990815 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ks5W1n7Hz9s4s for ; Wed, 31 Oct 2018 00:00:31 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id AF431C22113; Tue, 30 Oct 2018 12:57:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 93E58C220F8; Tue, 30 Oct 2018 12:57:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 63756C21F18; Tue, 30 Oct 2018 12:57:10 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id 138F4C220DC for ; Tue, 30 Oct 2018 12:57:10 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2E6AAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBVAMBAQELAYIEgg2MbZZGkBoNhGwCgyUiNwoNAQMBAQIBAQICAmkcDIU8BnkQUSE2Bg4FgyGBagMUAaotiAENghgJAYc3hCaBWD+BEAGFaIFxgQSEbCICimeTey4HAoEOgQQEi0mDHQsYgVKHaIcOiTmEPokvgVkjgVUzGiSDO4JPgy+KWm4BiSqCTQEB X-IPAS-Result: A2E6AAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBVAMBAQELAYIEgg2MbZZGkBoNhGwCgyUiNwoNAQMBAQIBAQICAmkcDIU8BnkQUSE2Bg4FgyGBagMUAaotiAENghgJAYc3hCaBWD+BEAGFaIFxgQSEbCICimeTey4HAoEOgQQEi0mDHQsYgVKHaIcOiTmEPokvgVkjgVUzGiSDO4JPgy+KWm4BiSqCTQEB X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904627" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:10 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CnAACMVNhb/xBhWMBkHAEBAQQBAQcEAQGBVAQBAQsBg1c6jG2WRpAaDYRsAoNGNwoNAQMBAQIBAQJtHAyFOwZ5EFEhNgYOBYMhgWoDFaouiAENghgJAYc3hX4/gRABhWiBcYEEhGwiAopnk3suBwKBDoEEBItJgx0LGIFSh2iHDok5hD6JL4FZIoFVMxokgzuCT4Mvilo+MAGJKoJNAQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525634" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:09 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:08 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:25 +0100 Message-ID: <20181030125553.5230-3-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--1.727100-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Subject: [U-Boot] [PATCH v2 02/29] dts: riscv: update makefile to also clean the RISC-V dts directory X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Signed-off-by: Lukas Auer Reviewed-by: Bin Meng Reviewed-by: Rick Chen --- Changes in v2: None dts/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dts/Makefile b/dts/Makefile index 9a9a3d5c98..cd6e9a968e 100644 --- a/dts/Makefile +++ b/dts/Makefile @@ -61,4 +61,4 @@ dtbs: $(obj)/dt.dtb $(obj)/dt-spl.dtb clean-files := dt.dtb.S dt-spl.dtb.S # Let clean descend into dts directories -subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/mips/dts ../arch/sandbox/dts ../arch/x86/dts ../arch/powerpc/dts +subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/mips/dts ../arch/sandbox/dts ../arch/x86/dts ../arch/powerpc/dts ../arch/riscv/dts From patchwork Tue Oct 30 12:55:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990813 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ks3k4qpdz9s3T for ; Tue, 30 Oct 2018 23:58:58 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id E80A2C22113; Tue, 30 Oct 2018 12:57:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 8A286C220FF; Tue, 30 Oct 2018 12:57:13 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 40DC6C220DC; Tue, 30 Oct 2018 12:57:11 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id D6798C21F18 for ; Tue, 30 Oct 2018 12:57:10 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2EcAAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBUwQBAQELAYIEgg2MbY5AiAaOIIF6DYRsAoMlIjYLDQEDAQECAQECAgJpHAyFPAZ5EB00ISgOBg4FgyGBagMUAaotiAENghgJAYc3hCaBWD+BEAGCXYMLiAMCimeTey4HAoEOgQQEi0mDHQsYiTqHDiyNS4kvgUoDL4FVMxokgzuCT4MvilpuAYt3AQE X-IPAS-Result: A2EcAAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBUwQBAQELAYIEgg2MbY5AiAaOIIF6DYRsAoMlIjYLDQEDAQECAQECAgJpHAyFPAZ5EB00ISgOBg4FgyGBagMUAaotiAENghgJAYc3hCaBWD+BEAGCXYMLiAMCimeTey4HAoEOgQQEi0mDHQsYiTqHDiyNS4kvgUoDL4FVMxokgzuCT4MvilpuAYt3AQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904628" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:10 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BRAACMVNhb/xBhWMBkHAEBAQQBAQcEAQGBUwUBAQsBg1c6jG2OQIgGjiCBeg2EbAKDRjYLDQEDAQECAQECbRwMhTsGeRAdNCEoDgYOBYMhgWoDFaouiAENghgJAYc3hX4/gRABgl2DC4gDAopnk3suBwKBDoEEBItJgx0LGIk6hw4sjUuJL4FKAy6BVTMaJIM7gk+DL4paPjABi3cBAQ X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525639" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:10 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:09 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:26 +0100 Message-ID: <20181030125553.5230-4-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--2.912600-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Cc: Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v2 03/29] riscv: rename CPU_RISCV_32/64 to match architecture names ARCH_RV32I/64I X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" RISC-V defines the base integer instruction sets as RV32I and RV64I. Rename CPU_RISCV_32 and CPU_RISCV_64 to ARCH_RV32I and ARCH_RV64I to match this convention. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng Reviewed-by: Rick Chen --- Changes in v2: None arch/riscv/Kconfig | 16 ++++++++-------- arch/riscv/lib/setjmp.S | 2 +- configs/ax25-ae350_defconfig | 2 +- configs/qemu-riscv64_defconfig | 2 +- include/config_distro_bootcmd.h | 8 ++++---- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 168ca3de7c..7c76b4d664 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -20,20 +20,20 @@ source "board/AndesTech/ax25-ae350/Kconfig" source "board/emulation/qemu-riscv/Kconfig" choice - prompt "CPU selection" - default CPU_RISCV_32 + prompt "Base ISA" + default ARCH_RV32I -config CPU_RISCV_32 - bool "RISC-V 32-bit" +config ARCH_RV32I + bool "RV32I" select 32BIT help - Choose this option to build an U-Boot for RISCV32 architecture. + Choose this option to target the RV32I base integer instruction set. -config CPU_RISCV_64 - bool "RISC-V 64-bit" +config ARCH_RV64I + bool "RV64I" select 64BIT help - Choose this option to build an U-Boot for RISCV64 architecture. + Choose this option to target the RV64I base integer instruction set. endchoice diff --git a/arch/riscv/lib/setjmp.S b/arch/riscv/lib/setjmp.S index 8f5a6a23aa..72bc9241f6 100644 --- a/arch/riscv/lib/setjmp.S +++ b/arch/riscv/lib/setjmp.S @@ -6,7 +6,7 @@ #include #include -#ifdef CONFIG_CPU_RISCV_64 +#ifdef CONFIG_ARCH_RV64I #define STORE_IDX(reg, idx) sd reg, (idx*8)(a0) #define LOAD_IDX(reg, idx) ld reg, (idx*8)(a0) #else diff --git a/configs/ax25-ae350_defconfig b/configs/ax25-ae350_defconfig index d7c4f40e58..cad82c4213 100644 --- a/configs/ax25-ae350_defconfig +++ b/configs/ax25-ae350_defconfig @@ -1,7 +1,7 @@ CONFIG_RISCV=y CONFIG_SYS_TEXT_BASE=0x00000000 CONFIG_TARGET_AX25_AE350=y -CONFIG_CPU_RISCV_64=y +CONFIG_ARCH_RV64I=y CONFIG_DISTRO_DEFAULTS=y CONFIG_NR_DRAM_BANKS=2 CONFIG_FIT=y diff --git a/configs/qemu-riscv64_defconfig b/configs/qemu-riscv64_defconfig index d6c1a5d646..60b647efe8 100644 --- a/configs/qemu-riscv64_defconfig +++ b/configs/qemu-riscv64_defconfig @@ -1,6 +1,6 @@ CONFIG_RISCV=y CONFIG_TARGET_QEMU_VIRT=y -CONFIG_CPU_RISCV_64=y +CONFIG_ARCH_RV64I=y CONFIG_NR_DRAM_BANKS=1 CONFIG_DISPLAY_CPUINFO=y CONFIG_DISPLAY_BOARDINFO=y diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index 373fee78a9..54186efe7b 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -99,9 +99,9 @@ #define BOOTEFI_NAME "bootia32.efi" #elif defined(CONFIG_X86_RUN_64BIT) #define BOOTEFI_NAME "bootx64.efi" -#elif defined(CONFIG_CPU_RISCV_32) +#elif defined(CONFIG_ARCH_RV32I) #define BOOTEFI_NAME "bootriscv32.efi" -#elif defined(CONFIG_CPU_RISCV_64) +#elif defined(CONFIG_ARCH_RV64I) #define BOOTEFI_NAME "bootriscv64.efi" #endif #endif @@ -257,10 +257,10 @@ #elif defined(__i386__) #define BOOTENV_EFI_PXE_ARCH "0x6" #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00006:UNDI:003000" -#elif defined(CONFIG_CPU_RISCV_32) || ((defined(__riscv) && __riscv_xlen == 32)) +#elif defined(CONFIG_ARCH_RV32I) || ((defined(__riscv) && __riscv_xlen == 32)) #define BOOTENV_EFI_PXE_ARCH "0x19" #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00025:UNDI:003000" -#elif defined(CONFIG_CPU_RISCV_64) || ((defined(__riscv) && __riscv_xlen == 64)) +#elif defined(CONFIG_ARCH_RV64I) || ((defined(__riscv) && __riscv_xlen == 64)) #define BOOTENV_EFI_PXE_ARCH "0x1b" #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00027:UNDI:003000" #elif defined(CONFIG_SANDBOX) From patchwork Tue Oct 30 12:55:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990816 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ks5l3sVqz9s3T for ; Wed, 31 Oct 2018 00:00:42 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 9C605C220F5; Tue, 30 Oct 2018 12:58:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id A7883C22114; Tue, 30 Oct 2018 12:57:18 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A5D43C220DC; Tue, 30 Oct 2018 12:57:11 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id 48F68C21F18 for ; Tue, 30 Oct 2018 12:57:11 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2GxAAC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBVAQBAQsBggSCDYxtlkaJMYZpDYRsAoMlIjcKDQEDAQECAQECAgJpHAyFPAZ5EFEhNgYOBYMhgWoDFAGqLYgBDYIYCQGHN4QmgVg/g26DC4J1hQ4CnmIuBwKBDoEEBItJgx0LGIFDh3eHDiyNS4kvgVkjgVUzGiSDO4V+ilpuAYt3AQE X-IPAS-Result: A2GxAAC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBVAQBAQsBggSCDYxtlkaJMYZpDYRsAoMlIjcKDQEDAQECAQECAgJpHAyFPAZ5EFEhNgYOBYMhgWoDFAGqLYgBDYIYCQGHN4QmgVg/g26DC4J1hQ4CnmIuBwKBDoEEBItJgx0LGIFDh3eHDiyNS4kvgVkjgVUzGiSDO4V+ilpuAYt3AQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904629" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:11 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CoAACMVNhb/xBhWMBkHAEBAQQBAQcEAQGBVAQBAQsBg1c6jG2WRokxhmkNhGwCg0Y3Cg0BAwEBAgEBAm0cDIU7BnkQUSE2Bg4FgyGBagMVqi6IAQ2CGAkBhzeFfj+DboMLgnWFDgKeYi4HAoEOgQQEi0mDHQsYgUOHd4cOLI1LiS+BWSKBVTMaJIM7hX6KWj4wAYt3AQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525641" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:10 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:10 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:27 +0100 Message-ID: <20181030125553.5230-5-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--0.606700-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Subject: [U-Boot] [PATCH v2 04/29] riscv: select CONFIG_PHYS_64BIT on RV64I systems X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" CONFIG_PHYS_64BIT should be enabled on RV64I systems. Select it. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng Reviewed-by: Rick Chen --- Changes in v2: None arch/riscv/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 7c76b4d664..b81e0d990a 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -32,6 +32,7 @@ config ARCH_RV32I config ARCH_RV64I bool "RV64I" select 64BIT + select PHYS_64BIT help Choose this option to target the RV64I base integer instruction set. From patchwork Tue Oct 30 12:55:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990828 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksKZ0RJDz9s2P for ; Wed, 31 Oct 2018 00:10:57 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 2B90EC220DC; Tue, 30 Oct 2018 12:58:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 602C0C2211D; Tue, 30 Oct 2018 12:57:19 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BDFFDC2210A; Tue, 30 Oct 2018 12:57:14 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id E9F53C220E1 for ; Tue, 30 Oct 2018 12:57:11 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2FVAAC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBUwUBAQsBggSCDYxtpGaBeg2EbAKDJSI2Cw0BAwEBAgEBAgICaSiFPAZ5EFFXBg4FgyGCAQGqLYomCQGHN4QmgVg/g3WFeYUOAp8QBwKBDoEEBI5mCxiJOocOlyaBSgMvgVUzGiSDO5BYbgGLdwEB X-IPAS-Result: A2FVAAC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBUwUBAQsBggSCDYxtpGaBeg2EbAKDJSI2Cw0BAwEBAgEBAgICaSiFPAZ5EFFXBg4FgyGCAQGqLYomCQGHN4QmgVg/g3WFeYUOAp8QBwKBDoEEBI5mCxiJOocOlyaBSgMvgVUzGiSDO5BYbgGLdwEB X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904630" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:12 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BQAACMVNhb/xBhWMBkHAEBAQQBAQcEAQGBUwUBAQsBg1c6jG2kZoF6DYRsAoNGNgsNAQMBAQIBAQJtKIU7BnkQUVcGDgWDIYICqi6KJgkBhzeFfj+DdYV5hQ4CnxAHAoEOgQQEjmYLGIk6hw6XJoFKAy6BVTMaJIM7kFg+MAGLdwEB X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525642" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:11 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:10 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:28 +0100 Message-ID: <20181030125553.5230-6-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--1.485500-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Subject: [U-Boot] [PATCH v2 05/29] riscv: add Kconfig entries for the C and A ISA extensions X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add Kconfig entries for the C (compressed instructions) and A (atomic instructions) ISA extensions. Only the C ISA extension is selectable. This matches the configuration in Linux. The Kconfig entries are not used yet. A follow-up patch will select the appropriate compiler flags based on the Kconfig configuration. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng --- Changes in v2: - Replace the description of RISCV_ISA_C with that of the Linux kernel, as suggested by Bin Meng arch/riscv/Kconfig | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index b81e0d990a..0de77a75d7 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -38,6 +38,17 @@ config ARCH_RV64I endchoice +config RISCV_ISA_C + bool "Emit compressed instructions" + default y + help + Adds "C" to the ISA subsets that the toolchain is allowed to emit + when building U-Boot, which results in compressed instructions in the + U-Boot binary. + +config RISCV_ISA_A + def_bool y + config 32BIT bool From patchwork Tue Oct 30 12:55:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990827 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksKS623Bz9s4s for ; Wed, 31 Oct 2018 00:10:51 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id C75C9C220F7; Tue, 30 Oct 2018 12:59:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 90F77C220EF; Tue, 30 Oct 2018 12:57:31 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D79F0C22130; Tue, 30 Oct 2018 12:57:17 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id B0C83C2210C for ; Tue, 30 Oct 2018 12:57:13 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2FoAQC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBUwUBAQsBggRmgSeHQIUtj3ABlHUUgWYNH4ERgzwCgyUiNgsNAQMBAQIBAQICAmkcDIQfXz4GeRBRVwYOBYMhAYIAAaotg3GGNQkBhzeEJoFYP4hmgQiFDgKOdJAcBwKBDoEEBIRVihELGIIehxyHDpNqAYM7gUoFLYFVMxokgzsJghoah2eGNG4Bi3cBAQ X-IPAS-Result: A2FoAQC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBUwUBAQsBggRmgSeHQIUtj3ABlHUUgWYNH4ERgzwCgyUiNgsNAQMBAQIBAQICAmkcDIQfXz4GeRBRVwYOBYMhAYIAAaotg3GGNQkBhzeEJoFYP4hmgQiFDgKOdJAcBwKBDoEEBIRVihELGIIehxyHDpNqAYM7gUoFLYFVMxokgzsJghoah2eGNG4Bi3cBAQ X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904631" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:12 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BRAACMVNhb/xBhWMBkHAEBAQQBAQcEAQGBUwUBAQsBgmptOoxtpGYUgWYNH4RNAoNGNgsNAQMBAQIBAQJtHAyFOwZ5EFFXBg4FgyEBggGqLoomCQGHN4V+P4hmgQiFDgKOdJAcBwKBDoEEBIRVihELGIIehxyHDpcmgUoFLIFVMxokgzsJghoah2eGND4wAYt3AQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525643" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:12 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:11 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:29 +0100 Message-ID: <20181030125553.5230-7-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--10.597300-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Subject: [U-Boot] [PATCH v2 06/29] riscv: set -march and -mabi based on the Kconfig configuration X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Use the new Kconfig entries to construct the ISA string for the -march compiler flag. The -mabi compiler flag is selected based on the base integer instruction set. With this change, the C (compressed instructions) ISA extension is now enabled for all boards with CONFIG_RISCV_ISA_C set. Buildman reports a decrease in binary size of 71590 bytes. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng --- Changes in v2: - Change ISA string construction, as suggested by Bin Meng arch/riscv/Makefile | 20 ++++++++++++++++++++ arch/riscv/config.mk | 4 ---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index 8fb6a889d8..55d7c6550e 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -3,6 +3,26 @@ # Copyright (C) 2017 Andes Technology Corporation. # Rick Chen, Andes Technology Corporation +ifeq ($(CONFIG_ARCH_RV64I),y) + ARCH_BASE = rv64im + ABI = lp64 +endif +ifeq ($(CONFIG_ARCH_RV32I),y) + ARCH_BASE = rv32im + ABI = ilp32 +endif +ifeq ($(CONFIG_RISCV_ISA_A),y) + ARCH_A = a +endif +ifeq ($(CONFIG_RISCV_ISA_C),y) + ARCH_C = c +endif + +ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI) + +PLATFORM_CPPFLAGS += $(ARCH_FLAGS) +CFLAGS_EFI += $(ARCH_FLAGS) + head-y := arch/riscv/cpu/start.o libs-y += arch/riscv/cpu/ diff --git a/arch/riscv/config.mk b/arch/riscv/config.mk index ed9eb0c24c..9088b9ef2c 100644 --- a/arch/riscv/config.mk +++ b/arch/riscv/config.mk @@ -14,16 +14,12 @@ 64bit-emul := elf64lriscv ifdef CONFIG_32BIT -PLATFORM_CPPFLAGS += -march=rv32ima -mabi=ilp32 PLATFORM_LDFLAGS += -m $(32bit-emul) -CFLAGS_EFI += -march=rv32ima -mabi=ilp32 EFI_LDS := elf_riscv32_efi.lds endif ifdef CONFIG_64BIT -PLATFORM_CPPFLAGS += -march=rv64ima -mabi=lp64 PLATFORM_LDFLAGS += -m $(64bit-emul) -CFLAGS_EFI += -march=rv64ima -mabi=lp64 EFI_LDS := elf_riscv64_efi.lds endif From patchwork Tue Oct 30 12:55:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990823 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksHK3XG3z9s2P for ; Wed, 31 Oct 2018 00:09:01 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id F1427C22137; Tue, 30 Oct 2018 12:59:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id B853CC22138; Tue, 30 Oct 2018 12:57:26 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6803DC220E8; Tue, 30 Oct 2018 12:57:17 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id 389C4C22104 for ; Tue, 30 Oct 2018 12:57:13 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2EmAAC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBUQcBAQsBggSCDYwOX6RmgXoNhGwCgyUiNA0NAQMBAQIBAQICAmkohTwGcAkQUVcGDgWDIYIBAaotiiYJAYc3hCaBWD+BEAGCZIR1gQSFDgKfEAcCgQ6BBASOZgsYiTqHDpcmgUM5gVUzGiSDO5BYbgGJKoJNAQE X-IPAS-Result: A2EmAAC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBUQcBAQsBggSCDYwOX6RmgXoNhGwCgyUiNA0NAQMBAQIBAQICAmkohTwGcAkQUVcGDgWDIYIBAaotiiYJAYc3hCaBWD+BEAGCZIR1gQSFDgKfEAcCgQ6BBASOZgsYiTqHDpcmgUM5gVUzGiSDO5BYbgGJKoJNAQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904632" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:13 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AzAACMVNhb/xBhWMBkHQEBBQEHBQGBUQgBCwGDVzqMDl+kZoF6DYRsAoNGNA0NAQMBAQIBAQJtKIU7BnAJEFFXBg4FgyGCAqouiiYJAYc3hX4/gRABgmSEdYEEhQ4CnxAHAoEOgQQEjmYLGIk6hw6XJoFDOIFVMxokgzuQWD4wAYkqgk0BAQ X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525645" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:12 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:12 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:30 +0100 Message-ID: <20181030125553.5230-8-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--2.044300-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Subject: [U-Boot] [PATCH v2 07/29] riscv: add Kconfig entries for the code model X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" RISC-V has two code models, medium low (medlow) and medium any (medany). Medlow limits addressable memory to a single 2 GiB range between the absolute addresses -2 GiB and +2 GiB. Medany limits addressable memory to any single 2 GiB address range. By default, medlow is selected on 32-bit systems and medany on 64-bit systems. This matches the configuration in Linux. The -mcmodel compiler flag is selected according to the Kconfig configuration. Signed-off-by: Lukas Auer --- Changes in v2: - Change ISA string construction, as suggested by Bin Meng arch/riscv/Kconfig | 19 +++++++++++++++++++ arch/riscv/Makefile | 9 ++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 0de77a75d7..371921b412 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -38,6 +38,25 @@ config ARCH_RV64I endchoice +choice + prompt "Code Model" + default CMODEL_MEDLOW if 32BIT + default CMODEL_MEDANY if 64BIT + +config CMODEL_MEDLOW + bool "medium low code model" + help + U-Boot and its statically defined symbols must lie within a single 2 GiB + address range and must lie between absolute addresses -2 GiB and +2 GiB. + +config CMODEL_MEDANY + bool "medium any code model" + help + U-Boot and its statically defined symbols must be within any single 2 GiB + address range. + +endchoice + config RISCV_ISA_C bool "Emit compressed instructions" default y diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index 55d7c6550e..0b80eb8d86 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -17,8 +17,15 @@ endif ifeq ($(CONFIG_RISCV_ISA_C),y) ARCH_C = c endif +ifeq ($(CONFIG_CMODEL_MEDLOW),y) + CMODEL = medlow +endif +ifeq ($(CONFIG_CMODEL_MEDANY),y) + CMODEL = medany +endif -ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI) +ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI) \ + -mcmodel=$(CMODEL) PLATFORM_CPPFLAGS += $(ARCH_FLAGS) CFLAGS_EFI += $(ARCH_FLAGS) From patchwork Tue Oct 30 12:55:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990831 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksLF41q6z9s7W for ; Wed, 31 Oct 2018 00:11:33 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 1BC6FC220F7; Tue, 30 Oct 2018 12:59:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id E2CC5C22131; Tue, 30 Oct 2018 12:57:25 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 443DDC22117; Tue, 30 Oct 2018 12:57:18 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id 4B22EC22114 for ; Tue, 30 Oct 2018 12:57:14 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2HzAAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBVAMBAQELAYIEZoEnh0CFLY9wAYZVkBoNG4EVgzwCgyUiNwoNAQMBAQIBAQICAmkcDIQfXz4GeRBRITYGDgWDIQGBaQMUAaotg3GEEA2CGAkBhzeEJoFYP4EQAYVogXGBBIUOAp5iLgcCgQ6BBASEVYZ0gx0LGIIehxyHDo13hXMBgzuBWSOBVTMaJIM7CYIaGoNBg0VhhjRuAYkqgk0BAQ X-IPAS-Result: A2HzAAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBVAMBAQELAYIEZoEnh0CFLY9wAYZVkBoNG4EVgzwCgyUiNwoNAQMBAQIBAQICAmkcDIQfXz4GeRBRITYGDgWDIQGBaQMUAaotg3GEEA2CGAkBhzeEJoFYP4EQAYVogXGBBIUOAp5iLgcCgQ6BBASEVYZ0gx0LGIIehxyHDo13hXMBgzuBWSOBVTMaJIM7CYIaGoNBg0VhhjRuAYkqgk0BAQ X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904633" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:13 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CoAACMVNhb/xBhWMBkHAEBAQQBAQcEAQGBVAQBAQsBgmptOoxtlkaQGg0bhFECg0Y3Cg0BAwEBAgEBAm0cDIU7BnkQUSE2Bg4FgyEBgWkDFaouiAENghgJAYc3hX4/gRABhWiBcYEEhQ4CnmIuBwKBDoEEBIRVhnSDHQsYgh6HHIcOjXeJL4FZIoFVMxokgzsJghoag0GDRWGGND4wAYkqgk0BAQ X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525651" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:13 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:12 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:31 +0100 Message-ID: <20181030125553.5230-9-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--1.026700-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Subject: [U-Boot] [PATCH v2 08/29] riscv: enable -fdata-sections X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Enable the -fdata-sections compiler option for RISC-V. Buildman reports the binary size decrease from this as 8365.3 bytes. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng Reviewed-by: Rick Chen --- Changes in v2: None arch/riscv/config.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/riscv/config.mk b/arch/riscv/config.mk index 9088b9ef2c..b9487097f6 100644 --- a/arch/riscv/config.mk +++ b/arch/riscv/config.mk @@ -27,7 +27,8 @@ CONFIG_STANDALONE_LOAD_ADDR = 0x00000000 \ -T $(srctree)/examples/standalone/riscv.lds PLATFORM_CPPFLAGS += -ffixed-gp -fpic -PLATFORM_RELFLAGS += -fno-common -gdwarf-2 -ffunction-sections +PLATFORM_RELFLAGS += -fno-common -gdwarf-2 -ffunction-sections \ + -fdata-sections LDFLAGS_u-boot += --gc-sections -static -pie EFI_CRT0 := crt0_riscv_efi.o From patchwork Tue Oct 30 12:55:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990825 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksHv6fbhz9s8J for ; Wed, 31 Oct 2018 00:09:31 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 8E3A3C22129; Tue, 30 Oct 2018 12:58:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 1CCC8C22127; Tue, 30 Oct 2018 12:57:25 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 40E96C22124; Tue, 30 Oct 2018 12:57:18 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id DBACDC220E8 for ; Tue, 30 Oct 2018 12:57:14 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2E5AAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBVAMBAQELAYIEgg2MbaZgDYRsAoMlIjcKDQEDAQECAQECAgJpKIU8BidSEFFXBg4FgyGCAQGpejOKJgkBhzeEJoFYP4EQAY1rAohZgg6UKQcCgQ6BBASOZgsYiTqHDpcmgVkjgVUzGiSDO4ImF44bbgGLdwEB X-IPAS-Result: A2E5AAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBVAMBAQELAYIEgg2MbaZgDYRsAoMlIjcKDQEDAQECAQECAgJpKIU8BidSEFFXBg4FgyGCAQGpejOKJgkBhzeEJoFYP4EQAY1rAohZgg6UKQcCgQ6BBASOZgsYiTqHDpcmgVkjgVUzGiSDO4ImF44bbgGLdwEB X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904634" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:14 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0ClAACMVNhb/xBhWMBkHAEBAQQBAQcEAQGBVAQBAQsBg1c6jG2mYA2EbAKDRjcKDQEDAQECAQECbSiFOwYnUhBRVwYOBYMhggKpezOKJgkBhzeFfj+BEAGNawKIWYIOlCkHAoEOgQQEjmYLGIk6hw6XJoFZIoFVMxokgzuCJheOGz4wAYt3AQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525652" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:14 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:13 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:32 +0100 Message-ID: <20181030125553.5230-10-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--4.100700-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Cc: Greentime Hu Subject: [U-Boot] [PATCH v2 09/29] riscv: fix use of incorrectly sized variables X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The RISC-V arch incorrectly uses 32-bit instead of 64-bit variables in several places. Fix this. In addition, BITS_PER_LONG is set to 64 on RV64I systems. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng --- Changes in v2: - Remove 0-padding in the format string to avoid printing 16 digits on RV32I systems arch/riscv/include/asm/io.h | 6 +++--- arch/riscv/include/asm/posix_types.h | 6 +++--- arch/riscv/include/asm/types.h | 4 ++++ arch/riscv/lib/interrupts.c | 10 +++++----- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/arch/riscv/include/asm/io.h b/arch/riscv/include/asm/io.h index f4a76d8720..472814a13e 100644 --- a/arch/riscv/include/asm/io.h +++ b/arch/riscv/include/asm/io.h @@ -74,12 +74,12 @@ static inline phys_addr_t virt_to_phys(void *vaddr) #define __arch_getb(a) (*(unsigned char *)(a)) #define __arch_getw(a) (*(unsigned short *)(a)) #define __arch_getl(a) (*(unsigned int *)(a)) -#define __arch_getq(a) (*(unsigned long *)(a)) +#define __arch_getq(a) (*(unsigned long long *)(a)) #define __arch_putb(v, a) (*(unsigned char *)(a) = (v)) #define __arch_putw(v, a) (*(unsigned short *)(a) = (v)) #define __arch_putl(v, a) (*(unsigned int *)(a) = (v)) -#define __arch_putq(v, a) (*(unsigned long *)(a) = (v)) +#define __arch_putq(v, a) (*(unsigned long long *)(a) = (v)) #define __raw_writeb(v, a) __arch_putb(v, a) #define __raw_writew(v, a) __arch_putw(v, a) @@ -152,7 +152,7 @@ static inline u32 readl(const volatile void __iomem *addr) static inline u64 readq(const volatile void __iomem *addr) { - u32 val; + u64 val; val = __arch_getq(addr); __iormb(); diff --git a/arch/riscv/include/asm/posix_types.h b/arch/riscv/include/asm/posix_types.h index 7438dbeb03..0fc052082a 100644 --- a/arch/riscv/include/asm/posix_types.h +++ b/arch/riscv/include/asm/posix_types.h @@ -37,10 +37,10 @@ typedef unsigned short __kernel_gid_t; #ifdef __GNUC__ typedef __SIZE_TYPE__ __kernel_size_t; #else -typedef unsigned int __kernel_size_t; +typedef unsigned long __kernel_size_t; #endif -typedef int __kernel_ssize_t; -typedef int __kernel_ptrdiff_t; +typedef long __kernel_ssize_t; +typedef long __kernel_ptrdiff_t; typedef long __kernel_time_t; typedef long __kernel_suseconds_t; typedef long __kernel_clock_t; diff --git a/arch/riscv/include/asm/types.h b/arch/riscv/include/asm/types.h index bd8627196d..403cf9a48f 100644 --- a/arch/riscv/include/asm/types.h +++ b/arch/riscv/include/asm/types.h @@ -21,7 +21,11 @@ typedef unsigned short umode_t; */ #ifdef __KERNEL__ +#ifdef CONFIG_ARCH_RV64I +#define BITS_PER_LONG 64 +#else #define BITS_PER_LONG 32 +#endif #include diff --git a/arch/riscv/lib/interrupts.c b/arch/riscv/lib/interrupts.c index 0a0995a7af..62a16b4da9 100644 --- a/arch/riscv/lib/interrupts.c +++ b/arch/riscv/lib/interrupts.c @@ -12,7 +12,7 @@ #include #include -static void _exit_trap(int code, uint epc, struct pt_regs *regs); +static void _exit_trap(ulong code, ulong epc, struct pt_regs *regs); int interrupt_init(void) { @@ -34,9 +34,9 @@ int disable_interrupts(void) return 0; } -uint handle_trap(uint mcause, uint epc, struct pt_regs *regs) +ulong handle_trap(ulong mcause, ulong epc, struct pt_regs *regs) { - uint is_int; + ulong is_int; is_int = (mcause & MCAUSE_INT); if ((is_int) && ((mcause & MCAUSE_CAUSE) == IRQ_M_EXT)) @@ -60,7 +60,7 @@ __attribute__((weak)) void timer_interrupt(struct pt_regs *regs) { } -static void _exit_trap(int code, uint epc, struct pt_regs *regs) +static void _exit_trap(ulong code, ulong epc, struct pt_regs *regs) { static const char * const exception_code[] = { "Instruction address misaligned", @@ -70,6 +70,6 @@ static void _exit_trap(int code, uint epc, struct pt_regs *regs) "Load address misaligned" }; - printf("exception code: %d , %s , epc %08x , ra %08lx\n", + printf("exception code: %ld , %s , epc %lx , ra %lx\n", code, exception_code[code], epc, regs->ra); } From patchwork Tue Oct 30 12:55:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990833 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksLr4HyVz9s7W for ; Wed, 31 Oct 2018 00:12:04 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id EE75EC22122; Tue, 30 Oct 2018 13:03:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 098DBC22163; Tue, 30 Oct 2018 12:58:06 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2F563C2215B; Tue, 30 Oct 2018 12:57:20 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id 19833C22100 for ; Tue, 30 Oct 2018 12:57:16 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2FSAAC/VNhb/xoBYJlcCBsBAQEBAwEBAQcDAQEBgVIFAQEBCwGCBGaBJ4dAhS2PcAGGVY4gFIFmDRuBFYM8AoMlIjUMDQEDAQECAQECAgJpHAyEH18+BnkQUSE2Bg4FgyEBgWkDFAGqLYNxhBANghgJAYc3hCaBWD+BEAGFaIFhDBaGAAKeYi4HAoEOgQQEhFWGdIMdCxiJOocOjXeFcwGDO4FFATaBVTMaJIM7CYIdF4FxgVCKWm4Bi3cBAQ X-IPAS-Result: A2FSAAC/VNhb/xoBYJlcCBsBAQEBAwEBAQcDAQEBgVIFAQEBCwGCBGaBJ4dAhS2PcAGGVY4gFIFmDRuBFYM8AoMlIjUMDQEDAQECAQECAgJpHAyEH18+BnkQUSE2Bg4FgyEBgWkDFAGqLYNxhBANghgJAYc3hCaBWD+BEAGFaIFhDBaGAAKeYi4HAoEOgQQEhFWGdIMdCxiJOocOjXeFcwGDO4FFATaBVTMaJIM7CYIdF4FxgVCKWm4Bi3cBAQ X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904635" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:15 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0A5AACMVNhb/xBhWMBcCBwBAQEEAQEHBAEBgVIGAQELAYJqbTqMbZZGjiAUgWYNG4RRAoNGNQwNAQMBAQIBAQJtHAyFOwZ5EFEhNgYOBYMhAYFpAxWqLogBDYIYCQGHN4V+P4EQAYVogWEMFoYAAp5iLgcCgQ6BBASEVYZ0gx0LGIk6hw6Nd4kvgUUBNYFVMxokgzsJgh0XgXGBUIpaPjABi3cBAQ X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525655" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:15 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:14 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:33 +0100 Message-ID: <20181030125553.5230-11-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--1.995600-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Cc: Greentime Hu Subject: [U-Boot] [PATCH v2 10/29] riscv: make use of the barrier functions from Linux X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Replace the barrier functions in arch/riscv/include/asm/io.h with those defined in barrier.h, which is imported from Linux. This version is modified to remove the include statement of asm-generic/barrier.h, which is not available in U-Boot or required. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng Reviewed-by: Rick Chen --- Changes in v2: None arch/riscv/include/asm/barrier.h | 67 ++++++++++++++++++++++++++++++++ arch/riscv/include/asm/io.h | 11 ++---- 2 files changed, 71 insertions(+), 7 deletions(-) create mode 100644 arch/riscv/include/asm/barrier.h diff --git a/arch/riscv/include/asm/barrier.h b/arch/riscv/include/asm/barrier.h new file mode 100644 index 0000000000..a3f60a8458 --- /dev/null +++ b/arch/riscv/include/asm/barrier.h @@ -0,0 +1,67 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2012 ARM Ltd. + * Copyright (C) 2013 Regents of the University of California + * Copyright (C) 2017 SiFive + * + * Taken from Linux arch/riscv/include/asm/barrier.h, which is based on + * arch/arm/include/asm/barrier.h + */ + +#ifndef _ASM_RISCV_BARRIER_H +#define _ASM_RISCV_BARRIER_H + +#ifndef __ASSEMBLY__ + +#define nop() __asm__ __volatile__ ("nop") + +#define RISCV_FENCE(p, s) \ + __asm__ __volatile__ ("fence " #p "," #s : : : "memory") + +/* These barriers need to enforce ordering on both devices or memory. */ +#define mb() RISCV_FENCE(iorw,iorw) +#define rmb() RISCV_FENCE(ir,ir) +#define wmb() RISCV_FENCE(ow,ow) + +/* These barriers do not need to enforce ordering on devices, just memory. */ +#define __smp_mb() RISCV_FENCE(rw,rw) +#define __smp_rmb() RISCV_FENCE(r,r) +#define __smp_wmb() RISCV_FENCE(w,w) + +#define __smp_store_release(p, v) \ +do { \ + compiletime_assert_atomic_type(*p); \ + RISCV_FENCE(rw,w); \ + WRITE_ONCE(*p, v); \ +} while (0) + +#define __smp_load_acquire(p) \ +({ \ + typeof(*p) ___p1 = READ_ONCE(*p); \ + compiletime_assert_atomic_type(*p); \ + RISCV_FENCE(r,rw); \ + ___p1; \ +}) + +/* + * This is a very specific barrier: it's currently only used in two places in + * the kernel, both in the scheduler. See include/linux/spinlock.h for the two + * orderings it guarantees, but the "critical section is RCsc" guarantee + * mandates a barrier on RISC-V. The sequence looks like: + * + * lr.aq lock + * sc lock <= LOCKED + * smp_mb__after_spinlock() + * // critical section + * lr lock + * sc.rl lock <= UNLOCKED + * + * The AQ/RL pair provides a RCpc critical section, but there's not really any + * way we can take advantage of that here because the ordering is only enforced + * on that one lock. Thus, we're just doing a full fence. + */ +#define smp_mb__after_spinlock() RISCV_FENCE(rw,rw) + +#endif /* __ASSEMBLY__ */ + +#endif /* _ASM_RISCV_BARRIER_H */ diff --git a/arch/riscv/include/asm/io.h b/arch/riscv/include/asm/io.h index 472814a13e..d01ed5bc9f 100644 --- a/arch/riscv/include/asm/io.h +++ b/arch/riscv/include/asm/io.h @@ -10,6 +10,7 @@ #ifdef __KERNEL__ #include +#include #include static inline void sync(void) @@ -91,13 +92,9 @@ static inline phys_addr_t virt_to_phys(void *vaddr) #define __raw_readl(a) __arch_getl(a) #define __raw_readq(a) __arch_getq(a) -/* - * TODO: The kernel offers some more advanced versions of barriers, it might - * have some advantages to use them instead of the simple one here. - */ -#define dmb() __asm__ __volatile__ ("" : : : "memory") -#define __iormb() dmb() -#define __iowmb() dmb() +#define dmb() mb() +#define __iormb() rmb() +#define __iowmb() wmb() static inline void writeb(u8 val, volatile void __iomem *addr) { From patchwork Tue Oct 30 12:55:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990834 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksMt1y8jz9s8r for ; Wed, 31 Oct 2018 00:12:58 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id BE556C22132; Tue, 30 Oct 2018 13:02:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 352B9C22141; Tue, 30 Oct 2018 12:57:56 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 66490C2214F; Tue, 30 Oct 2018 12:57:20 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id 74F99C22111 for ; Tue, 30 Oct 2018 12:57:16 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2GxAAC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBVAQBAQsBggSCDYxtlkaQGg2EbAKDJSI3Cg0BAwEBAgEBAgICaRwMhTwGeRBRITYGDgWDIYFqAxQBqi2IAQ2CGAkBhzeEJoFYP4EQAYVognWFDgKIfZVlLgcCgQ6BBASLSYMdCxiBUodoK4ZjjXeJL4FZI4FVMxokgzuCJheDQYpabgGLdwEB X-IPAS-Result: A2GxAAC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBVAQBAQsBggSCDYxtlkaQGg2EbAKDJSI3Cg0BAwEBAgEBAgICaRwMhTwGeRBRITYGDgWDIYFqAxQBqi2IAQ2CGAkBhzeEJoFYP4EQAYVognWFDgKIfZVlLgcCgQ6BBASLSYMdCxiBUodoK4ZjjXeJL4FZI4FVMxokgzuCJheDQYpabgGLdwEB X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904637" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:16 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CnAACMVNhb/xBhWMBkHAEBAQQBAQcEAQGBVAQBAQsBg1c6jG2WRpAaDYRsAoNGNwoNAQMBAQIBAQJtHAyFOwZ5EFEhNgYOBYMhgWoDFaouiAENghgJAYc3hX4/gRABhWiCdYUOAoh9lWUuBwKBDoEEBItJgx0LGIFSh2grhmONd4kvgVkigVUzGiSDO4ImF4NBilo+MAGLdwEB X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525658" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:15 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:15 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:34 +0100 Message-ID: <20181030125553.5230-12-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--3.473100-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Cc: Greentime Hu Subject: [U-Boot] [PATCH v2 11/29] riscv: do not reimplement generic io functions X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" RISC-V U-Boot reimplements the generic io functions from asm-generic/io.h. Remove the redundant implementation and include the generic io.h instead. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng Reviewed-by: Rick Chen --- Changes in v2: None arch/riscv/include/asm/io.h | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/arch/riscv/include/asm/io.h b/arch/riscv/include/asm/io.h index d01ed5bc9f..acf5a96449 100644 --- a/arch/riscv/include/asm/io.h +++ b/arch/riscv/include/asm/io.h @@ -17,16 +17,6 @@ static inline void sync(void) { } -/* - * Given a physical address and a length, return a virtual address - * that can be used to access the memory range with the caching - * properties specified by "flags". - */ -#define MAP_NOCACHE (0) -#define MAP_WRCOMBINE (0) -#define MAP_WRBACK (0) -#define MAP_WRTHROUGH (0) - #ifdef CONFIG_ARCH_MAP_SYSMEM static inline void *map_sysmem(phys_addr_t paddr, unsigned long len) { @@ -49,24 +39,6 @@ static inline phys_addr_t map_to_sysmem(const void *ptr) } #endif -static inline void * -map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) -{ - return (void *)paddr; -} - -/* - * Take down a mapping set up by map_physmem(). - */ -static inline void unmap_physmem(void *vaddr, unsigned long flags) -{ -} - -static inline phys_addr_t virt_to_phys(void *vaddr) -{ - return (phys_addr_t)(vaddr); -} - /* * Generic virtual read/write. Note that we don't support half-word * read/writes. We define __arch_*[bl] here, and leave __arch_*w @@ -484,4 +456,7 @@ out: #endif /* __mem_isa */ #endif /* __KERNEL__ */ + +#include + #endif /* __ASM_RISCV_IO_H */ From patchwork Tue Oct 30 12:55:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990818 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ks7T6nq5z9s8J for ; Wed, 31 Oct 2018 00:02:13 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 0B63EC21F18; Tue, 30 Oct 2018 13:00:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id F1A81C22108; Tue, 30 Oct 2018 12:57:46 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 28E86C220E2; Tue, 30 Oct 2018 12:57:21 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id 3B000C220F7 for ; Tue, 30 Oct 2018 12:57:17 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2HnAgC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBZYIFgg2MbZZGkBoNhGwCgyUiOBYBAwEBAgEBAgICaRwMhTwGeRAdNCEoDgYOBYMhgWoDFAGqLYgBDYIYCQGHN4QmgVg/gRABhWiBcYEEhQ4CnmIuBwKBDoEEBItJgx0LGIk6hw6Nd4kvgVoigVUzGiRPgmyCJheDQYpabgGJKoJNAQE X-IPAS-Result: A2HnAgC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBZYIFgg2MbZZGkBoNhGwCgyUiOBYBAwEBAgEBAgICaRwMhTwGeRAdNCEoDgYOBYMhgWoDFAGqLYgBDYIYCQGHN4QmgVg/gRABhWiBcYEEhQ4CnmIuBwKBDoEEBItJgx0LGIk6hw6Nd4kvgVoigVUzGiRPgmyCJheDQYpabgGJKoJNAQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904638" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:17 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DBAgCMVNhb/xBhWMBkHAEBAQQBAQcEAQGBZYNYOoxtlkaQGg2EbAKDRjgWAQMBAQIBAQJtHAyFOwZ5EB00ISgOBg4FgyGBagMVqi6IAQ2CGAkBhzeFfj+BEAGFaIFxgQSFDgKeYi4HAoEOgQQEi0mDHQsYiTqHDo13iS+BWiGBVTMaJE+CbIImF4NBilo+MAGJKoJNAQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525661" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:16 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:16 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:35 +0100 Message-ID: <20181030125553.5230-13-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--5.618700-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Cc: Greentime Hu Subject: [U-Boot] [PATCH v2 12/29] riscv: complete the list of exception codes X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Only the first four exception codes are defined. Add the missing exception codes from the definition in RISC-V Privileged Architecture Version 1.10. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng Reviewed-by: Rick Chen --- Changes in v2: None arch/riscv/lib/interrupts.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/riscv/lib/interrupts.c b/arch/riscv/lib/interrupts.c index 62a16b4da9..6a12818c2b 100644 --- a/arch/riscv/lib/interrupts.c +++ b/arch/riscv/lib/interrupts.c @@ -67,7 +67,18 @@ static void _exit_trap(ulong code, ulong epc, struct pt_regs *regs) "Instruction access fault", "Illegal instruction", "Breakpoint", - "Load address misaligned" + "Load address misaligned", + "Load access fault", + "Store/AMO address misaligned", + "Store/AMO access fault", + "Environment call from U-mode", + "Environment call from S-mode", + "Reserved", + "Environment call from M-mode", + "Instruction page fault", + "Load page fault", + "Reserved", + "Store/AMO page fault", }; printf("exception code: %ld , %s , epc %lx , ra %lx\n", From patchwork Tue Oct 30 12:55:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990836 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksN66Kz5z9s9G for ; Wed, 31 Oct 2018 00:13:10 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 49AF1C22147; Tue, 30 Oct 2018 13:01:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 15F43C22128; Tue, 30 Oct 2018 12:57:52 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 81631C220F5; Tue, 30 Oct 2018 12:57:21 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id CFDE1C22116 for ; Tue, 30 Oct 2018 12:57:17 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2GxAAC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBVAQBAQsBggSCDYxtlkaQGg2EbAKDJSI3Cg0BAwEBAgEBAgICaRwMhTwGJ1IQUSE2Bg4FgyGBagMUAal6M4gBDYIYCQGHN4QmgVg/hnmCdYUOAp5iLgcCgQ6BBASLSYMdCxiJOocOjXeJL4FZI4FVMxokgzuCJheDQYpabgGLdwEB X-IPAS-Result: A2GxAAC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBVAQBAQsBggSCDYxtlkaQGg2EbAKDJSI3Cg0BAwEBAgEBAgICaRwMhTwGJ1IQUSE2Bg4FgyGBagMUAal6M4gBDYIYCQGHN4QmgVg/hnmCdYUOAp5iLgcCgQ6BBASLSYMdCxiJOocOjXeJL4FZI4FVMxokgzuCJheDQYpabgGLdwEB X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904639" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:17 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CnAACMVNhb/xBhWMBkHAEBAQQBAQcEAQGBVAQBAQsBg1c6jG2WRpAaDYRsAoNGNwoNAQMBAQIBAQJtHAyFOwYnUhBRITYGDgWDIYFqAxWpezOIAQ2CGAkBhzeFfj+GeYJ1hQ4CnmIuBwKBDoEEBItJgx0LGIk6hw6Nd4kvgVkigVUzGiSDO4ImF4NBilo+MAGLdwEB X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525663" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:17 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:16 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:36 +0100 Message-ID: <20181030125553.5230-14-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--8.064600-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Cc: Greentime Hu Subject: [U-Boot] [PATCH v2 13/29] riscv: treat undefined exception codes as reserved X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Undefined exception codes currently lead to an out-of-bounds array access. Prevent this by treating undefined exception codes as "reserved". Signed-off-by: Lukas Auer Reviewed-by: Bin Meng Reviewed-by: Rick Chen --- Changes in v2: None arch/riscv/lib/interrupts.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/riscv/lib/interrupts.c b/arch/riscv/lib/interrupts.c index 6a12818c2b..d0d8de500e 100644 --- a/arch/riscv/lib/interrupts.c +++ b/arch/riscv/lib/interrupts.c @@ -81,6 +81,10 @@ static void _exit_trap(ulong code, ulong epc, struct pt_regs *regs) "Store/AMO page fault", }; - printf("exception code: %ld , %s , epc %lx , ra %lx\n", - code, exception_code[code], epc, regs->ra); + if (code < ARRAY_SIZE(exception_code)) { + printf("exception code: %ld , %s , epc %lx , ra %lx\n", + code, exception_code[code], epc, regs->ra); + } else { + printf("Reserved\n"); + } } From patchwork Tue Oct 30 12:55:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990822 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksG81jWnz9s4s for ; Wed, 31 Oct 2018 00:07:55 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 56836C2211B; Tue, 30 Oct 2018 13:04:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 2C6FBC22175; Tue, 30 Oct 2018 12:58:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BE16DC22170; Tue, 30 Oct 2018 12:57:21 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id 64925C2210C for ; Tue, 30 Oct 2018 12:57:18 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2HnAgC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBZYIFgg2MbZZGkBoNhGwCgyUiOBYBAwEBAgEBAgICaRwMhTwGeRBRITYGDgWDIYFqAxQBqi2IAQ2CGAkBhzeEJoFYP4Z5gnWFDgKeYi4HAoEOgQQEi0mDHQsYgUOHd4cOjXeJL4FaIoFVMxokgzuCJheDQYpabgGLdwEB X-IPAS-Result: A2HnAgC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBZYIFgg2MbZZGkBoNhGwCgyUiOBYBAwEBAgEBAgICaRwMhTwGeRBRITYGDgWDIYFqAxQBqi2IAQ2CGAkBhzeEJoFYP4Z5gnWFDgKeYi4HAoEOgQQEi0mDHQsYgUOHd4cOjXeJL4FaIoFVMxokgzuCJheDQYpabgGLdwEB X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904640" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:18 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DBAgCMVNhb/xBhWMBkHAEBAQQBAQcEAQGBZYNYOoxtlkaQGg2EbAKDRjgWAQMBAQIBAQJtHAyFOwZ5EFEhNgYOBYMhgWoDFaouiAENghgJAYc3hX4/hnmCdYUOAp5iLgcCgQ6BBASLSYMdCxiBQ4d3hw6Nd4kvgVohgVUzGiSDO4ImF4NBilo+MAGLdwEB X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525664" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:17 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:17 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:37 +0100 Message-ID: <20181030125553.5230-15-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--2.273000-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Cc: Greentime Hu Subject: [U-Boot] [PATCH v2 14/29] riscv: hang on unhandled exceptions X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Hang on unhandled exceptions to prevent execution in a faulty state. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng Reviewed-by: Rick Chen --- Changes in v2: None arch/riscv/lib/interrupts.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/riscv/lib/interrupts.c b/arch/riscv/lib/interrupts.c index d0d8de500e..903a1c4cd5 100644 --- a/arch/riscv/lib/interrupts.c +++ b/arch/riscv/lib/interrupts.c @@ -87,4 +87,6 @@ static void _exit_trap(ulong code, ulong epc, struct pt_regs *regs) } else { printf("Reserved\n"); } + + hang(); } From patchwork Tue Oct 30 12:55:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990832 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksLp5rHDz9s7T for ; Wed, 31 Oct 2018 00:12:02 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 5EF1CC220E5; Tue, 30 Oct 2018 13:04:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 681B5C22111; Tue, 30 Oct 2018 12:58:17 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0A123C22170; Tue, 30 Oct 2018 12:57:23 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id 356D6C2211A for ; Tue, 30 Oct 2018 12:57:19 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2H4AAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBZYIFgg2MbZZGiTGGaQ2BR4MlAoMlIjgWAQMBAQIBAQICAmkcDIU8BnkQUSE2Bg4FgyGBagMUAaotiAENghgJAYc3hCaBWD+BEAGFaIJ1hQ4CnmIuBwKBDoEEBItJgx0LGIk6hw4sjUuJL4FaIoFVMxokgzuCJheDQYpabgGLdwEB X-IPAS-Result: A2H4AAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBZYIFgg2MbZZGiTGGaQ2BR4MlAoMlIjgWAQMBAQIBAQICAmkcDIU8BnkQUSE2Bg4FgyGBagMUAaotiAENghgJAYc3hCaBWD+BEAGFaIJ1hQ4CnmIuBwKBDoEEBItJgx0LGIk6hw4sjUuJL4FaIoFVMxokgzuCJheDQYpabgGLdwEB X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904641" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:19 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0APAwCMVNhb/xBhWMBkHAEBAQQBAQcEAQGBZYNYOoxtlkaJMYZpDYFHgyUCg0Y4FgEDAQECAQECbRwMhTsGeRBRITYGDgWDIYFqAxWqLogBDYIYCQGHN4V+P4EQAYVognWFDgKeYi4HAoEOgQQEi0mDHQsYiTqHDiyNS4kvgVohgVUzGiSDO4ImF4NBilo+MAGLdwEB X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525666" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:18 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:17 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:38 +0100 Message-ID: <20181030125553.5230-16-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No-0.872800-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Cc: Greentime Hu Subject: [U-Boot] [PATCH v2 15/29] riscv: implement the invalidate_icache_* functions X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Implement the functions invalidate_icache_range() and invalidate_icache_all(). RISC-V does not have instructions for explicit cache-control. The functions in this patch are implemented with the memory ordering instruction for synchronizing the instruction and data streams. This may be implemented as a cache flush or invalidate on simple processors, others may only invalidate the relevant cache lines. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng Reviewed-by: Rick Chen --- Changes in v2: None arch/riscv/lib/cache.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/riscv/lib/cache.c b/arch/riscv/lib/cache.c index 1d67c49c2c..d642a38a07 100644 --- a/arch/riscv/lib/cache.c +++ b/arch/riscv/lib/cache.c @@ -12,6 +12,16 @@ void flush_dcache_range(unsigned long start, unsigned long end) void invalidate_icache_range(unsigned long start, unsigned long end) { + /* + * RISC-V does not have an instruction for invalidating parts of the + * instruction cache. Invalidate all of it instead. + */ + invalidate_icache_all(); +} + +void invalidate_icache_all(void) +{ + asm volatile ("fence.i" ::: "memory"); } void invalidate_dcache_range(unsigned long start, unsigned long end) From patchwork Tue Oct 30 12:55:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990826 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksKP5vztz9s2P for ; Wed, 31 Oct 2018 00:10:48 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 4E3BCC22108; Tue, 30 Oct 2018 13:03:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 1FCA0C2215D; Tue, 30 Oct 2018 12:58:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 66FE6C22132; Tue, 30 Oct 2018 12:57:23 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id 1A2ABC22105 for ; Tue, 30 Oct 2018 12:57:20 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2H0AAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBZYIFgg2MbaZgDYRsAoMlIjgWAQMBAQIBAQICAmkohTwGJ1IQUVcGDgWDIYIBAal6M4omCQGHN4QmgVg/gRABiF2FDgKKZ5QpBwKBDoEEBI5mCxiJOocOlyaBWiKBVTMaJIM7giYXjhtuAYt3AQE X-IPAS-Result: A2H0AAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBZYIFgg2MbaZgDYRsAoMlIjgWAQMBAQIBAQICAmkohTwGJ1IQUVcGDgWDIYIBAal6M4omCQGHN4QmgVg/gRABiF2FDgKKZ5QpBwKBDoEEBI5mCxiJOocOlyaBWiKBVTMaJIM7giYXjhtuAYt3AQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904642" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:20 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0C5AgCMVNhb/xBhWMBkHAEBAQQBAQcEAQGBZYNYOoxtpmANhGwCg0Y4FgEDAQECAQECbSiFOwYnUhBRVwYOBYMhggKpezOKJgkBhzeFfj+BEAGIXYUOAopnlCkHAoEOgQQEjmYLGIk6hw6XJoFaIYFVMxokgzuCJheOGz4wAYt3AQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525672" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:19 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:18 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:39 +0100 Message-ID: <20181030125553.5230-17-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--0.136300-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Cc: Alexander Graf , Greentime Hu Subject: [U-Boot] [PATCH v2 16/29] riscv: invalidate the instruction cache before jumping to Linux X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" RISC-V does not guarantee that stores to instruction memory are visible to instruction fetches (i.e. incoherent instruction caches). Invalidate the instruction cache to ensure the kernel function pointer points to the correct memory location. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng --- Changes in v2: - Clarify reasoning behind patch in commit message arch/riscv/lib/bootm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c index 2b5ccce933..c1cf618806 100644 --- a/arch/riscv/lib/bootm.c +++ b/arch/riscv/lib/bootm.c @@ -40,6 +40,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) return 1; kernel = (void (*)(ulong, void *))images->ep; + invalidate_icache_all(); bootstage_mark(BOOTSTAGE_ID_RUN_OS); From patchwork Tue Oct 30 12:55:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990821 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksCv2G6Rz9s8J for ; Wed, 31 Oct 2018 00:06:03 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id D746CC22111; Tue, 30 Oct 2018 13:02:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id E50A7C2210D; Tue, 30 Oct 2018 12:58:00 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E217AC2211A; Tue, 30 Oct 2018 12:57:24 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id 0A305C2211C for ; Tue, 30 Oct 2018 12:57:21 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2HnAgC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBZYIFgg2MbZZGkBoNhGwCgyUiOBYBAwEBAgEBAgICaRwMhTwGeRBRITYGDgWDIYFqAxQBqi2IAQ2CGAkBhzeEJoFYP4ERhWiIAwKIfZVlLgcCgQ6BBASLSYMdCxiBUodohw6JOYQ+iS+BWiKBVTMaJIM7giYXg0GKWm4Bi3cBAQ X-IPAS-Result: A2HnAgC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBZYIFgg2MbZZGkBoNhGwCgyUiOBYBAwEBAgEBAgICaRwMhTwGeRBRITYGDgWDIYFqAxQBqi2IAQ2CGAkBhzeEJoFYP4ERhWiIAwKIfZVlLgcCgQ6BBASLSYMdCxiBUodohw6JOYQ+iS+BWiKBVTMaJIM7giYXg0GKWm4Bi3cBAQ X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904643" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:20 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DBAgCMVNhb/xBhWMBkHAEBAQQBAQcEAQGBZYNYOoxtlkaQGg2EbAKDRjgWAQMBAQIBAQJtHAyFOwZ5EFEhNgYOBYMhgWoDFaouiAENghgJAYc3hX4/gRGFaIgDAoh9lWUuBwKBDoEEBItJgx0LGIFSh2iHDok5hD6JL4FaIYFVMxokgzuCJheDQYpaPjABi3cBAQ X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525677" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:20 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:19 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:40 +0100 Message-ID: <20181030125553.5230-18-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--9.577400-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Cc: Greentime Hu Subject: [U-Boot] [PATCH v2 17/29] riscv: fix inconsistent use of spaces and tabs in start.S X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" start.S uses both tabs and spaces after instructions. Fix this by only using tabs after instructions. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng Reviewed-by: Rick Chen --- Changes in v2: None arch/riscv/cpu/start.S | 322 ++++++++++++++++++++--------------------- 1 file changed, 161 insertions(+), 161 deletions(-) diff --git a/arch/riscv/cpu/start.S b/arch/riscv/cpu/start.S index 7cd7755190..bd5904500c 100644 --- a/arch/riscv/cpu/start.S +++ b/arch/riscv/cpu/start.S @@ -16,56 +16,56 @@ #include #ifdef CONFIG_32BIT -#define LREG lw -#define SREG sw -#define REGBYTES 4 +#define LREG lw +#define SREG sw +#define REGBYTES 4 #define RELOC_TYPE R_RISCV_32 #define SYM_INDEX 0x8 #define SYM_SIZE 0x10 #else -#define LREG ld -#define SREG sd -#define REGBYTES 8 +#define LREG ld +#define SREG sd +#define REGBYTES 8 #define RELOC_TYPE R_RISCV_64 #define SYM_INDEX 0x20 #define SYM_SIZE 0x18 #endif -.section .text +.section .text .globl _start _start: - j handle_reset + j handle_reset nmi_vector: - j nmi_vector + j nmi_vector trap_vector: - j trap_entry + j trap_entry .global trap_entry handle_reset: - li t0, CONFIG_SYS_SDRAM_BASE - SREG a2, 0(t0) - la t0, trap_entry - csrw mtvec, t0 - csrwi mstatus, 0 - csrwi mie, 0 + li t0, CONFIG_SYS_SDRAM_BASE + SREG a2, 0(t0) + la t0, trap_entry + csrw mtvec, t0 + csrwi mstatus, 0 + csrwi mie, 0 /* * Do CPU critical regs init only at reboot, * not when booting from ram */ #ifdef CONFIG_INIT_CRITICAL - jal cpu_init_crit /* Do CPU critical regs init */ + jal cpu_init_crit /* Do CPU critical regs init */ #endif /* * Set stackpointer in internal/ex RAM to call board_init_f */ call_board_init_f: - li t0, -16 - li t1, CONFIG_SYS_INIT_SP_ADDR - and sp, t1, t0 /* force 16 byte alignment */ + li t0, -16 + li t1, CONFIG_SYS_INIT_SP_ADDR + and sp, t1, t0 /* force 16 byte alignment */ #ifdef CONFIG_DEBUG_UART jal debug_uart_init @@ -77,9 +77,9 @@ call_board_init_f_0: mv sp, a0 jal board_init_f_init_reserve - mv a0, zero /* a0 <-- boot_flags = 0 */ - la t5, board_init_f - jr t5 /* jump to board_init_f() */ + mv a0, zero /* a0 <-- boot_flags = 0 */ + la t5, board_init_f + jr t5 /* jump to board_init_f() */ /* * void relocate_code (addr_sp, gd, addr_moni) @@ -90,200 +90,200 @@ call_board_init_f_0: */ .globl relocate_code relocate_code: - mv s2, a0 /* save addr_sp */ - mv s3, a1 /* save addr of gd */ - mv s4, a2 /* save addr of destination */ + mv s2, a0 /* save addr_sp */ + mv s3, a1 /* save addr of gd */ + mv s4, a2 /* save addr of destination */ /* *Set up the stack */ stack_setup: - mv sp, s2 - la t0, _start - sub t6, s4, t0 /* t6 <- relocation offset */ - beq t0, s4, clear_bss /* skip relocation */ + mv sp, s2 + la t0, _start + sub t6, s4, t0 /* t6 <- relocation offset */ + beq t0, s4, clear_bss /* skip relocation */ - mv t1, s4 /* t1 <- scratch for copy_loop */ - la t3, __bss_start - sub t3, t3, t0 /* t3 <- __bss_start_ofs */ - add t2, t0, t3 /* t2 <- source end address */ + mv t1, s4 /* t1 <- scratch for copy_loop */ + la t3, __bss_start + sub t3, t3, t0 /* t3 <- __bss_start_ofs */ + add t2, t0, t3 /* t2 <- source end address */ copy_loop: - LREG t5, 0(t0) - addi t0, t0, REGBYTES - SREG t5, 0(t1) - addi t1, t1, REGBYTES - blt t0, t2, copy_loop + LREG t5, 0(t0) + addi t0, t0, REGBYTES + SREG t5, 0(t1) + addi t1, t1, REGBYTES + blt t0, t2, copy_loop /* * Update dynamic relocations after board_init_f */ fix_rela_dyn: - la t1, __rel_dyn_start - la t2, __rel_dyn_end - beq t1, t2, clear_bss - add t1, t1, t6 /* t1 <- rela_dyn_start in RAM */ - add t2, t2, t6 /* t2 <- rela_dyn_end in RAM */ + la t1, __rel_dyn_start + la t2, __rel_dyn_end + beq t1, t2, clear_bss + add t1, t1, t6 /* t1 <- rela_dyn_start in RAM */ + add t2, t2, t6 /* t2 <- rela_dyn_end in RAM */ /* * skip first reserved entry: address, type, addend */ - bne t1, t2, 7f + bne t1, t2, 7f 6: - LREG t5, -(REGBYTES*2)(t1) /* t5 <-- relocation info:type */ - li t3, R_RISCV_RELATIVE /* reloc type R_RISCV_RELATIVE */ - bne t5, t3, 8f /* skip non-RISCV_RELOC entries */ - LREG t3, -(REGBYTES*3)(t1) - LREG t5, -(REGBYTES)(t1) /* t5 <-- addend */ - add t5, t5, t6 /* t5 <-- location to fix up in RAM */ - add t3, t3, t6 /* t3 <-- location to fix up in RAM */ - SREG t5, 0(t3) + LREG t5, -(REGBYTES*2)(t1) /* t5 <-- relocation info:type */ + li t3, R_RISCV_RELATIVE /* reloc type R_RISCV_RELATIVE */ + bne t5, t3, 8f /* skip non-RISCV_RELOC entries */ + LREG t3, -(REGBYTES*3)(t1) + LREG t5, -(REGBYTES)(t1) /* t5 <-- addend */ + add t5, t5, t6 /* t5 <-- location to fix up in RAM */ + add t3, t3, t6 /* t3 <-- location to fix up in RAM */ + SREG t5, 0(t3) 7: - addi t1, t1, (REGBYTES*3) - ble t1, t2, 6b + addi t1, t1, (REGBYTES*3) + ble t1, t2, 6b 8: - la t4, __dyn_sym_start - add t4, t4, t6 + la t4, __dyn_sym_start + add t4, t4, t6 9: - LREG t5, -(REGBYTES*2)(t1) /* t5 <-- relocation info:type */ - srli t0, t5, SYM_INDEX /* t0 <--- sym table index */ - andi t5, t5, 0xFF /* t5 <--- relocation type */ - li t3, RELOC_TYPE - bne t5, t3, 10f /* skip non-addned entries */ + LREG t5, -(REGBYTES*2)(t1) /* t5 <-- relocation info:type */ + srli t0, t5, SYM_INDEX /* t0 <--- sym table index */ + andi t5, t5, 0xFF /* t5 <--- relocation type */ + li t3, RELOC_TYPE + bne t5, t3, 10f /* skip non-addned entries */ - LREG t3, -(REGBYTES*3)(t1) - li t5, SYM_SIZE - mul t0, t0, t5 - add s1, t4, t0 - LREG t5, REGBYTES(s1) - add t5, t5, t6 /* t5 <-- location to fix up in RAM */ - add t3, t3, t6 /* t3 <-- location to fix up in RAM */ - SREG t5, 0(t3) + LREG t3, -(REGBYTES*3)(t1) + li t5, SYM_SIZE + mul t0, t0, t5 + add s1, t4, t0 + LREG t5, REGBYTES(s1) + add t5, t5, t6 /* t5 <-- location to fix up in RAM */ + add t3, t3, t6 /* t3 <-- location to fix up in RAM */ + SREG t5, 0(t3) 10: - addi t1, t1, (REGBYTES*3) - ble t1, t2, 9b + addi t1, t1, (REGBYTES*3) + ble t1, t2, 9b /* * trap update */ - la t0, trap_entry - add t0, t0, t6 - csrw mtvec, t0 + la t0, trap_entry + add t0, t0, t6 + csrw mtvec, t0 clear_bss: - la t0, __bss_start /* t0 <- rel __bss_start in FLASH */ - add t0, t0, t6 /* t0 <- rel __bss_start in RAM */ - la t1, __bss_end /* t1 <- rel __bss_end in FLASH */ - add t1, t1, t6 /* t1 <- rel __bss_end in RAM */ - li t2, 0x00000000 /* clear */ - beq t0, t1, call_board_init_r + la t0, __bss_start /* t0 <- rel __bss_start in FLASH */ + add t0, t0, t6 /* t0 <- rel __bss_start in RAM */ + la t1, __bss_end /* t1 <- rel __bss_end in FLASH */ + add t1, t1, t6 /* t1 <- rel __bss_end in RAM */ + li t2, 0x00000000 /* clear */ + beq t0, t1, call_board_init_r clbss_l: - SREG t2, 0(t0) /* clear loop... */ - addi t0, t0, REGBYTES - bne t0, t1, clbss_l + SREG t2, 0(t0) /* clear loop... */ + addi t0, t0, REGBYTES + bne t0, t1, clbss_l /* * We are done. Do not return, instead branch to second part of board * initialization, now running from RAM. */ call_board_init_r: - la t0, board_init_r - mv t4, t0 /* offset of board_init_r() */ - add t4, t4, t6 /* real address of board_init_r() */ + la t0, board_init_r + mv t4, t0 /* offset of board_init_r() */ + add t4, t4, t6 /* real address of board_init_r() */ /* * setup parameters for board_init_r */ - mv a0, s3 /* gd_t */ - mv a1, s4 /* dest_addr */ + mv a0, s3 /* gd_t */ + mv a1, s4 /* dest_addr */ /* * jump to it ... */ - jr t4 /* jump to board_init_r() */ + jr t4 /* jump to board_init_r() */ /* * trap entry */ trap_entry: - addi sp, sp, -32*REGBYTES - SREG x1, 1*REGBYTES(sp) - SREG x2, 2*REGBYTES(sp) - SREG x3, 3*REGBYTES(sp) - SREG x4, 4*REGBYTES(sp) - SREG x5, 5*REGBYTES(sp) - SREG x6, 6*REGBYTES(sp) - SREG x7, 7*REGBYTES(sp) - SREG x8, 8*REGBYTES(sp) - SREG x9, 9*REGBYTES(sp) - SREG x10, 10*REGBYTES(sp) - SREG x11, 11*REGBYTES(sp) - SREG x12, 12*REGBYTES(sp) - SREG x13, 13*REGBYTES(sp) - SREG x14, 14*REGBYTES(sp) - SREG x15, 15*REGBYTES(sp) - SREG x16, 16*REGBYTES(sp) - SREG x17, 17*REGBYTES(sp) - SREG x18, 18*REGBYTES(sp) - SREG x19, 19*REGBYTES(sp) - SREG x20, 20*REGBYTES(sp) - SREG x21, 21*REGBYTES(sp) - SREG x22, 22*REGBYTES(sp) - SREG x23, 23*REGBYTES(sp) - SREG x24, 24*REGBYTES(sp) - SREG x25, 25*REGBYTES(sp) - SREG x26, 26*REGBYTES(sp) - SREG x27, 27*REGBYTES(sp) - SREG x28, 28*REGBYTES(sp) - SREG x29, 29*REGBYTES(sp) - SREG x30, 30*REGBYTES(sp) - SREG x31, 31*REGBYTES(sp) - csrr a0, mcause - csrr a1, mepc - mv a2, sp - jal handle_trap - csrw mepc, a0 + addi sp, sp, -32*REGBYTES + SREG x1, 1*REGBYTES(sp) + SREG x2, 2*REGBYTES(sp) + SREG x3, 3*REGBYTES(sp) + SREG x4, 4*REGBYTES(sp) + SREG x5, 5*REGBYTES(sp) + SREG x6, 6*REGBYTES(sp) + SREG x7, 7*REGBYTES(sp) + SREG x8, 8*REGBYTES(sp) + SREG x9, 9*REGBYTES(sp) + SREG x10, 10*REGBYTES(sp) + SREG x11, 11*REGBYTES(sp) + SREG x12, 12*REGBYTES(sp) + SREG x13, 13*REGBYTES(sp) + SREG x14, 14*REGBYTES(sp) + SREG x15, 15*REGBYTES(sp) + SREG x16, 16*REGBYTES(sp) + SREG x17, 17*REGBYTES(sp) + SREG x18, 18*REGBYTES(sp) + SREG x19, 19*REGBYTES(sp) + SREG x20, 20*REGBYTES(sp) + SREG x21, 21*REGBYTES(sp) + SREG x22, 22*REGBYTES(sp) + SREG x23, 23*REGBYTES(sp) + SREG x24, 24*REGBYTES(sp) + SREG x25, 25*REGBYTES(sp) + SREG x26, 26*REGBYTES(sp) + SREG x27, 27*REGBYTES(sp) + SREG x28, 28*REGBYTES(sp) + SREG x29, 29*REGBYTES(sp) + SREG x30, 30*REGBYTES(sp) + SREG x31, 31*REGBYTES(sp) + csrr a0, mcause + csrr a1, mepc + mv a2, sp + jal handle_trap + csrw mepc, a0 /* * Remain in M-mode after mret */ - li t0, MSTATUS_MPP - csrs mstatus, t0 - LREG x1, 1*REGBYTES(sp) - LREG x2, 2*REGBYTES(sp) - LREG x3, 3*REGBYTES(sp) - LREG x4, 4*REGBYTES(sp) - LREG x5, 5*REGBYTES(sp) - LREG x6, 6*REGBYTES(sp) - LREG x7, 7*REGBYTES(sp) - LREG x8, 8*REGBYTES(sp) - LREG x9, 9*REGBYTES(sp) - LREG x10, 10*REGBYTES(sp) - LREG x11, 11*REGBYTES(sp) - LREG x12, 12*REGBYTES(sp) - LREG x13, 13*REGBYTES(sp) - LREG x14, 14*REGBYTES(sp) - LREG x15, 15*REGBYTES(sp) - LREG x16, 16*REGBYTES(sp) - LREG x17, 17*REGBYTES(sp) - LREG x18, 18*REGBYTES(sp) - LREG x19, 19*REGBYTES(sp) - LREG x20, 20*REGBYTES(sp) - LREG x21, 21*REGBYTES(sp) - LREG x22, 22*REGBYTES(sp) - LREG x23, 23*REGBYTES(sp) - LREG x24, 24*REGBYTES(sp) - LREG x25, 25*REGBYTES(sp) - LREG x26, 26*REGBYTES(sp) - LREG x27, 27*REGBYTES(sp) - LREG x28, 28*REGBYTES(sp) - LREG x29, 29*REGBYTES(sp) - LREG x30, 30*REGBYTES(sp) - LREG x31, 31*REGBYTES(sp) - addi sp, sp, 32*REGBYTES + li t0, MSTATUS_MPP + csrs mstatus, t0 + LREG x1, 1*REGBYTES(sp) + LREG x2, 2*REGBYTES(sp) + LREG x3, 3*REGBYTES(sp) + LREG x4, 4*REGBYTES(sp) + LREG x5, 5*REGBYTES(sp) + LREG x6, 6*REGBYTES(sp) + LREG x7, 7*REGBYTES(sp) + LREG x8, 8*REGBYTES(sp) + LREG x9, 9*REGBYTES(sp) + LREG x10, 10*REGBYTES(sp) + LREG x11, 11*REGBYTES(sp) + LREG x12, 12*REGBYTES(sp) + LREG x13, 13*REGBYTES(sp) + LREG x14, 14*REGBYTES(sp) + LREG x15, 15*REGBYTES(sp) + LREG x16, 16*REGBYTES(sp) + LREG x17, 17*REGBYTES(sp) + LREG x18, 18*REGBYTES(sp) + LREG x19, 19*REGBYTES(sp) + LREG x20, 20*REGBYTES(sp) + LREG x21, 21*REGBYTES(sp) + LREG x22, 22*REGBYTES(sp) + LREG x23, 23*REGBYTES(sp) + LREG x24, 24*REGBYTES(sp) + LREG x25, 25*REGBYTES(sp) + LREG x26, 26*REGBYTES(sp) + LREG x27, 27*REGBYTES(sp) + LREG x28, 28*REGBYTES(sp) + LREG x29, 29*REGBYTES(sp) + LREG x30, 30*REGBYTES(sp) + LREG x31, 31*REGBYTES(sp) + addi sp, sp, 32*REGBYTES mret #ifdef CONFIG_INIT_CRITICAL From patchwork Tue Oct 30 12:55:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990817 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ks6M6sqGz9s4s for ; Wed, 31 Oct 2018 00:01:15 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 81726C220F7; Tue, 30 Oct 2018 12:59:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 87C04C22104; Tue, 30 Oct 2018 12:57:34 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E98A4C22132; Tue, 30 Oct 2018 12:57:24 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id 4817FC22107 for ; Tue, 30 Oct 2018 12:57:21 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2HnAgC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBZYIFgg2MbZZGkBoNhGwCgyUiOBYBAwEBAgEBAgICaRwMhTwGeRBRITYGDgWDIYFqAxQBqi2IAQ2CGAkBhzeEJoFYP4Z5gXGBBIUOAp5iLgcCgQ6BBASLSYMdCxiJOocOjXeJL4FaIoFVMxokgzuFfopabgGJKoJNAQE X-IPAS-Result: A2HnAgC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBZYIFgg2MbZZGkBoNhGwCgyUiOBYBAwEBAgEBAgICaRwMhTwGeRBRITYGDgWDIYFqAxQBqi2IAQ2CGAkBhzeEJoFYP4Z5gXGBBIUOAp5iLgcCgQ6BBASLSYMdCxiJOocOjXeJL4FaIoFVMxokgzuFfopabgGJKoJNAQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904644" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:21 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DBAgCMVNhb/xBhWMBkHAEBAQQBAQcEAQGBZYNYOoxtlkaQGg2EbAKDRjgWAQMBAQIBAQJtHAyFOwZ5EFEhNgYOBYMhgWoDFaouiAENghgJAYc3hX4/hnmBcYEEhQ4CnmIuBwKBDoEEBItJgx0LGIk6hw6Nd4kvgVohgVUzGiSDO4V+ilo+MAGJKoJNAQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525679" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:20 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:20 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:41 +0100 Message-ID: <20181030125553.5230-19-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--2.743100-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Cc: Greentime Hu Subject: [U-Boot] [PATCH v2 18/29] riscv: align mtvec on a 4-byte boundary X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The machine trap-vector base address (mtvec) must be aligned on a 4-byte boundary. Add the necessary align directive to trap_entry. This patch also removes the global directive for trap_entry, which is not required. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng --- Changes in v2: None arch/riscv/cpu/start.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/cpu/start.S b/arch/riscv/cpu/start.S index bd5904500c..88b4aaa1c0 100644 --- a/arch/riscv/cpu/start.S +++ b/arch/riscv/cpu/start.S @@ -42,7 +42,6 @@ nmi_vector: trap_vector: j trap_entry -.global trap_entry handle_reset: li t0, CONFIG_SYS_SDRAM_BASE SREG a2, 0(t0) @@ -208,6 +207,7 @@ call_board_init_r: /* * trap entry */ +.align 2 trap_entry: addi sp, sp, -32*REGBYTES SREG x1, 1*REGBYTES(sp) From patchwork Tue Oct 30 12:55:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990835 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksN44f1Zz9s8J for ; Wed, 31 Oct 2018 00:13:08 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 37C90C22127; Tue, 30 Oct 2018 13:01:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 00DA2C22143; Tue, 30 Oct 2018 12:57:48 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5D3FEC22132; Tue, 30 Oct 2018 12:57:26 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id A0BEDC2211F for ; Tue, 30 Oct 2018 12:57:22 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2HpAgC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBZYIFgg2MbY1GiQCJMYUDgWYNhGwCgyUiOBYBAwEBAgEBAgICaRwMhTwGeRAgMSE2Bg4FgyGBagMUAaotiAENghgJAYc3hCaBWD+BEAGFaIIRPYU1Aoh9gWqTey4HAoEOgQQEi0mDHQsYgVKHaCuGYyyNS4kvgVoigVUzGiSDO4V+ilpuAYt3AQE X-IPAS-Result: A2HpAgC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBZYIFgg2MbY1GiQCJMYUDgWYNhGwCgyUiOBYBAwEBAgEBAgICaRwMhTwGeRAgMSE2Bg4FgyGBagMUAaotiAENghgJAYc3hCaBWD+BEAGFaIIRPYU1Aoh9gWqTey4HAoEOgQQEi0mDHQsYgVKHaCuGYyyNS4kvgVoigVUzGiSDO4V+ilpuAYt3AQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904646" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:22 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DCAgCMVNhb/xBhWMBkHAEBAQQBAQcEAQGBZYNYOoxtjUaJAIkxhQOBZg2EbAKDRjgWAQMBAQIBAQJtHAyFOwZ5ECAxITYGDgWDIYFqAxWqLogBDYIYCQGHN4V+P4EQAYVoghE9hTUCiH2BapN7LgcCgQ6BBASLSYMdCxiBUodoK4ZjLI1LiS+BWiGBVTMaJIM7hX6KWj4wAYt3AQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525680" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:21 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:21 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:42 +0100 Message-ID: <20181030125553.5230-20-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--0.740400-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Cc: Marek Vasut , Stephen Warren , Michal Simek , Macpaul Lin , Greentime Hu Subject: [U-Boot] [PATCH v2 19/29] Drop CONFIG_INIT_CRITICAL X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Bin Meng This is now deprecated and no board is using it. Drop it. Signed-off-by: Bin Meng Reviewed-by: Lukas Auer Signed-off-by: Lukas Auer --- Changes in v2: - New patch to replace patch "riscv: remove CONFIG_INIT_CRITICAL" arch/nds32/cpu/n1213/start.S | 51 ---------------------------------- arch/riscv/cpu/start.S | 13 --------- board/armltd/integrator/README | 4 +-- include/common.h | 5 ---- scripts/config_whitelist.txt | 1 - 5 files changed, 1 insertion(+), 73 deletions(-) diff --git a/arch/nds32/cpu/n1213/start.S b/arch/nds32/cpu/n1213/start.S index aa9457f5e4..cf966e2132 100644 --- a/arch/nds32/cpu/n1213/start.S +++ b/arch/nds32/cpu/n1213/start.S @@ -200,14 +200,6 @@ update_gp: jal turnoff_watchdog #endif -/* - * Do CPU critical regs init only at reboot, - * not when booting from ram - */ -#ifdef CONFIG_INIT_CRITICAL - jal cpu_init_crit ! Do CPU critical regs init -#endif - /* * Set stackpointer in internal RAM to call board_init_f * $sp must be 8-byte alignment for ABI compliance. @@ -318,49 +310,6 @@ call_board_init_r: /* jump to it ... */ jr $lp /* jump to board_init_r() */ -/* - * Initialize CPU critical registers - * - * 1. Setup control registers - * 1.1 Mask all IRQs - * 1.2 Flush cache and TLB - * 1.3 Disable MMU and cache - * 2. Setup memory timing - */ - -cpu_init_crit: - - move $r0, $lp /* push ra */ - - /* Disable Interrupts by clear GIE in $PSW reg */ - setgie.d - - /* Flush caches and TLB */ - /* Invalidate caches */ - jal invalidate_icac - jal invalidate_dcac - - /* Flush TLB */ - mfsr $p0, $MMU_CFG - andi $p0, $p0, 0x3 ! MMPS - li $p1, 0x2 ! TLB MMU - bne $p0, $p1, 1f - tlbop flushall ! Flush TLB - -1: - ! Disable MMU, Dcache - ! Whitiger is MMU disabled when reset - ! Disable the D$ - mfsr $p0, MR_CAC_CTL ! Get the $CACHE_CTL reg - li $p1, DIS_DCAC - and $p0, $p0, $p1 ! Set DC_EN bit - mtsr $p0, MR_CAC_CTL ! write back the $CACHE_CTL reg - isb - - move $lp, $r0 -2: - ret - /* * Invalidate I$ */ diff --git a/arch/riscv/cpu/start.S b/arch/riscv/cpu/start.S index 88b4aaa1c0..9804a8ac44 100644 --- a/arch/riscv/cpu/start.S +++ b/arch/riscv/cpu/start.S @@ -50,14 +50,6 @@ handle_reset: csrwi mstatus, 0 csrwi mie, 0 -/* - * Do CPU critical regs init only at reboot, - * not when booting from ram - */ -#ifdef CONFIG_INIT_CRITICAL - jal cpu_init_crit /* Do CPU critical regs init */ -#endif - /* * Set stackpointer in internal/ex RAM to call board_init_f */ @@ -285,8 +277,3 @@ trap_entry: LREG x31, 31*REGBYTES(sp) addi sp, sp, 32*REGBYTES mret - -#ifdef CONFIG_INIT_CRITICAL -cpu_init_crit: - ret -#endif diff --git a/board/armltd/integrator/README b/board/armltd/integrator/README index 5a0e934924..af9dcc1f4f 100644 --- a/board/armltd/integrator/README +++ b/board/armltd/integrator/README @@ -36,9 +36,7 @@ In case c) it may be necessary for U-Boot to perform CM dependent initialization Configuring U-Boot : ------------------ The makefile contains targets for Integrator platforms of both types -fitted with all current variants of CM. If these targets are to be used with -boot process c) above then CONFIG_INIT_CRITICAL may need to be defined to ensure -that the CM is correctly configured. +fitted with all current variants of CM. There are also targets independent of CM. These may not be suitable for boot process c) above. They have been preserved for backward compatibility with diff --git a/include/common.h b/include/common.h index 8b9f859c07..9b9bedc53a 100644 --- a/include/common.h +++ b/include/common.h @@ -558,11 +558,6 @@ int cpu_release(u32 nr, int argc, char * const argv[]); #endif #endif -#ifdef CONFIG_INIT_CRITICAL -#error CONFIG_INIT_CRITICAL is deprecated! -#error Read section CONFIG_SKIP_LOWLEVEL_INIT in README. -#endif - #define ROUND(a,b) (((a) + (b) - 1) & ~((b) - 1)) /* diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 2126315460..933c9c5006 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -965,7 +965,6 @@ CONFIG_IMX_VIDEO_SKIP CONFIG_IMX_WATCHDOG CONFIG_INETSPACE_V2 CONFIG_INITRD_TAG -CONFIG_INIT_CRITICAL CONFIG_INIT_IGNORE_ERROR CONFIG_INI_ALLOW_MULTILINE CONFIG_INI_CASE_INSENSITIVE From patchwork Tue Oct 30 12:55:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990819 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ks834BkDz9s4s for ; Wed, 31 Oct 2018 00:02:43 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 37255C220E2; Tue, 30 Oct 2018 13:00:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id B3D5EC220FB; Tue, 30 Oct 2018 12:57:35 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5C3D0C220E2; Tue, 30 Oct 2018 12:57:26 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id 169DEC220E8 for ; Tue, 30 Oct 2018 12:57:23 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2HnAgC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBZYIFgg2MbaR6gWYNhGwCgyUiOBYBAwEBAgEBAgICaSiFPAZ5EFFXBg4FgyGCAQGqLYomCQGHN4QmgVg/gRABh3hlhQ4CnxAHAoEOgQQEjmYLGIk6hw6XJoFaIoFVMxokgzuQWG4Bi3cBAQ X-IPAS-Result: A2HnAgC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBZYIFgg2MbaR6gWYNhGwCgyUiOBYBAwEBAgEBAgICaSiFPAZ5EFFXBg4FgyGCAQGqLYomCQGHN4QmgVg/gRABh3hlhQ4CnxAHAoEOgQQEjmYLGIk6hw6XJoFaIoFVMxokgzuQWG4Bi3cBAQ X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904647" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:23 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DzAwCMVNhb/xBhWMBkHQEBBQEHBQGBZYNYOoxtpHqBZg2EbAKDRjgWAQMBAQIBAQJtKIU7BnkQUVcGDgWDIYICqi6KJgkBhzeFfj+BEAGHeGWFDgKfEAcCgQ6BBASOZgsYiTqHDpcmgVohgVUzGiSDO5BYPjABi3cBAQ X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525682" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:22 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:22 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:43 +0100 Message-ID: <20181030125553.5230-21-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--0.705700-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Cc: Greentime Hu Subject: [U-Boot] [PATCH v2 20/29] riscv: remove unused labels in start.S X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The labels nmi_vector, trap_vector and handle_reset in start.S are not used for RISC-V. Remove them. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng --- Changes in v2: - Drop removal of code that stores the contents of a2; this broke the board ax25-ae350. The code will be removed again in a future patch. arch/riscv/cpu/start.S | 9 --------- 1 file changed, 9 deletions(-) diff --git a/arch/riscv/cpu/start.S b/arch/riscv/cpu/start.S index 9804a8ac44..c313477ae0 100644 --- a/arch/riscv/cpu/start.S +++ b/arch/riscv/cpu/start.S @@ -34,15 +34,6 @@ .section .text .globl _start _start: - j handle_reset - -nmi_vector: - j nmi_vector - -trap_vector: - j trap_entry - -handle_reset: li t0, CONFIG_SYS_SDRAM_BASE SREG a2, 0(t0) la t0, trap_entry From patchwork Tue Oct 30 12:55:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990839 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksPL0W2Hz9s7T for ; Wed, 31 Oct 2018 00:14:13 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 9A410C2211C; Tue, 30 Oct 2018 13:02:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id EEC69C22116; Tue, 30 Oct 2018 12:57:59 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BAFB3C22116; Tue, 30 Oct 2018 12:57:27 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id CF392C22121 for ; Tue, 30 Oct 2018 12:57:23 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2HoAgC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBZYFbKoINjG2WRpAaDYRsAoMlIjgWAQMBAQIBAQICAmkcDIU8BnkQUSE2Bg4FgyGBagMUAaotiAENghgJAYc3hCaBWD+BEAGFaIJ1hQ4CiQqVWC4HAoEOgQQEi0mDHQsYiTqHDo13iS+BWiKBVTMaJIM7gzoBAYJCilpuAYt3AQE X-IPAS-Result: A2HoAgC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBZYFbKoINjG2WRpAaDYRsAoMlIjgWAQMBAQIBAQICAmkcDIU8BnkQUSE2Bg4FgyGBagMUAaotiAENghgJAYc3hCaBWD+BEAGFaIJ1hQ4CiQqVWC4HAoEOgQQEi0mDHQsYiTqHDo13iS+BWiKBVTMaJIM7gzoBAYJCilpuAYt3AQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904648" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:23 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0D+AwCMVNhb/xBhWMBkHQEBBQEHBQGBZYFbgX06jG2WRpAaDYRsAoNGOBYBAwEBAgEBAm0cDIU7BnkQUSE2Bg4FgyGBagMVqi6IAQ2CGAkBhzeFfj+BEAGFaIJ1hQ4CiQqVWC4HAoEOgQQEi0mDHQsYiTqHDo13iS+BWiGBVTMaJIM7gzoBAYJCilo+MAGLdwEB X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525684" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:23 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:22 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:44 +0100 Message-ID: <20181030125553.5230-22-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--3.397900-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Cc: Greentime Hu Subject: [U-Boot] [PATCH v2 21/29] riscv: do not blindly modify the mstatus CSR X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The mstatus CSR includes WPRI (writes preserve values, reads ignore values) fields and must therefore not be set to zero without preserving these fields. It is not apparent why mstatus is set to zero here since it is not required for U-Boot to run. Remove it. This instruction and others encode zero as an immediate. RISC-V has the zero register for this purpose. Replace the immediates with the zero register. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng Reviewed-by: Rick Chen --- Changes in v2: None arch/riscv/cpu/start.S | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/riscv/cpu/start.S b/arch/riscv/cpu/start.S index c313477ae0..b01ea6e224 100644 --- a/arch/riscv/cpu/start.S +++ b/arch/riscv/cpu/start.S @@ -38,8 +38,9 @@ _start: SREG a2, 0(t0) la t0, trap_entry csrw mtvec, t0 - csrwi mstatus, 0 - csrwi mie, 0 + + /* mask all interrupts */ + csrw mie, zero /* * Set stackpointer in internal/ex RAM to call board_init_f @@ -160,11 +161,10 @@ clear_bss: add t0, t0, t6 /* t0 <- rel __bss_start in RAM */ la t1, __bss_end /* t1 <- rel __bss_end in FLASH */ add t1, t1, t6 /* t1 <- rel __bss_end in RAM */ - li t2, 0x00000000 /* clear */ beq t0, t1, call_board_init_r clbss_l: - SREG t2, 0(t0) /* clear loop... */ + SREG zero, 0(t0) /* clear loop... */ addi t0, t0, REGBYTES bne t0, t1, clbss_l From patchwork Tue Oct 30 12:55:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990837 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksNN2Q4Zz9s7T for ; Wed, 31 Oct 2018 00:13:24 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id BEDE2C2213B; Tue, 30 Oct 2018 13:04:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 24E06C220FF; Tue, 30 Oct 2018 12:58:13 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0084AC2211A; Tue, 30 Oct 2018 12:57:27 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id 6D640C2211A for ; Tue, 30 Oct 2018 12:57:24 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2GxAAC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBVAQBAQsBggSCDYxtlkaQGg2EbAKDJSI3Cg0BAwEBAgEBAgICaRwMhTwGdAUQUSE2Bg4FgyGBagMUAaotiAENghgJAYc3hCaBWD+BEYVognWFDgKIWZYJLgcCgQ6BBASLSYMdCxiJOocOgmuLDIkvgVkjgVUzGiSDO4V+ilpuAYt3AQE X-IPAS-Result: A2GxAAC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBVAQBAQsBggSCDYxtlkaQGg2EbAKDJSI3Cg0BAwEBAgEBAgICaRwMhTwGdAUQUSE2Bg4FgyGBagMUAaotiAENghgJAYc3hCaBWD+BEYVognWFDgKIWZYJLgcCgQ6BBASLSYMdCxiJOocOgmuLDIkvgVkjgVUzGiSDO4V+ilpuAYt3AQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904649" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:24 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0D0AACMVNhb/xBhWMBkHQEBBQEHBQGBVAUBCwGDVzqMbZZGkBoNhGwCg0Y3Cg0BAwEBAgEBAm0cDIU7BnQFEFEhNgYOBYMhgWoDFaouiAENghgJAYc3hX4/gRGFaIJ1hQ4CiFmWCS4HAoEOgQQEi0mDHQsYiTqHDoJriwyJL4FZIoFVMxokgzuFfopaPjABi3cBAQ X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525686" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:23 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:23 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:45 +0100 Message-ID: <20181030125553.5230-23-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--8.844700-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Cc: Greentime Hu Subject: [U-Boot] [PATCH v2 22/29] riscv: save hart ID and device tree passed by prior boot stage X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Store the hart ID and device tree passed by the prior boot stage (in a0 and a1) in registers s0 and s1. Replace one use of s1 in start.S to avoid overwriting it. The device tree is also stored in memory to make it available to U-Boot with the configuration CONFIG_OF_PRIOR_STAGE. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng Reviewed-by: Rick Chen --- Changes in v2: None arch/riscv/cpu/cpu.c | 6 ++++++ arch/riscv/cpu/start.S | 12 ++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c index ae57fb8313..d9f820c44c 100644 --- a/arch/riscv/cpu/cpu.c +++ b/arch/riscv/cpu/cpu.c @@ -6,6 +6,12 @@ #include #include +/* + * prior_stage_fdt_address must be stored in the data section since it is used + * before the bss section is available. + */ +phys_addr_t prior_stage_fdt_address __attribute__((section(".data"))); + enum { ISA_INVALID = 0, ISA_32BIT, diff --git a/arch/riscv/cpu/start.S b/arch/riscv/cpu/start.S index b01ea6e224..331a5345e3 100644 --- a/arch/riscv/cpu/start.S +++ b/arch/riscv/cpu/start.S @@ -34,6 +34,10 @@ .section .text .globl _start _start: + /* save hart id and dtb pointer */ + mv s0, a0 + mv s1, a1 + li t0, CONFIG_SYS_SDRAM_BASE SREG a2, 0(t0) la t0, trap_entry @@ -58,6 +62,10 @@ call_board_init_f_0: mv a0, sp jal board_init_f_alloc_reserve mv sp, a0 + + la t0, prior_stage_fdt_address + SREG s1, 0(t0) + jal board_init_f_init_reserve mv a0, zero /* a0 <-- boot_flags = 0 */ @@ -140,8 +148,8 @@ fix_rela_dyn: LREG t3, -(REGBYTES*3)(t1) li t5, SYM_SIZE mul t0, t0, t5 - add s1, t4, t0 - LREG t5, REGBYTES(s1) + add s5, t4, t0 + LREG t5, REGBYTES(s5) add t5, t5, t6 /* t5 <-- location to fix up in RAM */ add t3, t3, t6 /* t3 <-- location to fix up in RAM */ SREG t5, 0(t3) From patchwork Tue Oct 30 12:55:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990829 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksKm6wWjz9s4s for ; Wed, 31 Oct 2018 00:11:08 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 2EC1CC2212B; Tue, 30 Oct 2018 13:01:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 21ABDC22147; Tue, 30 Oct 2018 12:57:49 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DB3C2C22118; Tue, 30 Oct 2018 12:57:29 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id 102BFC22122 for ; Tue, 30 Oct 2018 12:57:25 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2FWAAC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBUwUBAQsBgVoqgg2MbZZGjiAUgWYNhGwCgyUiNgsNAQMBAQIBAQICAmkcDIU8BnQFEFEhNgYOBYMhgWoDFAGqLYU8gkUNghgJAYc3hCaBWD+BEYVoghFkhQ4CiH2VZS4HAoEOgQQEi0mDHQsYiTqHDoJriwyJL4FKDCaBVTMaJIM7giYXfQECgkGKWm4Bi3cBAQ X-IPAS-Result: A2FWAAC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBUwUBAQsBgVoqgg2MbZZGjiAUgWYNhGwCgyUiNgsNAQMBAQIBAQICAmkcDIU8BnQFEFEhNgYOBYMhgWoDFAGqLYU8gkUNghgJAYc3hCaBWD+BEYVoghFkhQ4CiH2VZS4HAoEOgQQEi0mDHQsYiTqHDoJriwyJL4FKDCaBVTMaJIM7giYXfQECgkGKWm4Bi3cBAQ X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904650" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:25 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0B3AACMVNhb/xBhWMBkHQEBBQEHBQGBUwYBCwGBWoF9OoxtlkaOIBSBZg2EbAKDRjYLDQEDAQECAQECbRwMhTsGdAUQUSE2Bg4FgyGBagMVqi6FPIJFDYIYCQGHN4V+P4ERhWiCEWSFDgKIfZVlLgcCgQ6BBASLSYMdCxiJOocOgmuLDIkvgUoMJYFVMxokgzuCJhd9AQKCQYpaPjABi3cBAQ X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525688" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:24 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:23 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:46 +0100 Message-ID: <20181030125553.5230-24-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--1.967100-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Subject: [U-Boot] [PATCH v2 23/29] riscv: qemu: use device tree passed by prior boot stage X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" QEMU provides a device tree, which is passed to U-Boot using register a1. We are now able to directly select the device tree with the configuration CONFIG_OF_PRIOR_STAGE. Replace the hard-coded address in qemu-riscv with it. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng Reviewed-by: Rick Chen --- Changes in v2: - Rebase onto u-boot-dm/next board/emulation/qemu-riscv/qemu-riscv.c | 11 ----------- configs/qemu-riscv32_defconfig | 2 +- configs/qemu-riscv64_defconfig | 2 +- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/board/emulation/qemu-riscv/qemu-riscv.c b/board/emulation/qemu-riscv/qemu-riscv.c index 2730a288fb..2ce093e19a 100644 --- a/board/emulation/qemu-riscv/qemu-riscv.c +++ b/board/emulation/qemu-riscv/qemu-riscv.c @@ -9,8 +9,6 @@ #include #include -#define MROM_FDT_ADDR 0x1020 - int board_init(void) { /* @@ -21,12 +19,3 @@ int board_init(void) return 0; } - -void *board_fdt_blob_setup(void) -{ - /* - * QEMU loads a generated DTB for us immediately - * after the reset vectors in the MROM - */ - return (void *)MROM_FDT_ADDR; -} diff --git a/configs/qemu-riscv32_defconfig b/configs/qemu-riscv32_defconfig index ff1fb1f30e..72c54a3dd5 100644 --- a/configs/qemu-riscv32_defconfig +++ b/configs/qemu-riscv32_defconfig @@ -3,4 +3,4 @@ CONFIG_TARGET_QEMU_VIRT=y CONFIG_NR_DRAM_BANKS=1 CONFIG_DISPLAY_CPUINFO=y CONFIG_DISPLAY_BOARDINFO=y -CONFIG_OF_BOARD=y +CONFIG_OF_PRIOR_STAGE=y diff --git a/configs/qemu-riscv64_defconfig b/configs/qemu-riscv64_defconfig index 60b647efe8..44766c38f6 100644 --- a/configs/qemu-riscv64_defconfig +++ b/configs/qemu-riscv64_defconfig @@ -4,4 +4,4 @@ CONFIG_ARCH_RV64I=y CONFIG_NR_DRAM_BANKS=1 CONFIG_DISPLAY_CPUINFO=y CONFIG_DISPLAY_BOARDINFO=y -CONFIG_OF_BOARD=y +CONFIG_OF_PRIOR_STAGE=y From patchwork Tue Oct 30 12:55:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990824 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksHq0Y05z9s4s for ; Wed, 31 Oct 2018 00:09:26 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 99E35C22116; Tue, 30 Oct 2018 13:03:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id E8F45C22174; Tue, 30 Oct 2018 12:58:06 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 58EDDC2216B; Tue, 30 Oct 2018 12:57:30 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id E25FDC22112 for ; Tue, 30 Oct 2018 12:57:25 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2E5AAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBVAMBAQELAYIEgg2MbaZgDYRsAoMlIjcKDQEDAQECAQECAgJpKIU8BnQFEFFXBg4FgyGCAQGqLYomCQGHN4QmgVg/iW6FDgKKZ5QpBwKBDoEEBI5mCxiJOocOgmuUO4FZI4FVMxokgzuCJhcSjgluAYt3AQE X-IPAS-Result: A2E5AAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBVAMBAQELAYIEgg2MbaZgDYRsAoMlIjcKDQEDAQECAQECAgJpKIU8BnQFEFFXBg4FgyGCAQGqLYomCQGHN4QmgVg/iW6FDgKKZ5QpBwKBDoEEBI5mCxiJOocOgmuUO4FZI4FVMxokgzuCJhcSjgluAYt3AQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904651" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:25 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0ClAACMVNhb/xBhWMBkHAEBAQQBAQcEAQGBVAQBAQsBg1c6jG2mYA2EbAKDRjcKDQEDAQECAQECbSiFOwZ0BRBRVwYOBYMhggKqLoomCQGHN4V+P4luhQ4CimeUKQcCgQ6BBASOZgsYiTqHDoJrlDuBWSKBVTMaJIM7giYXEo4JPjABi3cBAQ X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525691" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:25 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:24 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:47 +0100 Message-ID: <20181030125553.5230-25-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--4.340700-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Cc: Alexander Graf , Rajan Vaja , Michal Simek , Greentime Hu Subject: [U-Boot] [PATCH v2 24/29] riscv: store device tree passed by prior boot stage in environment X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The device tree passed by the prior boot stage can be used to boot Linux. Store it as environment variable "prior_stage_dtb", so that it can be used as part of the boot command. Signed-off-by: Lukas Auer --- Changes in v2: - New patch arch/Kconfig | 1 + arch/riscv/cpu/cpu.c | 7 +++++++ arch/riscv/include/asm/u-boot-riscv.h | 1 + 3 files changed, 9 insertions(+) diff --git a/arch/Kconfig b/arch/Kconfig index 9fdd2f7e66..883e4a9308 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -74,6 +74,7 @@ config RISCV imply MTD imply TIMER imply CMD_DM + imply ARCH_MISC_INIT config SANDBOX bool "Sandbox" diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c index d9f820c44c..e06a8c6bab 100644 --- a/arch/riscv/cpu/cpu.c +++ b/arch/riscv/cpu/cpu.c @@ -53,3 +53,10 @@ int print_cpuinfo(void) return 0; } + +int arch_misc_init(void) +{ + env_set_hex("prior_stage_dtb", prior_stage_fdt_address); + + return 0; +} diff --git a/arch/riscv/include/asm/u-boot-riscv.h b/arch/riscv/include/asm/u-boot-riscv.h index 49febd5881..937b2682dc 100644 --- a/arch/riscv/include/asm/u-boot-riscv.h +++ b/arch/riscv/include/asm/u-boot-riscv.h @@ -13,6 +13,7 @@ /* cpu/.../cpu.c */ int cleanup_before_linux(void); +int arch_misc_init(void); /* board/.../... */ int board_init(void); From patchwork Tue Oct 30 12:55:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990820 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ks9023kFz9s4s for ; Wed, 31 Oct 2018 00:03:31 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 9A9F2C220E5; Tue, 30 Oct 2018 13:00:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id B9FCDC2211B; Tue, 30 Oct 2018 12:57:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DC8B3C22128; Tue, 30 Oct 2018 12:57:31 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id 8B300C22136 for ; Tue, 30 Oct 2018 12:57:26 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2H1AAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBZYIFgg2MbZZGkBoNhGwCgyUiOBYBAwEBAgEBAgICaRwMhTwGeRBRITYGDgWDIYFqAxQBqi2FPIJFDYIYCQGHN4QmgVg/hnmCdYUOAp5iLgcCgQ6BBASLSYMdCxiJOocOjXeJL4FaIoFVMxokgzuFfopabgGLdwEB X-IPAS-Result: A2H1AAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBZYIFgg2MbZZGkBoNhGwCgyUiOBYBAwEBAgEBAgICaRwMhTwGeRBRITYGDgWDIYFqAxQBqi2FPIJFDYIYCQGHN4QmgVg/hnmCdYUOAp5iLgcCgQ6BBASLSYMdCxiJOocOjXeJL4FaIoFVMxokgzuFfopabgGLdwEB X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904652" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:26 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DBAgCMVNhb/xBhWMBkHAEBAQQBAQcEAQGBZYNYOoxtlkaQGg2EbAKDRjgWAQMBAQIBAQJtHAyFOwZ5EFEhNgYOBYMhgWoDFaouhTyCRQ2CGAkBhzeFfj+GeYJ1hQ4CnmIuBwKBDoEEBItJgx0LGIk6hw6Nd4kvgVohgVUzGiSDO4V+ilo+MAGLdwEB X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525692" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:25 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:25 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:48 +0100 Message-ID: <20181030125553.5230-26-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--4.719300-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Subject: [U-Boot] [PATCH v2 25/29] riscv: qemu: support booting Linux X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Support booting Linux (as payload of BBL) from FIT images. For this, the default CONFIG_SYS_BOOTM_LEN is increased to 16 MB, and the environment variables fdt_high and initrd_high are set to mark the device tree and initrd as in-place. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng --- Changes in v2: None configs/qemu-riscv32_defconfig | 1 + configs/qemu-riscv64_defconfig | 1 + include/configs/qemu-riscv.h | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/configs/qemu-riscv32_defconfig b/configs/qemu-riscv32_defconfig index 72c54a3dd5..b55644378a 100644 --- a/configs/qemu-riscv32_defconfig +++ b/configs/qemu-riscv32_defconfig @@ -1,6 +1,7 @@ CONFIG_RISCV=y CONFIG_TARGET_QEMU_VIRT=y CONFIG_NR_DRAM_BANKS=1 +CONFIG_FIT=y CONFIG_DISPLAY_CPUINFO=y CONFIG_DISPLAY_BOARDINFO=y CONFIG_OF_PRIOR_STAGE=y diff --git a/configs/qemu-riscv64_defconfig b/configs/qemu-riscv64_defconfig index 44766c38f6..a542ac4893 100644 --- a/configs/qemu-riscv64_defconfig +++ b/configs/qemu-riscv64_defconfig @@ -2,6 +2,7 @@ CONFIG_RISCV=y CONFIG_TARGET_QEMU_VIRT=y CONFIG_ARCH_RV64I=y CONFIG_NR_DRAM_BANKS=1 +CONFIG_FIT=y CONFIG_DISPLAY_CPUINFO=y CONFIG_DISPLAY_BOARDINFO=y CONFIG_OF_PRIOR_STAGE=y diff --git a/include/configs/qemu-riscv.h b/include/configs/qemu-riscv.h index d279c233b2..ba6a18f2e6 100644 --- a/include/configs/qemu-riscv.h +++ b/include/configs/qemu-riscv.h @@ -15,7 +15,13 @@ #define CONFIG_SYS_MALLOC_LEN SZ_8M +#define CONFIG_SYS_BOOTM_LEN SZ_16M + /* Environment options */ #define CONFIG_ENV_SIZE SZ_4K +#define CONFIG_EXTRA_ENV_SETTINGS \ + "fdt_high=0xffffffffffffffff\0" \ + "initrd_high=0xffffffffffffffff\0" + #endif /* __CONFIG_H */ From patchwork Tue Oct 30 12:55:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990842 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksRZ16lmz9s3l for ; Wed, 31 Oct 2018 00:16:09 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 9A602C220E1; Tue, 30 Oct 2018 13:04:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id B134BC2211E; Tue, 30 Oct 2018 12:58:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E1106C2215E; Tue, 30 Oct 2018 12:57:31 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id 45B9CC22135 for ; Tue, 30 Oct 2018 12:57:27 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2EcAAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBUwQBAQELAYIEgg2MbZZGjiCBeg2EbAKDJSI2Cw0BAwEBAgEBAgICaRwMhTwGJ00FEFEhNgYKBAWDIYFqAxQBqXoziAENghgJAYc3hCaBWD+BEAGFaIgDAoh9gWqTey4HAoEOgQQEi0mDHQsYgVKHaIcOiTmEPokvgUoCMIFVMxokgzuCJhcSgy+KWm4BiSoEgkkBAQ X-IPAS-Result: A2EcAAC/VNhb/xoBYJlkGwEBAQEDAQEBBwMBAQGBUwQBAQELAYIEgg2MbZZGjiCBeg2EbAKDJSI2Cw0BAwEBAgEBAgICaRwMhTwGJ00FEFEhNgYKBAWDIYFqAxQBqXoziAENghgJAYc3hCaBWD+BEAGFaIgDAoh9gWqTey4HAoEOgQQEi0mDHQsYgVKHaIcOiTmEPokvgUoCMIFVMxokgzuCJhcSgy+KWm4BiSoEgkkBAQ X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904653" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:27 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BRAACMVNhb/xBhWMBkHAEBAQQBAQcEAQGBUwUBAQsBg1c6jG2WRo4ggXoNhGwCg0Y2Cw0BAwEBAgEBAm0cDIU7BidNBRBRITYGCgQFgyGBagMVqXsziAENghgJAYc3hX4/gRABhWiIAwKIfYFqk3suBwKBDoEEBItJgx0LGIFSh2iHDok5hD6JL4FKAi+BVTMaJIM7giYXEoMvilo+MAGJKgSCSQEB X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525694" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:26 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:26 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:49 +0100 Message-ID: <20181030125553.5230-27-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--3.343800-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Cc: Alexander Graf Subject: [U-Boot] [PATCH v2 26/29] riscv: align bootm implementation with that of other architectures X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The bootm implementation of RISC-V diverges from that of other architectures. Update it to match the implementation of other architectures. The ARM implementation is used as a reference. This adds the following features and changes to RISC-V. * Add support for the BOOTM_STATE_OS_FAKE_GO command * Call the remove function on devices with the removal flag set before booting Linux * Force disconnect USB devices from the host before booting Linux * Print and add bootstage information to the device tree before booting Linux Signed-off-by: Lukas Auer Reviewed-by: Bin Meng --- Changes in v2: - Rebase onto u-boot-dm/next arch/riscv/lib/bootm.c | 99 ++++++++++++++++++++++++++++++------------ 1 file changed, 71 insertions(+), 28 deletions(-) diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c index c1cf618806..4e349f5614 100644 --- a/arch/riscv/lib/bootm.c +++ b/arch/riscv/lib/bootm.c @@ -8,6 +8,8 @@ #include #include +#include +#include #include #include #include @@ -26,27 +28,41 @@ int arch_fixup_fdt(void *blob) return 0; } -int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) +/** + * announce_and_cleanup() - Print message and prepare for kernel boot + * + * @fake: non-zero to do everything except actually boot + */ +static void announce_and_cleanup(int fake) { - void (*kernel)(ulong hart, void *dtb); - - /* - * allow the PREP bootm subcommand, it is required for bootm to work - */ - if (flag & BOOTM_STATE_OS_PREP) - return 0; + printf("\nStarting kernel ...%s\n\n", fake ? + "(fake run for tracing)" : ""); + bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel"); +#ifdef CONFIG_BOOTSTAGE_FDT + bootstage_fdt_add_report(); +#endif +#ifdef CONFIG_BOOTSTAGE_REPORT + bootstage_report(); +#endif - if ((flag != 0) && (flag != BOOTM_STATE_OS_GO)) - return 1; +#ifdef CONFIG_USB_DEVICE + udc_disconnect(); +#endif - kernel = (void (*)(ulong, void *))images->ep; - invalidate_icache_all(); + board_quiesce_devices(); - bootstage_mark(BOOTSTAGE_ID_RUN_OS); + /* + * Call remove function of all devices with a removal flag set. + * This may be useful for last-stage operations, like cancelling + * of DMA operation or releasing device internal buffers. + */ + dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL); - debug("## Transferring control to Linux (at address %08lx) ...\n", - (ulong)kernel); + cleanup_before_linux(); +} +static void boot_prep_linux(bootm_headers_t *images) +{ if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) { #ifdef CONFIG_OF_LIBFDT debug("using: FDT\n"); @@ -55,24 +71,51 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) hang(); } #endif + } else { + printf("Device tree not found or missing FDT support\n"); + hang(); } +} - /* we assume that the kernel is in place */ - printf("\nStarting kernel ...\n\n"); +static void boot_jump_linux(bootm_headers_t *images, int flag) +{ + void (*kernel)(ulong hart, void *dtb); + int fake = (flag & BOOTM_STATE_OS_FAKE_GO); - /* - * Call remove function of all devices with a removal flag set. - * This may be useful for last-stage operations, like cancelling - * of DMA operation or releasing device internal buffers. - */ - dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL); + kernel = (void (*)(ulong, void *))images->ep; + invalidate_icache_all(); - cleanup_before_linux(); + bootstage_mark(BOOTSTAGE_ID_RUN_OS); - if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) - kernel(csr_read(mhartid), images->ft_addr); + debug("## Transferring control to Linux (at address %08lx) ...\n", + (ulong)kernel); - /* does not return */ + announce_and_cleanup(fake); - return 1; + if (!fake) { + if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) + kernel(csr_read(mhartid), images->ft_addr); + } +} + +int do_bootm_linux(int flag, int argc, char * const argv[], + bootm_headers_t *images) +{ + /* No need for those on RISC-V */ + if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE) + return -1; + + if (flag & BOOTM_STATE_OS_PREP) { + boot_prep_linux(images); + return 0; + } + + if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) { + boot_jump_linux(images, flag); + return 0; + } + + boot_prep_linux(images); + boot_jump_linux(images, flag); + return 0; } From patchwork Tue Oct 30 12:55:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990840 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksPl063lz9s7W for ; Wed, 31 Oct 2018 00:14:34 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 81510C220DC; Tue, 30 Oct 2018 13:05:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 064E2C22119; Tue, 30 Oct 2018 12:58:46 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7172FC220EB; Tue, 30 Oct 2018 12:57:31 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id D603DC22121 for ; Tue, 30 Oct 2018 12:57:27 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2HmAgC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBZYIFgg2MbaZgDYRsAoMlIjgWAQMBAQIBAQICAmkohTwGeRBRVwYOBYMhggEBqi2KJgkBhzdDg2OBWD+JboUOAo5kkCwHAoEOgQQEjmYLGIFSh2grhmMslnqBWiKBVTMaJIM7kFhuAYt3AQE X-IPAS-Result: A2HmAgC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBZYIFgg2MbaZgDYRsAoMlIjgWAQMBAQIBAQICAmkohTwGeRBRVwYOBYMhggEBqi2KJgkBhzdDg2OBWD+JboUOAo5kkCwHAoEOgQQEjmYLGIFSh2grhmMslnqBWiKBVTMaJIM7kFhuAYt3AQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904654" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:27 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0C5AgCMVNhb/xBhWMBkHAEBAQQBAQcEAQGBZYNYOoxtpmANhGwCg0Y4FgEDAQECAQECbSiFOwZ5EFFXBg4FgyGCAqouiiYJAYc3Q4U7P4luhQ4CjmSQLAcCgQ6BBASOZgsYgVKHaCuGYyyWeoFaIYFVMxokgzuQWD4wAYt3AQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525695" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:27 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:26 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:50 +0100 Message-ID: <20181030125553.5230-28-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--1.728400-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Subject: [U-Boot] [PATCH v2 27/29] dm: core: add missing prototype for ofnode_read_u64 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Signed-off-by: Lukas Auer Reviewed-by: Bin Meng Reviewed-by: Simon Glass --- Changes in v2: - Move prototype location to match the location of the function in ofnode.c include/dm/ofnode.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index 2fc9fa39a3..92539b8b5f 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -236,6 +236,16 @@ int ofnode_read_u32_default(ofnode ref, const char *propname, u32 def); */ int ofnode_read_s32_default(ofnode node, const char *propname, s32 def); +/** + * ofnode_read_u64() - Read a 64-bit integer from a property + * + * @node: valid node reference to read property from + * @propname: name of the property to read from + * @outp: place to put value (if found) + * @return 0 if OK, -ve on error + */ +int ofnode_read_u64(ofnode node, const char *propname, u64 *outp); + /** * ofnode_read_u64_default() - Read a 64-bit integer from a property * From patchwork Tue Oct 30 12:55:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990838 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksP74CSJz9s7T for ; Wed, 31 Oct 2018 00:14:03 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 21DB1C220E1; Tue, 30 Oct 2018 13:05:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 4E8F8C22114; Tue, 30 Oct 2018 12:59:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CA9C0C220EB; Tue, 30 Oct 2018 12:57:31 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id 83D68C220F7 for ; Tue, 30 Oct 2018 12:57:28 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2GwAAC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBVAQBAQsBggSCDYxtpmANhGwCgyUiNwoNAQMBAQIBAQICAmkohTwGdAUQUVcGDgWDIYIBAaothTyEagkBhzeEJoFYP4ERh1mGEgKUdooaBwKBDoEEBI5mCxiJOocOk3yDKoFZI4FVMxokgzuCJheOG24BiSqCTQEB X-IPAS-Result: A2GwAAC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBVAQBAQsBggSCDYxtpmANhGwCgyUiNwoNAQMBAQIBAQICAmkohTwGdAUQUVcGDgWDIYIBAaothTyEagkBhzeEJoFYP4ERh1mGEgKUdooaBwKBDoEEBI5mCxiJOocOk3yDKoFZI4FVMxokgzuCJheOG24BiSqCTQEB X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904655" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:28 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DxAACMVNhb/xBhWMBkHQEBBQEHBQGBVAUBCwGDVzqMbaZgDYRsAoNGNwoNAQMBAQIBAQJtKIU7BnQFEFFXBg4FgyGCAqouhTyEagkBhzeFfj+BEYdZhhIClHaKGgcCgQ6BBASOZgsYiTqHDpN8gyqBWSKBVTMaJIM7giYXjhs+MAGJKoJNAQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525697" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:27 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:27 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:51 +0100 Message-ID: <20181030125553.5230-29-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--3.958300-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Subject: [U-Boot] [PATCH v2 28/29] riscv: qemu: detect and boot the kernel passed by QEMU X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" QEMU embeds the location of the kernel image in the device tree. Store this address in the environment as variable kernel_start and use it in CONFIG_BOOTCOMMAND to boot the kernel. Use the device tree passed by the prior boot stage to boot Linux. Signed-off-by: Lukas Auer --- Changes in v2: - Rebase onto u-boot-dm/next - Boot Linux with the device tree provided by the prior boot stage board/emulation/qemu-riscv/Kconfig | 1 + board/emulation/qemu-riscv/qemu-riscv.c | 29 +++++++++++++++++++++++++ configs/qemu-riscv32_defconfig | 1 + configs/qemu-riscv64_defconfig | 1 + include/configs/qemu-riscv.h | 10 ++++++++- 5 files changed, 41 insertions(+), 1 deletion(-) diff --git a/board/emulation/qemu-riscv/Kconfig b/board/emulation/qemu-riscv/Kconfig index 37a80db6a9..be5839b7db 100644 --- a/board/emulation/qemu-riscv/Kconfig +++ b/board/emulation/qemu-riscv/Kconfig @@ -29,5 +29,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply CMD_EXT2 imply CMD_EXT4 imply CMD_FAT + imply BOARD_LATE_INIT endif diff --git a/board/emulation/qemu-riscv/qemu-riscv.c b/board/emulation/qemu-riscv/qemu-riscv.c index 2ce093e19a..ee20983095 100644 --- a/board/emulation/qemu-riscv/qemu-riscv.c +++ b/board/emulation/qemu-riscv/qemu-riscv.c @@ -19,3 +19,32 @@ int board_init(void) return 0; } + +int board_late_init(void) +{ + ulong kernel_start; + ofnode chosen_node; + int ret; + + chosen_node = ofnode_path("/chosen"); + if (!ofnode_valid(chosen_node)) { + printf("No chosen node found\n"); + return 0; + } + +#ifdef CONFIG_ARCH_RV64I + ret = ofnode_read_u64(chosen_node, "riscv,kernel-start", + (u64 *)&kernel_start); +#else + ret = ofnode_read_u32(chosen_node, "riscv,kernel-start", + (u32 *)&kernel_start); +#endif + if (ret) { + printf("Can't find kernel start address in device tree\n"); + return 0; + } + + env_set_hex("kernel_start", kernel_start); + + return 0; +} diff --git a/configs/qemu-riscv32_defconfig b/configs/qemu-riscv32_defconfig index b55644378a..13dd53a550 100644 --- a/configs/qemu-riscv32_defconfig +++ b/configs/qemu-riscv32_defconfig @@ -4,4 +4,5 @@ CONFIG_NR_DRAM_BANKS=1 CONFIG_FIT=y CONFIG_DISPLAY_CPUINFO=y CONFIG_DISPLAY_BOARDINFO=y +CONFIG_HUSH_PARSER=y CONFIG_OF_PRIOR_STAGE=y diff --git a/configs/qemu-riscv64_defconfig b/configs/qemu-riscv64_defconfig index a542ac4893..06eb3042fa 100644 --- a/configs/qemu-riscv64_defconfig +++ b/configs/qemu-riscv64_defconfig @@ -5,4 +5,5 @@ CONFIG_NR_DRAM_BANKS=1 CONFIG_FIT=y CONFIG_DISPLAY_CPUINFO=y CONFIG_DISPLAY_BOARDINFO=y +CONFIG_HUSH_PARSER=y CONFIG_OF_PRIOR_STAGE=y diff --git a/include/configs/qemu-riscv.h b/include/configs/qemu-riscv.h index ba6a18f2e6..7c88ba300a 100644 --- a/include/configs/qemu-riscv.h +++ b/include/configs/qemu-riscv.h @@ -21,7 +21,15 @@ #define CONFIG_ENV_SIZE SZ_4K #define CONFIG_EXTRA_ENV_SETTINGS \ - "fdt_high=0xffffffffffffffff\0" \ + "fdt_high=0x82000000\0" \ + "bootm_size=0x10000000\0" \ "initrd_high=0xffffffffffffffff\0" +#define CONFIG_BOOTCOMMAND \ + "if env exists kernel_start; then " \ + "bootm ${kernel_start} - ${prior_stage_dtb};" \ + "else " \ + "echo Kernel address not found in the device tree;" \ + "fi;" + #endif /* __CONFIG_H */ From patchwork Tue Oct 30 12:55:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990841 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksRN0Nnrz9s7T for ; Wed, 31 Oct 2018 00:15:58 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 8CE39C2212B; Tue, 30 Oct 2018 13:05:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 6B02AC22129; Tue, 30 Oct 2018 12:59:38 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 740B2C220FA; Tue, 30 Oct 2018 12:57:33 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id 4B09DC22122 for ; Tue, 30 Oct 2018 12:57:29 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2GwAAC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBVAQBAQsBggSCDYxtpHqBZg2EbAKDJSI3Cg0BAwEBAgEBAgICaSiFPAZ5EFFXBg4FgyGCAQGqLYU8hGoJAYc3hCaBWD+BEYd4ZYUOAp8QBwKBDoEEBI5mCxiJOocOgmuREYMqgVkjgVUzGiSDO4ImFxKOCW4Bi3cBAQ X-IPAS-Result: A2GwAAC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBVAQBAQsBggSCDYxtpHqBZg2EbAKDJSI3Cg0BAwEBAgEBAgICaSiFPAZ5EFFXBg4FgyGCAQGqLYU8hGoJAYc3hCaBWD+BEYd4ZYUOAp8QBwKBDoEEBI5mCxiJOocOgmuREYMqgVkjgVUzGiSDO4ImFxKOCW4Bi3cBAQ X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904658" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:29 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DxAACMVNhb/xBhWMBkHQEBBQEHBQGBVAUBCwGDVzqMbaR6gWYNhGwCg0Y3Cg0BAwEBAgEBAm0ohTsGeRBRVwYOBYMhggKqLoU8hGoJAYc3hX4/gRGHeGWFDgKfEAcCgQ6BBASOZgsYiTqHDoJrkRGDKoFZIoFVMxokgzuCJhcSjgk+MAGLdwEB X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525698" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:28 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:28 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:52 +0100 Message-ID: <20181030125553.5230-30-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--3.006200-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Subject: [U-Boot] [PATCH v2 29/29] riscv: qemu: clear kernel-start/-end in device tree as workaround for BBL X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" QEMU specifies the location of Linux (supplied with the -kernel argument) in the device tree using the riscv,kernel-start and riscv,kernel-end properties. We currently rely on the SBI implementation of BBL to run Linux and therefore embed Linux as payload in BBL. This causes an issue, because BBL detects the kernel properties in the device tree and ignores the Linux payload as a result. Work around this issue by clearing the kernel properties in the device tree before booting Linux. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng --- Changes in v2: - New patch board/emulation/qemu-riscv/Kconfig | 1 + board/emulation/qemu-riscv/qemu-riscv.c | 39 +++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/board/emulation/qemu-riscv/Kconfig b/board/emulation/qemu-riscv/Kconfig index be5839b7db..33ca253432 100644 --- a/board/emulation/qemu-riscv/Kconfig +++ b/board/emulation/qemu-riscv/Kconfig @@ -30,5 +30,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply CMD_EXT4 imply CMD_FAT imply BOARD_LATE_INIT + imply OF_BOARD_SETUP endif diff --git a/board/emulation/qemu-riscv/qemu-riscv.c b/board/emulation/qemu-riscv/qemu-riscv.c index ee20983095..a938b0b39f 100644 --- a/board/emulation/qemu-riscv/qemu-riscv.c +++ b/board/emulation/qemu-riscv/qemu-riscv.c @@ -48,3 +48,42 @@ int board_late_init(void) return 0; } + +/* + * QEMU specifies the location of Linux (supplied with the -kernel argument) + * in the device tree using the riscv,kernel-start and riscv,kernel-end + * properties. We currently rely on the SBI implementation of BBL to run + * Linux and therefore embed Linux as payload in BBL. This causes an issue, + * because BBL detects the kernel properties in the device tree and ignores + * the Linux payload as a result. To work around this issue, we clear the + * kernel properties before booting Linux. + * + * This workaround can be removed, once we do not require BBL for its SBI + * implementation anymore. + */ +int ft_board_setup(void *blob, bd_t *bd) +{ + int chosen_offset, ret; + + chosen_offset = fdt_path_offset(blob, "/chosen"); + if (chosen_offset < 0) + return 0; + +#ifdef CONFIG_ARCH_RV64I + ret = fdt_setprop_u64(blob, chosen_offset, "riscv,kernel-start", 0); +#else + ret = fdt_setprop_u32(blob, chosen_offset, "riscv,kernel-start", 0); +#endif + if (ret) + return ret; + +#ifdef CONFIG_ARCH_RV64I + ret = fdt_setprop_u64(blob, chosen_offset, "riscv,kernel-end", 0); +#else + ret = fdt_setprop_u32(blob, chosen_offset, "riscv,kernel-end", 0); +#endif + if (ret) + return ret; + + return 0; +}