All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] riscv: Avoid the reserved memory fixup if src and dst point to the same place
@ 2020-05-20  7:39 Bin Meng
  2020-05-20  7:39 ` [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default Bin Meng
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Bin Meng @ 2020-05-20  7:39 UTC (permalink / raw)
  To: u-boot

From: Bin Meng <bin.meng@windriver.com>

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 <bin.meng@windriver.com>
---

 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;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
  2020-05-20  7:39 [PATCH 1/2] riscv: Avoid the reserved memory fixup if src and dst point to the same place Bin Meng
@ 2020-05-20  7:39 ` Bin Meng
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4710061@ATCPCS16.andestech.com>
  2020-05-26  8:53 ` [PATCH 1/2] riscv: Avoid the reserved memory fixup if src and dst point to the same place Bin Meng
       [not found] ` <752D002CFF5D0F4FA35C0100F1D73F3FA4710055@ATCPCS16.andestech.com>
  2 siblings, 1 reply; 21+ messages in thread
From: Bin Meng @ 2020-05-20  7:39 UTC (permalink / raw)
  To: u-boot

From: Bin Meng <bin.meng@windriver.com>

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 <bin.meng@windriver.com>
---

 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
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 1/2] riscv: Avoid the reserved memory fixup if src and dst point to the same place
  2020-05-20  7:39 [PATCH 1/2] riscv: Avoid the reserved memory fixup if src and dst point to the same place Bin Meng
  2020-05-20  7:39 ` [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default Bin Meng
@ 2020-05-26  8:53 ` Bin Meng
       [not found] ` <752D002CFF5D0F4FA35C0100F1D73F3FA4710055@ATCPCS16.andestech.com>
  2 siblings, 0 replies; 21+ messages in thread
From: Bin Meng @ 2020-05-26  8:53 UTC (permalink / raw)
  To: u-boot

On Wed, May 20, 2020 at 3:41 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> From: Bin Meng <bin.meng@windriver.com>
>
> 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 <bin.meng@windriver.com>
> ---
>
>  arch/riscv/lib/fdt_fixup.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>

Ping?

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 1/2] riscv: Avoid the reserved memory fixup if src and dst point to the same place
       [not found] ` <752D002CFF5D0F4FA35C0100F1D73F3FA4710055@ATCPCS16.andestech.com>
@ 2020-05-28  8:01   ` Rick Chen
  0 siblings, 0 replies; 21+ messages in thread
From: Rick Chen @ 2020-05-28  8:01 UTC (permalink / raw)
  To: u-boot

> From: Bin Meng [mailto:bmeng.cn at gmail.com]
> Sent: Wednesday, May 20, 2020 3:40 PM
> To: Rick Jian-Zhi 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
>
> From: Bin Meng <bin.meng@windriver.com>
>
> 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 <bin.meng@windriver.com>
> ---

Reviewed-by: Rick Chen <rick@andestech.com>

>
>  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;
> --
> 2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
       [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4710061@ATCPCS16.andestech.com>
@ 2020-05-28  8:16     ` Rick Chen
  2020-05-28  8:24       ` Bin Meng
  0 siblings, 1 reply; 21+ messages in thread
From: Rick Chen @ 2020-05-28  8:16 UTC (permalink / raw)
  To: u-boot

Hi Bin

> From: Bin Meng [mailto:bmeng.cn at gmail.com]
> Sent: Wednesday, May 20, 2020 3:40 PM
> To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
> Cc: Bin Meng
> Subject: [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
>
> From: Bin Meng <bin.meng@windriver.com>
>
> 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 <bin.meng@windriver.com>
> ---
>
>  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

I think it shall invoke by individual board, just like the description
of riscv_fdt_copy_resv_mem_node function.

In [PATCH 1/2] if source and destination are the same place, it represent that
OF_BOARD_FIXUP is unnecessary.

BTW when I try OF_SEPARATE and OF_BOARD_FIXUP both are enabled, it hit
the problem as below:

U-Boot SPL 2020.07-rc3-16981-g4332225-dirty (May 28 2020 - 14:48:18 +0800)
Trying to boot from RAM


U-Boot 2020.07-rc3-16981-g4332225-dirty (May 28 2020 - 14:48:18 +0800)

DRAM:  1 GiB
failed to add reserved memory: -3
failed to fixup DT for reserved memory: -3
initcall sequence 0000000001253c20 failed at call 000000000120b8e0 (err=-3)
### ERROR ### Please RESET the board ###

I will dig in and figure out what is going on here ?
Maybe there exist a potential issue somehow!

Thanks,
Rick

> +
>  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
> --
> 2.7.4

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
  2020-05-28  8:16     ` Rick Chen
@ 2020-05-28  8:24       ` Bin Meng
  2020-05-28  8:48         ` Bin Meng
  2020-06-01  7:36         ` Rick Chen
  0 siblings, 2 replies; 21+ messages in thread
From: Bin Meng @ 2020-05-28  8:24 UTC (permalink / raw)
  To: u-boot

Hi Rick,

On Thu, May 28, 2020 at 4:17 PM Rick Chen <rickchen36@gmail.com> wrote:
>
> Hi Bin
>
> > From: Bin Meng [mailto:bmeng.cn at gmail.com]
> > Sent: Wednesday, May 20, 2020 3:40 PM
> > To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
> > Cc: Bin Meng
> > Subject: [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
> >
> > From: Bin Meng <bin.meng@windriver.com>
> >
> > 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 <bin.meng@windriver.com>
> > ---
> >
> >  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
>
> I think it shall invoke by individual board, just like the description
> of riscv_fdt_copy_resv_mem_node function.

I believe we should turn on this feature by default for every RISC-V
board, because SBI firmware used memory must be marked as reserved
otherwise OS might use it and get crashed. For boards which don't want
to enable this, they can unset the option in their board defconfig
files. This is to reduce some maintenance effort.

>
> In [PATCH 1/2] if source and destination are the same place, it represent that
> OF_BOARD_FIXUP is unnecessary.
>
> BTW when I try OF_SEPARATE and OF_BOARD_FIXUP both are enabled, it hit
> the problem as below:
>
> U-Boot SPL 2020.07-rc3-16981-g4332225-dirty (May 28 2020 - 14:48:18 +0800)
> Trying to boot from RAM
>
>
> U-Boot 2020.07-rc3-16981-g4332225-dirty (May 28 2020 - 14:48:18 +0800)
>
> DRAM:  1 GiB
> failed to add reserved memory: -3

-3 means FDT_ERR_NOSPACE.

The FDT does not have enough space to add reserved memory node. Could
you please check your FDT blob?

> failed to fixup DT for reserved memory: -3
> initcall sequence 0000000001253c20 failed at call 000000000120b8e0 (err=-3)
> ### ERROR ### Please RESET the board ###
>
> I will dig in and figure out what is going on here ?
> Maybe there exist a potential issue somehow!
>

Regards,
Bin

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
  2020-05-28  8:24       ` Bin Meng
