From patchwork Wed May 20 07:39:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1294086 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=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Vm4PxIFV; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49Rl7v1FcKz9sT4 for ; Wed, 20 May 2020 17:42:03 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 04B9E81E8E; Wed, 20 May 2020 09:41:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Vm4PxIFV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D550581E92; Wed, 20 May 2020 09:41:53 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 561D681E8C for ; Wed, 20 May 2020 09:41:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pj1-x1041.google.com with SMTP id q24so867205pjd.1 for ; Wed, 20 May 2020 00:41:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=5T/5JMrtj4qBVJQeFxVfhc4KNQHaJbagpwKmp7rQOzg=; b=Vm4PxIFVXJpx3zkoXvxnP/H7HnG59okEf/WmRo9gUnDsam/0zAZneBuaNQLaHpYxRx g8n3C9au8fTS62VF5DP3WSWWVi+dU27Iz0TM5kqC3xvMxPu5z8Ta/y7xznw+VYoLd1Et 9VnP8KElAN/2T7fihnJt8eOjh4OG+LYDtrBdZC5jaFIY1mEMP2gXNBq6j2ZArs+vuTsj bYpuYDMfPeYJ2uich4nfgcjnHvCyUzPJV4EqYpbr3VCuzcVbVfIPvO0WJPeBhiT5UO5F a97L/RInQsRHHoOeIFAHn3TUPLGQxxtFkjxLq8U1Ve7XOVVUNSdfeWVcejsbMZLTPdAr pfHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=5T/5JMrtj4qBVJQeFxVfhc4KNQHaJbagpwKmp7rQOzg=; b=gzUzdffFpSBFZo2YIYA1crGq0/7L2hzwMK7WsxARBCm5wD1bS3bb6XAHf4U8D1NUjF tDz48GmhOlWsza5ILR0/114I8khS3nix6+z0DiDW1Pnj4d6eEDKOKLaDYYt1uR2hTHYq 8Zo/dfoalA+9vmI5Ykn8RVr7bI4nQev+FWJYtMtRJfaVfKJnPHiU4jJeYQOW9GeJpuq5 iDLbSNFhfdYpDBoDCug+2HonmQCu70LsQFbU4iM9Imo2kE5OuDZQlhOdxplqQzhjPesC UeBHZfY2eVKxUOx+t4qy4V9fQBLkSJ6ErXmXxmcsNQ/DfMZfOTe1A5Y6jAjJO6sRu3qx b1gw== X-Gm-Message-State: AOAM531GjRjhiZTEDw2UW9RvlPJ+tPeZS2qQq/TxWhXrkS0R+gmQfOgY twzMeqgHS0P9nmfVCVbsbes= X-Google-Smtp-Source: ABdhPJxIhI8YdwAD0d/fXb2y1JSsODiKtUAcQ6d1veJw2wRHeXicWnCZ4gjAFh9+TT8YUe/HCSHYXQ== X-Received: by 2002:a17:90a:26ea:: with SMTP id m97mr3449395pje.188.1589960508550; Wed, 20 May 2020 00:41:48 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id g17sm1443198pfr.85.2020.05.20.00.41.47 (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 20 May 2020 00:41:48 -0700 (PDT) From: Bin Meng To: Rick Chen , U-Boot Mailing List Cc: Bin Meng Subject: [PATCH 1/2] riscv: Avoid the reserved memory fixup if src and dst point to the same place Date: Wed, 20 May 2020 00:39:30 -0700 Message-Id: <1589960371-20635-1-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean From: Bin Meng The copy of reserved memory node from source dtb to destination dtb can be avoided if they point to the same place. This is useful when OF_PRIOR_STAGE is used. Signed-off-by: Bin Meng Reviewed-by: Rick Chen --- arch/riscv/lib/fdt_fixup.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/riscv/lib/fdt_fixup.c b/arch/riscv/lib/fdt_fixup.c index 6db48ad..5f523f0 100644 --- a/arch/riscv/lib/fdt_fixup.c +++ b/arch/riscv/lib/fdt_fixup.c @@ -82,10 +82,9 @@ int riscv_fdt_copy_resv_mem_node(const void *src, void *dst) * @fdt: Pointer to the device tree in which reserved memory node needs to be * added. * - * In RISC-V, any board compiled with OF_SEPARATE needs to copy the reserved - * memory node from the device tree provided by the firmware to the device tree - * used by U-Boot. This is a common function that individual board fixup - * functions can invoke. + * In RISC-V, any board needs to copy the reserved memory node from the device + * tree provided by the firmware to the device tree used by U-Boot. This is a + * common function that individual board fixup functions can invoke. * * Return: 0 on success or error otherwise. */ @@ -95,6 +94,11 @@ int riscv_board_reserved_mem_fixup(void *fdt) void *src_fdt_addr; src_fdt_addr = map_sysmem(gd->arch.firmware_fdt_addr, 0); + + /* avoid the copy if we are using the same device tree */ + if (src_fdt_addr == fdt) + return 0; + err = riscv_fdt_copy_resv_mem_node(src_fdt_addr, fdt); if (err < 0) return err; From patchwork Wed May 20 07:39:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1294087 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=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=B9ueJlik; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49Rl9G0HVPz9sT8 for ; Wed, 20 May 2020 17:43:13 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 995BE81E9E; Wed, 20 May 2020 09:42:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="B9ueJlik"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 71CB781E91; Wed, 20 May 2020 09:41:54 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1FB4C81E8E for ; Wed, 20 May 2020 09:41:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pl1-x642.google.com with SMTP id m7so980972plt.5 for ; Wed, 20 May 2020 00:41:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=S5c9Prf+U9sT0FxoRxvjuBOQnw9RZRDloBCeOGV6IMU=; b=B9ueJlik9EoSy6TgIZv4l5mQhaNfO34HLMBGPFLzujQhbojWTPh8U5iqL70jIBlgTw eqBEq+fTdut1PMzcg8YOZfN88OiNjkuQxbtuso2pmvVEkcKJGCduXZrflXVnx+4gTPvZ PoshBAM63JqdrMUNf90Z722DuXe4M7+J6H3veR/HV2DK3MBYGoRbRuDCG+OUkXCGECAh ErDeNa/WWXN+C2XSaao07CVQGe9lchcBZZ1hpAlFNDtIoO30NuRQyIseWiQ6HhWlpi2+ MAZSBofQfwPCPsYoDFD3LKmcvg5Oj2ELeHHsZfxf3xIrmsIW8USptf9O0CG9pW4kxUNK gl9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=S5c9Prf+U9sT0FxoRxvjuBOQnw9RZRDloBCeOGV6IMU=; b=d1As2ocbqK20l1SUce1V/hozgyPup9NoMjRr13NENukOQ69DvLoxDZNyTJ1dC/YtsH 0nu2qcBYTG81D53/jqMI8WBQTSp/DFVGQP0cLg9bmG81uTnEr3Q8wlXeSp6uliGjqR1c w2KOsIa9dUnKD/12ujGj8W0Dn8Jig7Tnpb1bMpqOTMpcb65C/65bndQgyRH4Kz3uuHDD HLuc8lmV2GkwVcp6W83QVUpRTk8McL67osIhussBm3lpfOEim1vROg8w+ddGtsSurBv4 iTEkGn7N57nJrHiNOQetXaFNulrcQUE8JWWjDEaBE6RtqvinvTmGm8Y6QbFgbqfp1pA1 26tw== X-Gm-Message-State: AOAM530vUXhFc5sqhWXY2s5PkhcuUgvQK3WxC4yR1Tn/7ix+R+1ZSgCE OWBWnJI7rCRnvUOYFFCq+Po= X-Google-Smtp-Source: ABdhPJwfYPH8nMubWzmkw87hp2hZfcfYia+cS0rKUSNLzk6yVFl5MujrT0QNGKU9S/Fd3BgcANVDQA== X-Received: by 2002:a17:90b:23cb:: with SMTP id md11mr3955967pjb.108.1589960509489; Wed, 20 May 2020 00:41:49 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id g17sm1443198pfr.85.2020.05.20.00.41.48 (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 20 May 2020 00:41:49 -0700 (PDT) From: Bin Meng To: Rick Chen , U-Boot Mailing List Cc: Bin Meng Subject: [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default Date: Wed, 20 May 2020 00:39:31 -0700 Message-Id: <1589960371-20635-2-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1589960371-20635-1-git-send-email-bmeng.cn@gmail.com> References: <1589960371-20635-1-git-send-email-bmeng.cn@gmail.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean From: Bin Meng Starting from OpenSBI v0.7, the SBI firmware inserts/fixes up the reserved memory node for PMP protected memory regions. All RISC-V boards needs to copy the reserved memory node from the device tree provided by the firmware to the device tree used by U-Boot. Turn on CONFIG_OF_BOARD_FIXUP by default. Signed-off-by: Bin Meng --- arch/riscv/Kconfig | 3 +++ configs/sifive_fu540_defconfig | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index fb5fe5a..5176b35 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -272,4 +272,7 @@ config STACK_SIZE_SHIFT int default 14 +config OF_BOARD_FIXUP + default y + endmenu diff --git a/configs/sifive_fu540_defconfig b/configs/sifive_fu540_defconfig index f805aac..6d61e6c 100644 --- a/configs/sifive_fu540_defconfig +++ b/configs/sifive_fu540_defconfig @@ -9,7 +9,6 @@ CONFIG_FIT=y CONFIG_MISC_INIT_R=y CONFIG_DISPLAY_CPUINFO=y CONFIG_DISPLAY_BOARDINFO=y -CONFIG_OF_BOARD_FIXUP=y CONFIG_DEFAULT_DEVICE_TREE="hifive-unleashed-a00" CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_DM_MTD=y