@ 2020-05-28  8:48         ` Bin Meng
  2020-06-01  7:40           ` Rick Chen
  2020-06-01  7:36         ` Rick Chen
  1 sibling, 1 reply; 21+ messages in thread
From: Bin Meng @ 2020-05-28  8:48 UTC (permalink / raw)
  To: u-boot

Hi Rick,

On Thu, May 28, 2020 at 4:24 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Hi Rick,
>
> On Thu, May 28, 2020 at 4:17 PM Rick Chen <rickchen36@gmail.com> wrote:
> >
> > Hi Bin
> >
> > > From: Bin Meng [mailto:bmeng.cn at gmail.com]
> > > Sent: Wednesday, May 20, 2020 3:40 PM
> > > To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
> > > Cc: Bin Meng
> > > Subject: [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
> > >
> > > From: Bin Meng <bin.meng@windriver.com>
> > >
> > > 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 <bin.meng@windriver.com>
> > > ---
> > >
> > >  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
> >
> > I think it shall invoke by individual board, just like the description
> > of riscv_fdt_copy_resv_mem_node function.
>
> I believe we should turn on this feature by default for every RISC-V
> board, because SBI firmware used memory must be marked as reserved
> otherwise OS might use it and get crashed. For boards which don't want
> to enable this, they can unset the option in their board defconfig
> files. This is to reduce some maintenance effort.
>
> >
> > In [PATCH 1/2] if source and destination are the same place, it represent that
> > OF_BOARD_FIXUP is unnecessary.
> >
> > BTW when I try OF_SEPARATE and OF_BOARD_FIXUP both are enabled, it hit
> > the problem as below:
> >
> > U-Boot SPL 2020.07-rc3-16981-g4332225-dirty (May 28 2020 - 14:48:18 +0800)
> > Trying to boot from RAM
> >
> >
> > U-Boot 2020.07-rc3-16981-g4332225-dirty (May 28 2020 - 14:48:18 +0800)
> >
> > DRAM:  1 GiB
> > failed to add reserved memory: -3
>
> -3 means FDT_ERR_NOSPACE.
>
> The FDT does not have enough space to add reserved memory node. Could
> you please check your FDT blob?
>
> > failed to fixup DT for reserved memory: -3
> > initcall sequence 0000000001253c20 failed at call 000000000120b8e0 (err=-3)
> > ### ERROR ### Please RESET the board ###
> >
> > I will dig in and figure out what is going on here ?
> > Maybe there exist a potential issue somehow!

Could you please try this patch?
http://patchwork.ozlabs.org/project/uboot/patch/1590655604-13704-2-git-send-email-bmeng.cn at gmail.com/

Regards,
Bin

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
  2020-05-28  8:24       ` Bin Meng
  2020-05-28  8:48         ` Bin Meng
@ 2020-06-01  7:36         ` Rick Chen
  2020-06-01  9:04           ` Bin Meng
  1 sibling, 1 reply; 21+ messages in thread
From: Rick Chen @ 2020-06-01  7:36 UTC (permalink / raw)
  To: u-boot

Hi Bin

> Hi Rick,
>
> On Thu, May 28, 2020 at 4:17 PM Rick Chen <rickchen36@gmail.com> wrote:
> >
> > Hi Bin
> >
> > > From: Bin Meng [mailto:bmeng.cn at gmail.com]
> > > Sent: Wednesday, May 20, 2020 3:40 PM
> > > To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
> > > Cc: Bin Meng
> > > Subject: [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
> > >
> > > From: Bin Meng <bin.meng@windriver.com>
> > >
> > > 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 <bin.meng@windriver.com>
> > > ---
> > >
> > >  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
> >
> > I think it shall invoke by individual board, just like the description
> > of riscv_fdt_copy_resv_mem_node function.
>
> I believe we should turn on this feature by default for every RISC-V
> board, because SBI firmware used memory must be marked as reserved
> otherwise OS might use it and get crashed. For boards which don't want
> to enable this, they can unset the option in their board defconfig
> files. This is to reduce some maintenance effort.

But not all RISC-V boards need this configuration.
If we enable it by default, non spl configuration will run this fdt
fix flow, but it is unnecessary.

Thanks,
Rick

>
> >
> > In [PATCH 1/2] if source and destination are the same place, it represent that
> > OF_BOARD_FIXUP is unnecessary.
> >
> > BTW when I try OF_SEPARATE and OF_BOARD_FIXUP both are enabled, it hit
> > the problem as below:
> >
> > U-Boot SPL 2020.07-rc3-16981-g4332225-dirty (May 28 2020 - 14:48:18 +0800)
> > Trying to boot from RAM
> >
> >
> > U-Boot 2020.07-rc3-16981-g4332225-dirty (May 28 2020 - 14:48:18 +0800)
> >
> > DRAM:  1 GiB
> > failed to add reserved memory: -3
>
> -3 means FDT_ERR_NOSPACE.
>
> The FDT does not have enough space to add reserved memory node. Could
> you please check your FDT blob?
>
> > failed to fixup DT for reserved memory: -3
> > initcall sequence 0000000001253c20 failed at call 000000000120b8e0 (err=-3)
> > ### ERROR ### Please RESET the board ###
> >
> > I will dig in and figure out what is going on here ?
> > Maybe there exist a potential issue somehow!
> >
>
> Regards,
> Bin

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
  2020-05-28  8:48         ` Bin Meng
@ 2020-06-01  7:40           ` Rick Chen
  2020-06-01  9:05             ` Bin Meng
  0 siblings, 1 reply; 21+ messages in thread
From: Rick Chen @ 2020-06-01  7:40 UTC (permalink / raw)
  To: u-boot

Hi Bin

> Hi Rick,
>
> On Thu, May 28, 2020 at 4:24 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > Hi Rick,
> >
> > On Thu, May 28, 2020 at 4:17 PM Rick Chen <rickchen36@gmail.com> wrote:
> > >
> > > Hi Bin
> > >
> > > > From: Bin Meng [mailto:bmeng.cn at gmail.com]
> > > > Sent: Wednesday, May 20, 2020 3:40 PM
> > > > To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
> > > > Cc: Bin Meng
> > > > Subject: [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
> > > >
> > > > From: Bin Meng <bin.meng@windriver.com>
> > > >
> > > > 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 <bin.meng@windriver.com>
> > > > ---
> > > >
> > > >  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
> > >
> > > I think it shall invoke by individual board, just like the description
> > > of riscv_fdt_copy_resv_mem_node function.
> >
> > I believe we should turn on this feature by default for every RISC-V
> > board, because SBI firmware used memory must be marked as reserved
> > otherwise OS might use it and get crashed. For boards which don't want
> > to enable this, they can unset the option in their board defconfig
> > files. This is to reduce some maintenance effort.
> >
> > >
> > > In [PATCH 1/2] if source and destination are the same place, it represent that
> > > OF_BOARD_FIXUP is unnecessary.
> > >
> > > BTW when I try OF_SEPARATE and OF_BOARD_FIXUP both are enabled, it hit
> > > the problem as below:
> > >
> > > U-Boot SPL 2020.07-rc3-16981-g4332225-dirty (May 28 2020 - 14:48:18 +0800)
> > > Trying to boot from RAM
> > >
> > >
> > > U-Boot 2020.07-rc3-16981-g4332225-dirty (May 28 2020 - 14:48:18 +0800)
> > >
> > > DRAM:  1 GiB
> > > failed to add reserved memory: -3
> >
> > -3 means FDT_ERR_NOSPACE.
> >
> > The FDT does not have enough space to add reserved memory node. Could
> > you please check your FDT blob?
> >
> > > failed to fixup DT for reserved memory: -3
> > > initcall sequence 0000000001253c20 failed at call 000000000120b8e0 (err=-3)
> > > ### ERROR ### Please RESET the board ###
> > >
> > > I will dig in and figure out what is going on here ?
> > > Maybe there exist a potential issue somehow!
>
> Could you please try this patch?
> http://patchwork.ozlabs.org/project/uboot/patch/1590655604-13704-2-git-send-email-bmeng.cn at gmail.com/

I try this patch, it still fail.
But after increase 32 more larger, it can pass.

Thanks,
Rick

>
> Regards,
> Bin

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
  2020-06-01  7:36         ` Rick Chen
@ 2020-06-01  9:04           ` Bin Meng
  2020-06-02  6:04             ` Rick Chen
  0 siblings, 1 reply; 21+ messages in thread
From: Bin Meng @ 2020-06-01  9:04 UTC (permalink / raw)
  To: u-boot

Hi Rick,

On Mon, Jun 1, 2020 at 3:36 PM Rick Chen <rickchen36@gmail.com> wrote:
>
> Hi Bin
>
> > Hi Rick,
> >
> > On Thu, May 28, 2020 at 4:17 PM Rick Chen <rickchen36@gmail.com> wrote:
> > >
> > > Hi Bin
> > >
> > > > From: Bin Meng [mailto:bmeng.cn at gmail.com]
> > > > Sent: Wednesday, May 20, 2020 3:40 PM
> > > > To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
> > > > Cc: Bin Meng
> > > > Subject: [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
> > > >
> > > > From: Bin Meng <bin.meng@windriver.com>
> > > >
> > > > 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 <bin.meng@windriver.com>
> > > > ---
> > > >
> > > >  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
> > >
> > > I think it shall invoke by individual board, just like the description
> > > of riscv_fdt_copy_resv_mem_node function.
> >
> > I believe we should turn on this feature by default for every RISC-V
> > board, because SBI firmware used memory must be marked as reserved
> > otherwise OS might use it and get crashed. For boards which don't want
> > to enable this, they can unset the option in their board defconfig
> > files. This is to reduce some maintenance effort.
>
> But not all RISC-V boards need this configuration.
> If we enable it by default, non spl configuration will run this fdt
> fix flow, but it is unnecessary.
>

Non SPL configuration also needs this, because U-Boot has to patch the
final DTB that is passed to the kernel. It's a RISC-V architecture
thing.

Regards,
Bin

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
  2020-06-01  7:40           ` Rick Chen
@ 2020-06-01  9:05             ` Bin Meng
  2020-06-02  5:23               ` Rick Chen
  0 siblings, 1 reply; 21+ messages in thread
From: Bin Meng @ 2020-06-01  9:05 UTC (permalink / raw)
  To: u-boot

Hi Rick,

On Mon, Jun 1, 2020 at 3:40 PM Rick Chen <rickchen36@gmail.com> wrote:
>
> Hi Bin
>
> > Hi Rick,
> >
> > On Thu, May 28, 2020 at 4:24 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> > >
> > > Hi Rick,
> > >
> > > On Thu, May 28, 2020 at 4:17 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > >
> > > > Hi Bin
> > > >
> > > > > From: Bin Meng [mailto:bmeng.cn at gmail.com]
> > > > > Sent: Wednesday, May 20, 2020 3:40 PM
> > > > > To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
> > > > > Cc: Bin Meng
> > > > > Subject: [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
> > > > >
> > > > > From: Bin Meng <bin.meng@windriver.com>
> > > > >
> > > > > 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 <bin.meng@windriver.com>
> > > > > ---
> > > > >
> > > > >  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
> > > >
> > > > I think it shall invoke by individual board, just like the description
> > > > of riscv_fdt_copy_resv_mem_node function.
> > >
> > > I believe we should turn on this feature by default for every RISC-V
> > > board, because SBI firmware used memory must be marked as reserved
> > > otherwise OS might use it and get crashed. For boards which don't want
> > > to enable this, they can unset the option in their board defconfig
> > > files. This is to reduce some maintenance effort.
> > >
> > > >
> > > > In [PATCH 1/2] if source and destination are the same place, it represent that
> > > > OF_BOARD_FIXUP is unnecessary.
> > > >
> > > > BTW when I try OF_SEPARATE and OF_BOARD_FIXUP both are enabled, it hit
> > > > the problem as below:
> > > >
> > > > U-Boot SPL 2020.07-rc3-16981-g4332225-dirty (May 28 2020 - 14:48:18 +0800)
> > > > Trying to boot from RAM
> > > >
> > > >
> > > > U-Boot 2020.07-rc3-16981-g4332225-dirty (May 28 2020 - 14:48:18 +0800)
> > > >
> > > > DRAM:  1 GiB
> > > > failed to add reserved memory: -3
> > >
> > > -3 means FDT_ERR_NOSPACE.
> > >
> > > The FDT does not have enough space to add reserved memory node. Could
> > > you please check your FDT blob?
> > >
> > > > failed to fixup DT for reserved memory: -3
> > > > initcall sequence 0000000001253c20 failed at call 000000000120b8e0 (err=-3)
> > > > ### ERROR ### Please RESET the board ###
> > > >
> > > > I will dig in and figure out what is going on here ?
> > > > Maybe there exist a potential issue somehow!
> >
> > Could you please try this patch?
> > http://patchwork.ozlabs.org/project/uboot/patch/1590655604-13704-2-git-send-email-bmeng.cn at gmail.com/
>
> I try this patch, it still fail.
> But after increase 32 more larger, it can pass.
>

What number did you enlarge this fdt size to?

Regards,
Bin

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
  2020-06-01  9:05             ` Bin Meng
@ 2020-06-02  5:23               ` Rick Chen
  2020-06-02  5:27                 ` Bin Meng
  0 siblings, 1 reply; 21+ messages in thread
From: Rick Chen @ 2020-06-02  5:23 UTC (permalink / raw)
  To: u-boot

Hi Bin

> Hi Rick,
>
> On Mon, Jun 1, 2020 at 3:40 PM Rick Chen <rickchen36@gmail.com> wrote:
> >
> > Hi Bin
> >
> > > Hi Rick,
> > >
> > > On Thu, May 28, 2020 at 4:24 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> > > >
> > > > Hi Rick,
> > > >
> > > > On Thu, May 28, 2020 at 4:17 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > > >
> > > > > Hi Bin
> > > > >
> > > > > > From: Bin Meng [mailto:bmeng.cn at gmail.com]
> > > > > > Sent: Wednesday, May 20, 2020 3:40 PM
> > > > > > To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
> > > > > > Cc: Bin Meng
> > > > > > Subject: [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
> > > > > >
> > > > > > From: Bin Meng <bin.meng@windriver.com>
> > > > > >
> > > > > > 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 <bin.meng@windriver.com>
> > > > > > ---
> > > > > >
> > > > > >  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
> > > > >
> > > > > I think it shall invoke by individual board, just like the description
> > > > > of riscv_fdt_copy_resv_mem_node function.
> > > >
> > > > I believe we should turn on this feature by default for every RISC-V
> > > > board, because SBI firmware used memory must be marked as reserved
> > > > otherwise OS might use it and get crashed. For boards which don't want
> > > > to enable this, they can unset the option in their board defconfig
> > > > files. This is to reduce some maintenance effort.
> > > >
> > > > >
> > > > > In [PATCH 1/2] if source and destination are the same place, it represent that
> > > > > OF_BOARD_FIXUP is unnecessary.
> > > > >
> > > > > BTW when I try OF_SEPARATE and OF_BOARD_FIXUP both are enabled, it hit
> > > > > the problem as below:
> > > > >
> > > > > U-Boot SPL 2020.07-rc3-16981-g4332225-dirty (May 28 2020 - 14:48:18 +0800)
> > > > > Trying to boot from RAM
> > > > >
> > > > >
> > > > > U-Boot 2020.07-rc3-16981-g4332225-dirty (May 28 2020 - 14:48:18 +0800)
> > > > >
> > > > > DRAM:  1 GiB
> > > > > failed to add reserved memory: -3
> > > >
> > > > -3 means FDT_ERR_NOSPACE.
> > > >
> > > > The FDT does not have enough space to add reserved memory node. Could
> > > > you please check your FDT blob?
> > > >
> > > > > failed to fixup DT for reserved memory: -3
> > > > > initcall sequence 0000000001253c20 failed at call 000000000120b8e0 (err=-3)
> > > > > ### ERROR ### Please RESET the board ###
> > > > >
> > > > > I will dig in and figure out what is going on here ?
> > > > > Maybe there exist a potential issue somehow!
> > >
> > > Could you please try this patch?
> > > http://patchwork.ozlabs.org/project/uboot/patch/1590655604-13704-2-git-send-email-bmeng.cn at gmail.com/
> >
> > I try this patch, it still fail.
> > But after increase 32 more larger, it can pass.
> >
>
> What number did you enlarge this fdt size to?

It looks like depend on individual boards. We can not  guarantee other
boards adopt this size at rum time.
That is why I suggest it shall be enabled individually.

Thanks,
Rick

>
> Regards,
> Bin

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
  2020-06-02  5:23               ` Rick Chen
@ 2020-06-02  5:27                 ` Bin Meng
  0 siblings, 0 replies; 21+ messages in thread
From: Bin Meng @ 2020-06-02  5:27 UTC (permalink / raw)
  To: u-boot

Hi Rick,

On Tue, Jun 2, 2020 at 1:23 PM Rick Chen <rickchen36@gmail.com> wrote:
>
> Hi Bin
>
> > Hi Rick,
> >
> > On Mon, Jun 1, 2020 at 3:40 PM Rick Chen <rickchen36@gmail.com> wrote:
> > >
> > > Hi Bin
> > >
> > > > Hi Rick,
> > > >
> > > > On Thu, May 28, 2020 at 4:24 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> > > > >
> > > > > Hi Rick,
> > > > >
> > > > > On Thu, May 28, 2020 at 4:17 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > > > >
> > > > > > Hi Bin
> > > > > >
> > > > > > > From: Bin Meng [mailto:bmeng.cn at gmail.com]
> > > > > > > Sent: Wednesday, May 20, 2020 3:40 PM
> > > > > > > To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
> > > > > > > Cc: Bin Meng
> > > > > > > Subject: [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
> > > > > > >
> > > > > > > From: Bin Meng <bin.meng@windriver.com>
> > > > > > >
> > > > > > > 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 <bin.meng@windriver.com>
> > > > > > > ---
> > > > > > >
> > > > > > >  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
> > > > > >
> > > > > > I think it shall invoke by individual board, just like the description
> > > > > > of riscv_fdt_copy_resv_mem_node function.
> > > > >
> > > > > I believe we should turn on this feature by default for every RISC-V
> > > > > board, because SBI firmware used memory must be marked as reserved
> > > > > otherwise OS might use it and get crashed. For boards which don't want
> > > > > to enable this, they can unset the option in their board defconfig
> > > > > files. This is to reduce some maintenance effort.
> > > > >
> > > > > >
> > > > > > In [PATCH 1/2] if source and destination are the same place, it represent that
> > > > > > OF_BOARD_FIXUP is unnecessary.
> > > > > >
> > > > > > BTW when I try OF_SEPARATE and OF_BOARD_FIXUP both are enabled, it hit
> > > > > > the problem as below:
> > > > > >
> > > > > > U-Boot SPL 2020.07-rc3-16981-g4332225-dirty (May 28 2020 - 14:48:18 +0800)
> > > > > > Trying to boot from RAM
> > > > > >
> > > > > >
> > > > > > U-Boot 2020.07-rc3-16981-g4332225-dirty (May 28 2020 - 14:48:18 +0800)
> > > > > >
> > > > > > DRAM:  1 GiB
> > > > > > failed to add reserved memory: -3
> > > > >
> > > > > -3 means FDT_ERR_NOSPACE.
> > > > >
> > > > > The FDT does not have enough space to add reserved memory node. Could
> > > > > you please check your FDT blob?
> > > > >
> > > > > > failed to fixup DT for reserved memory: -3
> > > > > > initcall sequence 0000000001253c20 failed at call 000000000120b8e0 (err=-3)
> > > > > > ### ERROR ### Please RESET the board ###
> > > > > >
> > > > > > I will dig in and figure out what is going on here ?
> > > > > > Maybe there exist a potential issue somehow!
> > > >
> > > > Could you please try this patch?
> > > > http://patchwork.ozlabs.org/project/uboot/patch/1590655604-13704-2-git-send-email-bmeng.cn at gmail.com/
> > >
> > > I try this patch, it still fail.
> > > But after increase 32 more larger, it can pass.
> > >
> >
> > What number did you enlarge this fdt size to?
>
> It looks like depend on individual boards. We can not  guarantee other
> boards adopt this size at rum time.
> That is why I suggest it shall be enabled individually.
>

This is a generic code and we should find a suitable size to get it
work on every board. We should provide a consistent interface for
every RISC-V board support, ie: we should not have some board turned
on this option but some board not.

Regards,
Bin

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
  2020-06-01  9:04           ` Bin Meng
@ 2020-06-02  6:04             ` Rick Chen
  2020-06-02  6:12               ` Bin Meng
  0 siblings, 1 reply; 21+ messages in thread
From: Rick Chen @ 2020-06-02  6:04 UTC (permalink / raw)
  To: u-boot

Hi Bin

> Hi Rick,
>
> On Mon, Jun 1, 2020 at 3:36 PM Rick Chen <rickchen36@gmail.com> wrote:
> >
> > Hi Bin
> >
> > > Hi Rick,
> > >
> > > On Thu, May 28, 2020 at 4:17 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > >
> > > > Hi Bin
> > > >
> > > > > From: Bin Meng [mailto:bmeng.cn at gmail.com]
> > > > > Sent: Wednesday, May 20, 2020 3:40 PM
> > > > > To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
> > > > > Cc: Bin Meng
> > > > > Subject: [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
> > > > >
> > > > > From: Bin Meng <bin.meng@windriver.com>
> > > > >
> > > > > 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 <bin.meng@windriver.com>
> > > > > ---
> > > > >
> > > > >  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
> > > >
> > > > I think it shall invoke by individual board, just like the description
> > > > of riscv_fdt_copy_resv_mem_node function.
> > >
> > > I believe we should turn on this feature by default for every RISC-V
> > > board, because SBI firmware used memory must be marked as reserved
> > > otherwise OS might use it and get crashed. For boards which don't want
> > > to enable this, they can unset the option in their board defconfig
> > > files. This is to reduce some maintenance effort.
> >
> > But not all RISC-V boards need this configuration.
> > If we enable it by default, non spl configuration will run this fdt
> > fix flow, but it is unnecessary.
> >
>
> Non SPL configuration also needs this, because U-Boot has to patch the
> final DTB that is passed to the kernel. It's a RISC-V architecture
> thing.

But non SPL configuration will not run openSbi, why it will need this flow ?

Thanks,
Rick

>
> Regards,
> Bin

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
  2020-06-02  6:04             ` Rick Chen
@ 2020-06-02  6:12               ` Bin Meng
  2020-06-02  6:16                 ` Rick Chen
  0 siblings, 1 reply; 21+ messages in thread
From: Bin Meng @ 2020-06-02  6:12 UTC (permalink / raw)
  To: u-boot

Hi Rick,

On Tue, Jun 2, 2020 at 2:04 PM Rick Chen <rickchen36@gmail.com> wrote:
>
> Hi Bin
>
> > Hi Rick,
> >
> > On Mon, Jun 1, 2020 at 3:36 PM Rick Chen <rickchen36@gmail.com> wrote:
> > >
> > > Hi Bin
> > >
> > > > Hi Rick,
> > > >
> > > > On Thu, May 28, 2020 at 4:17 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > > >
> > > > > Hi Bin
> > > > >
> > > > > > From: Bin Meng [mailto:bmeng.cn at gmail.com]
> > > > > > Sent: Wednesday, May 20, 2020 3:40 PM
> > > > > > To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
> > > > > > Cc: Bin Meng
> > > > > > Subject: [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
> > > > > >
> > > > > > From: Bin Meng <bin.meng@windriver.com>
> > > > > >
> > > > > > 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 <bin.meng@windriver.com>
> > > > > > ---
> > > > > >
> > > > > >  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
> > > > >
> > > > > I think it shall invoke by individual board, just like the description
> > > > > of riscv_fdt_copy_resv_mem_node function.
> > > >
> > > > I believe we should turn on this feature by default for every RISC-V
> > > > board, because SBI firmware used memory must be marked as reserved
> > > > otherwise OS might use it and get crashed. For boards which don't want
> > > > to enable this, they can unset the option in their board defconfig
> > > > files. This is to reduce some maintenance effort.
> > >
> > > But not all RISC-V boards need this configuration.
> > > If we enable it by default, non spl configuration will run this fdt
> > > fix flow, but it is unnecessary.
> > >
> >
> > Non SPL configuration also needs this, because U-Boot has to patch the
> > final DTB that is passed to the kernel. It's a RISC-V architecture
> > thing.
>
> But non SPL configuration will not run openSbi, why it will need this flow ?
>

Which configuration is this?

Regards,
Bin

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
  2020-06-02  6:12               ` Bin Meng
@ 2020-06-02  6:16                 ` Rick Chen
  2020-06-02  6:32                   ` Bin Meng
  0 siblings, 1 reply; 21+ messages in thread
From: Rick Chen @ 2020-06-02  6:16 UTC (permalink / raw)
  To: u-boot

Hi Bin

Bin Meng <bmeng.cn@gmail.com> ? 2020?6?2? ?? ??2:13???
>
> Hi Rick,
>
> On Tue, Jun 2, 2020 at 2:04 PM Rick Chen <rickchen36@gmail.com> wrote:
> >
> > Hi Bin
> >
> > > Hi Rick,
> > >
> > > On Mon, Jun 1, 2020 at 3:36 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > >
> > > > Hi Bin
> > > >
> > > > > Hi Rick,
> > > > >
> > > > > On Thu, May 28, 2020 at 4:17 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > > > >
> > > > > > Hi Bin
> > > > > >
> > > > > > > From: Bin Meng [mailto:bmeng.cn at gmail.com]
> > > > > > > Sent: Wednesday, May 20, 2020 3:40 PM
> > > > > > > To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
> > > > > > > Cc: Bin Meng
> > > > > > > Subject: [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
> > > > > > >
> > > > > > > From: Bin Meng <bin.meng@windriver.com>
> > > > > > >
> > > > > > > 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 <bin.meng@windriver.com>
> > > > > > > ---
> > > > > > >
> > > > > > >  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
> > > > > >
> > > > > > I think it shall invoke by individual board, just like the description
> > > > > > of riscv_fdt_copy_resv_mem_node function.
> > > > >
> > > > > I believe we should turn on this feature by default for every RISC-V
> > > > > board, because SBI firmware used memory must be marked as reserved
> > > > > otherwise OS might use it and get crashed. For boards which don't want
> > > > > to enable this, they can unset the option in their board defconfig
> > > > > files. This is to reduce some maintenance effort.
> > > >
> > > > But not all RISC-V boards need this configuration.
> > > > If we enable it by default, non spl configuration will run this fdt
> > > > fix flow, but it is unnecessary.
> > > >
> > >
> > > Non SPL configuration also needs this, because U-Boot has to patch the
> > > final DTB that is passed to the kernel. It's a RISC-V architecture
> > > thing.
> >
> > But non SPL configuration will not run openSbi, why it will need this flow ?
> >
>
> Which configuration is this?

e.q: ae350_rv[32|64]_defconfig

Thanks,
Rick

>
> Regards,
> Bin

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
  2020-06-02  6:16                 ` Rick Chen
@ 2020-06-02  6:32                   ` Bin Meng
  2020-06-02  6:51                     ` Rick Chen
  0 siblings, 1 reply; 21+ messages in thread
From: Bin Meng @ 2020-06-02  6:32 UTC (permalink / raw)
  To: u-boot

Hi Rick,

On Tue, Jun 2, 2020 at 2:16 PM Rick Chen <rickchen36@gmail.com> wrote:
>
> Hi Bin
>
> Bin Meng <bmeng.cn@gmail.com> ? 2020?6?2? ?? ??2:13???
> >
> > Hi Rick,
> >
> > On Tue, Jun 2, 2020 at 2:04 PM Rick Chen <rickchen36@gmail.com> wrote:
> > >
> > > Hi Bin
> > >
> > > > Hi Rick,
> > > >
> > > > On Mon, Jun 1, 2020 at 3:36 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > > >
> > > > > Hi Bin
> > > > >
> > > > > > Hi Rick,
> > > > > >
> > > > > > On Thu, May 28, 2020 at 4:17 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > > > > >
> > > > > > > Hi Bin
> > > > > > >
> > > > > > > > From: Bin Meng [mailto:bmeng.cn at gmail.com]
> > > > > > > > Sent: Wednesday, May 20, 2020 3:40 PM
> > > > > > > > To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
> > > > > > > > Cc: Bin Meng
> > > > > > > > Subject: [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
> > > > > > > >
> > > > > > > > From: Bin Meng <bin.meng@windriver.com>
> > > > > > > >
> > > > > > > > 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 <bin.meng@windriver.com>
> > > > > > > > ---
> > > > > > > >
> > > > > > > >  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
> > > > > > >
> > > > > > > I think it shall invoke by individual board, just like the description
> > > > > > > of riscv_fdt_copy_resv_mem_node function.
> > > > > >
> > > > > > I believe we should turn on this feature by default for every RISC-V
> > > > > > board, because SBI firmware used memory must be marked as reserved
> > > > > > otherwise OS might use it and get crashed. For boards which don't want
> > > > > > to enable this, they can unset the option in their board defconfig
> > > > > > files. This is to reduce some maintenance effort.
> > > > >
> > > > > But not all RISC-V boards need this configuration.
> > > > > If we enable it by default, non spl configuration will run this fdt
> > > > > fix flow, but it is unnecessary.
> > > > >
> > > >
> > > > Non SPL configuration also needs this, because U-Boot has to patch the
> > > > final DTB that is passed to the kernel. It's a RISC-V architecture
> > > > thing.
> > >
> > > But non SPL configuration will not run openSbi, why it will need this flow ?
> > >
> >
> > Which configuration is this?
>
> e.q: ae350_rv[32|64]_defconfig
>

It looks these 2 configs are for U-Boot M-mode. How are they supposed
to work, if they do not work with OpenSBI?

Regards,
Bin

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
  2020-06-02  6:32                   ` Bin Meng
@ 2020-06-02  6:51                     ` Rick Chen
  2020-06-02 18:22                       ` Atish Patra
  2020-06-02 18:26                       ` Atish Patra
  0 siblings, 2 replies; 21+ messages in thread
From: Rick Chen @ 2020-06-02  6:51 UTC (permalink / raw)
  To: u-boot

Hi Bin

Bin Meng <bmeng.cn@gmail.com> ? 2020?6?2? ?? ??2:33???
>
> Hi Rick,
>
> On Tue, Jun 2, 2020 at 2:16 PM Rick Chen <rickchen36@gmail.com> wrote:
> >
> > Hi Bin
> >
> > Bin Meng <bmeng.cn@gmail.com> ? 2020?6?2? ?? ??2:13???
> > >
> > > Hi Rick,
> > >
> > > On Tue, Jun 2, 2020 at 2:04 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > >
> > > > Hi Bin
> > > >
> > > > > Hi Rick,
> > > > >
> > > > > On Mon, Jun 1, 2020 at 3:36 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > > > >
> > > > > > Hi Bin
> > > > > >
> > > > > > > Hi Rick,
> > > > > > >
> > > > > > > On Thu, May 28, 2020 at 4:17 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > > > > > >
> > > > > > > > Hi Bin
> > > > > > > >
> > > > > > > > > From: Bin Meng [mailto:bmeng.cn at gmail.com]
> > > > > > > > > Sent: Wednesday, May 20, 2020 3:40 PM
> > > > > > > > > To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
> > > > > > > > > Cc: Bin Meng
> > > > > > > > > Subject: [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
> > > > > > > > >
> > > > > > > > > From: Bin Meng <bin.meng@windriver.com>
> > > > > > > > >
> > > > > > > > > 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 <bin.meng@windriver.com>
> > > > > > > > > ---
> > > > > > > > >
> > > > > > > > >  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
> > > > > > > >
> > > > > > > > I think it shall invoke by individual board, just like the description
> > > > > > > > of riscv_fdt_copy_resv_mem_node function.
> > > > > > >
> > > > > > > I believe we should turn on this feature by default for every RISC-V
> > > > > > > board, because SBI firmware used memory must be marked as reserved
> > > > > > > otherwise OS might use it and get crashed. For boards which don't want
> > > > > > > to enable this, they can unset the option in their board defconfig
> > > > > > > files. This is to reduce some maintenance effort.
> > > > > >
> > > > > > But not all RISC-V boards need this configuration.
> > > > > > If we enable it by default, non spl configuration will run this fdt
> > > > > > fix flow, but it is unnecessary.
> > > > > >
> > > > >
> > > > > Non SPL configuration also needs this, because U-Boot has to patch the
> > > > > final DTB that is passed to the kernel. It's a RISC-V architecture
> > > > > thing.
> > > >
> > > > But non SPL configuration will not run openSbi, why it will need this flow ?
> > > >
> > >
> > > Which configuration is this?
> >
> > e.q: ae350_rv[32|64]_defconfig
> >
>
> It looks these 2 configs are for U-Boot M-mode. How are they supposed
> to work, if they do not work with OpenSBI?

They work with BBL(riscv-pk).

Thanks,
Rick

>
> Regards,
> Bin

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
  2020-06-02  6:51                     ` Rick Chen
@ 2020-06-02 18:22                       ` Atish Patra
  2020-06-03  1:14                         ` Rick Chen
  2020-06-02 18:26                       ` Atish Patra
  1 sibling, 1 reply; 21+ messages in thread
From: Atish Patra @ 2020-06-02 18:22 UTC (permalink / raw)
  To: u-boot

On Mon, Jun 1, 2020 at 11:51 PM Rick Chen <rickchen36@gmail.com> wrote:
>
> Hi Bin
>
> Bin Meng <bmeng.cn@gmail.com> ? 2020?6?2? ?? ??2:33???
> >
> > Hi Rick,
> >
> > On Tue, Jun 2, 2020 at 2:16 PM Rick Chen <rickchen36@gmail.com> wrote:
> > >
> > > Hi Bin
> > >
> > > Bin Meng <bmeng.cn@gmail.com> ? 2020?6?2? ?? ??2:13???
> > > >
> > > > Hi Rick,
> > > >
> > > > On Tue, Jun 2, 2020 at 2:04 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > > >
> > > > > Hi Bin
> > > > >
> > > > > > Hi Rick,
> > > > > >
> > > > > > On Mon, Jun 1, 2020 at 3:36 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > > > > >
> > > > > > > Hi Bin
> > > > > > >
> > > > > > > > Hi Rick,
> > > > > > > >
> > > > > > > > On Thu, May 28, 2020 at 4:17 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > > > > > > >
> > > > > > > > > Hi Bin
> > > > > > > > >
> > > > > > > > > > From: Bin Meng [mailto:bmeng.cn at gmail.com]
> > > > > > > > > > Sent: Wednesday, May 20, 2020 3:40 PM
> > > > > > > > > > To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
> > > > > > > > > > Cc: Bin Meng
> > > > > > > > > > Subject: [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
> > > > > > > > > >
> > > > > > > > > > From: Bin Meng <bin.meng@windriver.com>
> > > > > > > > > >
> > > > > > > > > > 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 <bin.meng@windriver.com>
> > > > > > > > > > ---
> > > > > > > > > >
> > > > > > > > > >  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
> > > > > > > > >
> > > > > > > > > I think it shall invoke by individual board, just like the description
> > > > > > > > > of riscv_fdt_copy_resv_mem_node function.
> > > > > > > >
> > > > > > > > I believe we should turn on this feature by default for every RISC-V
> > > > > > > > board, because SBI firmware used memory must be marked as reserved
> > > > > > > > otherwise OS might use it and get crashed. For boards which don't want
> > > > > > > > to enable this, they can unset the option in their board defconfig
> > > > > > > > files. This is to reduce some maintenance effort.
> > > > > > >
> > > > > > > But not all RISC-V boards need this configuration.
> > > > > > > If we enable it by default, non spl configuration will run this fdt
> > > > > > > fix flow, but it is unnecessary.
> > > > > > >
> > > > > >
> > > > > > Non SPL configuration also needs this, because U-Boot has to patch the
> > > > > > final DTB that is passed to the kernel. It's a RISC-V architecture
> > > > > > thing.
> > > > >
> > > > > But non SPL configuration will not run openSbi, why it will need this flow ?
> > > > >
> > > >
> > > > Which configuration is this?
> > >
> > > e.q: ae350_rv[32|64]_defconfig
> > >
> >
> > It looks these 2 configs are for U-Boot M-mode. How are they supposed
> > to work, if they do not work with OpenSBI?
>
> They work with BBL(riscv-pk).
>
> Thanks,
> Rick
>
> >
> > Regards,
> > Bin

How about enabling only if OF_SEPARATE is enabled ?
We don't need a board fixup for prior stage case.


-- 
Regards,
Atish

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
  2020-06-02  6:51                     ` Rick Chen
  2020-06-02 18:22                       ` Atish Patra
@ 2020-06-02 18:26                       ` Atish Patra
  1 sibling, 0 replies; 21+ messages in thread
From: Atish Patra @ 2020-06-02 18:26 UTC (permalink / raw)
  To: u-boot

On Mon, Jun 1, 2020 at 11:51 PM Rick Chen <rickchen36@gmail.com> wrote:
>
> Hi Bin
>
> Bin Meng <bmeng.cn@gmail.com> ? 2020?6?2? ?? ??2:33???
> >
> > Hi Rick,
> >
> > On Tue, Jun 2, 2020 at 2:16 PM Rick Chen <rickchen36@gmail.com> wrote:
> > >
> > > Hi Bin
> > >
> > > Bin Meng <bmeng.cn@gmail.com> ? 2020?6?2? ?? ??2:13???
> > > >
> > > > Hi Rick,
> > > >
> > > > On Tue, Jun 2, 2020 at 2:04 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > > >
> > > > > Hi Bin
> > > > >
> > > > > > Hi Rick,
> > > > > >
> > > > > > On Mon, Jun 1, 2020 at 3:36 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > > > > >
> > > > > > > Hi Bin
> > > > > > >
> > > > > > > > Hi Rick,
> > > > > > > >
> > > > > > > > On Thu, May 28, 2020 at 4:17 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > > > > > > >
> > > > > > > > > Hi Bin
> > > > > > > > >
> > > > > > > > > > From: Bin Meng [mailto:bmeng.cn at gmail.com]
> > > > > > > > > > Sent: Wednesday, May 20, 2020 3:40 PM
> > > > > > > > > > To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
> > > > > > > > > > Cc: Bin Meng
> > > > > > > > > > Subject: [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
> > > > > > > > > >
> > > > > > > > > > From: Bin Meng <bin.meng@windriver.com>
> > > > > > > > > >
> > > > > > > > > > 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 <bin.meng@windriver.com>
> > > > > > > > > > ---
> > > > > > > > > >
> > > > > > > > > >  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
> > > > > > > > >
> > > > > > > > > I think it shall invoke by individual board, just like the description
> > > > > > > > > of riscv_fdt_copy_resv_mem_node function.
> > > > > > > >
> > > > > > > > I believe we should turn on this feature by default for every RISC-V
> > > > > > > > board, because SBI firmware used memory must be marked as reserved
> > > > > > > > otherwise OS might use it and get crashed. For boards which don't want
> > > > > > > > to enable this, they can unset the option in their board defconfig
> > > > > > > > files. This is to reduce some maintenance effort.
> > > > > > >
> > > > > > > But not all RISC-V boards need this configuration.
> > > > > > > If we enable it by default, non spl configuration will run this fdt
> > > > > > > fix flow, but it is unnecessary.
> > > > > > >
> > > > > >
> > > > > > Non SPL configuration also needs this, because U-Boot has to patch the
> > > > > > final DTB that is passed to the kernel. It's a RISC-V architecture
> > > > > > thing.
> > > > >
> > > > > But non SPL configuration will not run openSbi, why it will need this flow ?
> > > > >
> > > >
> > > > Which configuration is this?
> > >
> > > e.q: ae350_rv[32|64]_defconfig
> > >
> >
> > It looks these 2 configs are for U-Boot M-mode. How are they supposed
> > to work, if they do not work with OpenSBI?
>
> They work with BBL(riscv-pk).
>

Does BBL support /reserved-memory node add support ?
If not, riscv_fdt_copy_resv_mem_node should have returned in the first
check unless
you added it manually for verification.

> Thanks,
> Rick
>
> >
> > Regards,
> > Bin



-- 
Regards,
Atish

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
  2020-06-02 18:22                       ` Atish Patra
@ 2020-06-03  1:14                         ` Rick Chen
  0 siblings, 0 replies; 21+ messages in thread
From: Rick Chen @ 2020-06-03  1:14 UTC (permalink / raw)
  To: u-boot

Hi Atish

Atish Patra <atishp@atishpatra.org> ? 2020?6?3? ?? ??2:22???
>
> On Mon, Jun 1, 2020 at 11:51 PM Rick Chen <rickchen36@gmail.com> wrote:
> >
> > Hi Bin
> >
> > Bin Meng <bmeng.cn@gmail.com> ? 2020?6?2? ?? ??2:33???
> > >
> > > Hi Rick,
> > >
> > > On Tue, Jun 2, 2020 at 2:16 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > >
> > > > Hi Bin
> > > >
> > > > Bin Meng <bmeng.cn@gmail.com> ? 2020?6?2? ?? ??2:13???
> > > > >
> > > > > Hi Rick,
> > > > >
> > > > > On Tue, Jun 2, 2020 at 2:04 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > > > >
> > > > > > Hi Bin
> > > > > >
> > > > > > > Hi Rick,
> > > > > > >
> > > > > > > On Mon, Jun 1, 2020 at 3:36 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > > > > > >
> > > > > > > > Hi Bin
> > > > > > > >
> > > > > > > > > Hi Rick,
> > > > > > > > >
> > > > > > > > > On Thu, May 28, 2020 at 4:17 PM Rick Chen <rickchen36@gmail.com> wrote:
> > > > > > > > > >
> > > > > > > > > > Hi Bin
> > > > > > > > > >
> > > > > > > > > > > From: Bin Meng [mailto:bmeng.cn at gmail.com]
> > > > > > > > > > > Sent: Wednesday, May 20, 2020 3:40 PM
> > > > > > > > > > > To: Rick Jian-Zhi Chen(???); U-Boot Mailing List
> > > > > > > > > > > Cc: Bin Meng
> > > > > > > > > > > Subject: [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default
> > > > > > > > > > >
> > > > > > > > > > > From: Bin Meng <bin.meng@windriver.com>
> > > > > > > > > > >
> > > > > > > > > > > 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 <bin.meng@windriver.com>
> > > > > > > > > > > ---
> > > > > > > > > > >
> > > > > > > > > > >  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
> > > > > > > > > >
> > > > > > > > > > I think it shall invoke by individual board, just like the description
> > > > > > > > > > of riscv_fdt_copy_resv_mem_node function.
> > > > > > > > >
> > > > > > > > > I believe we should turn on this feature by default for every RISC-V
> > > > > > > > > board, because SBI firmware used memory must be marked as reserved
> > > > > > > > > otherwise OS might use it and get crashed. For boards which don't want
> > > > > > > > > to enable this, they can unset the option in their board defconfig
> > > > > > > > > files. This is to reduce some maintenance effort.
> > > > > > > >
> > > > > > > > But not all RISC-V boards need this configuration.
> > > > > > > > If we enable it by default, non spl configuration will run this fdt
> > > > > > > > fix flow, but it is unnecessary.
> > > > > > > >
> > > > > > >
> > > > > > > Non SPL configuration also needs this, because U-Boot has to patch the
> > > > > > > final DTB that is passed to the kernel. It's a RISC-V architecture
> > > > > > > thing.
> > > > > >
> > > > > > But non SPL configuration will not run openSbi, why it will need this flow ?
> > > > > >
> > > > >
> > > > > Which configuration is this?
> > > >
> > > > e.q: ae350_rv[32|64]_defconfig
> > > >
> > >
> > > It looks these 2 configs are for U-Boot M-mode. How are they supposed
> > > to work, if they do not work with OpenSBI?
> >
> > They work with BBL(riscv-pk).
> >
> > Thanks,
> > Rick
> >
> > >
> > > Regards,
> > > Bin
>
> How about enabling only if OF_SEPARATE is enabled ?
> We don't need a board fixup for prior stage case.
>

It is a good suggestion.

Thanks,
Rick

>
> --
> Regards,
> Atish

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2020-06-03  1:14 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20  7:39 [PATCH 1/2] riscv: Avoid the reserved memory fixup if src and dst point to the same place Bin Meng
2020-05-20  7:39 ` [PATCH 2/2] riscv: Enable CONFIG_OF_BOARD_FIXUP by default Bin Meng
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4710061@ATCPCS16.andestech.com>
2020-05-28  8:16     ` Rick Chen
2020-05-28  8:24       ` Bin Meng
2020-05-28  8:48         ` Bin Meng
2020-06-01  7:40           ` Rick Chen
2020-06-01  9:05             ` Bin Meng
2020-06-02  5:23               ` Rick Chen
2020-06-02  5:27                 ` Bin Meng
2020-06-01  7:36         ` Rick Chen
2020-06-01  9:04           ` Bin Meng
2020-06-02  6:04             ` Rick Chen
2020-06-02  6:12               ` Bin Meng
2020-06-02  6:16                 ` Rick Chen
2020-06-02  6:32                   ` Bin Meng
2020-06-02  6:51                     ` Rick Chen
2020-06-02 18:22                       ` Atish Patra
2020-06-03  1:14                         ` Rick Chen
2020-06-02 18:26                       ` Atish Patra
2020-05-26  8:53 ` [PATCH 1/2] riscv: Avoid the reserved memory fixup if src and dst point to the same place Bin Meng
     [not found] ` <752D002CFF5D0F4FA35C0100F1D73F3FA4710055@ATCPCS16.andestech.com>
2020-05-28  8:01   ` Rick Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.