diff mbox series

[U-Boot] qemu-riscv64_smode, sifive-fu540: fix extlinux (define preboot)

Message ID 20190821190720.4286-1-david.abdurachmanov@sifive.com
State Deferred
Delegated to: Andes
Headers show
Series [U-Boot] qemu-riscv64_smode, sifive-fu540: fix extlinux (define preboot) | expand

Commit Message

David Abdurachmanov Aug. 21, 2019, 7:07 p.m. UTC
Commit 37304aaf60bf92a5dc3ef222ba520698bd862a44 removed preboot
commands in RISC-V targets and broke extlinux support as reported
by Fu Wei <wefu@redhat.com>.

The patch finishes migration of CONFIG_USE_PREBOOT and CONFIG_REBOOT
to Kconfig.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
---
 configs/qemu-riscv64_smode_defconfig | 2 ++
 configs/sifive_fu540_defconfig       | 2 ++
 include/configs/sifive-fu540.h       | 4 ----
 3 files changed, 4 insertions(+), 4 deletions(-)

Comments

Bin Meng Aug. 26, 2019, 12:42 p.m. UTC | #1
Hi David,

On Thu, Aug 22, 2019 at 3:07 AM David Abdurachmanov
<david.abdurachmanov@gmail.com> wrote:
>
> Commit 37304aaf60bf92a5dc3ef222ba520698bd862a44 removed preboot
> commands in RISC-V targets and broke extlinux support as reported
> by Fu Wei <wefu@redhat.com>.

I think you need add a "Reported-By" tag instead of writing this in
the commit message.

And a "Fixes: commit-id ("commit title") format as well.

Please describe the commit title using something like:

riscv: fix extlinux (define preboot)

as it impacts more than one target.

>
> The patch finishes migration of CONFIG_USE_PREBOOT and CONFIG_REBOOT
> to Kconfig.
>
> Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
> ---
>  configs/qemu-riscv64_smode_defconfig | 2 ++

What about other QEMU RISC-V targets?

>  configs/sifive_fu540_defconfig       | 2 ++
>  include/configs/sifive-fu540.h       | 4 ----
>  3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/configs/qemu-riscv64_smode_defconfig b/configs/qemu-riscv64_smode_defconfig
> index 74743a5ebe..2e1f7fa91f 100644
> --- a/configs/qemu-riscv64_smode_defconfig
> +++ b/configs/qemu-riscv64_smode_defconfig
> @@ -9,3 +9,5 @@ CONFIG_DISPLAY_CPUINFO=y
>  CONFIG_DISPLAY_BOARDINFO=y
>  # CONFIG_CMD_MII is not set
>  CONFIG_OF_PRIOR_STAGE=y
> +CONFIG_USE_PREBOOT=y
> +CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"

Please insert the config option to the correct place, eg: you can run
it like this:

$ make savedefconfig
$ cp defconfig configs/qemu-riscv64_smode_defconfig

> diff --git a/configs/sifive_fu540_defconfig b/configs/sifive_fu540_defconfig
> index 48865e5f11..a852579309 100644
> --- a/configs/sifive_fu540_defconfig
> +++ b/configs/sifive_fu540_defconfig
> @@ -9,3 +9,5 @@ CONFIG_MISC_INIT_R=y
>  CONFIG_DISPLAY_CPUINFO=y
>  CONFIG_DISPLAY_BOARDINFO=y
>  CONFIG_OF_PRIOR_STAGE=y
> +CONFIG_USE_PREBOOT=y
> +CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"
> diff --git a/include/configs/sifive-fu540.h b/include/configs/sifive-fu540.h
> index 858b7a7da1..ba4aa0652c 100644
> --- a/include/configs/sifive-fu540.h
> +++ b/include/configs/sifive-fu540.h
> @@ -40,8 +40,4 @@
>         "ramdisk_addr_r=0x88300000\0" \
>         BOOTENV
>
> -#define CONFIG_PREBOOT \
> -       "setenv fdt_addr ${fdtcontroladdr};" \
> -       "fdt addr ${fdtcontroladdr};"
> -
>  #endif /* __CONFIG_H */
> --

Regards,
Bin
David Abdurachmanov Aug. 26, 2019, 6 p.m. UTC | #2
On Mon, Aug 26, 2019 at 5:43 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Hi David,
>
> On Thu, Aug 22, 2019 at 3:07 AM David Abdurachmanov
> <david.abdurachmanov@gmail.com> wrote:
> >
> > Commit 37304aaf60bf92a5dc3ef222ba520698bd862a44 removed preboot
> > commands in RISC-V targets and broke extlinux support as reported
> > by Fu Wei <wefu@redhat.com>.
>
> I think you need add a "Reported-By" tag instead of writing this in
> the commit message.

Yes. I rushed to send the patch. There should also be Tested-By from him.

>
> And a "Fixes: commit-id ("commit title") format as well.

Okay. Basically same as for kernel patches.

>
> Please describe the commit title using something like:
>
> riscv: fix extlinux (define preboot)
>
> as it impacts more than one target.

I can only test two targets.
That's also the main (only?) used targets by Fedora/RISCV users.
I don't want to modify targets that I (or users) can test.

>
> >
> > The patch finishes migration of CONFIG_USE_PREBOOT and CONFIG_REBOOT
> > to Kconfig.
> >
> > Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
> > ---
> >  configs/qemu-riscv64_smode_defconfig | 2 ++
>
> What about other QEMU RISC-V targets?

That's the only two targets which I can test.
Also the only two targets that had this enabled.

>
> >  configs/sifive_fu540_defconfig       | 2 ++
> >  include/configs/sifive-fu540.h       | 4 ----
> >  3 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/configs/qemu-riscv64_smode_defconfig b/configs/qemu-riscv64_smode_defconfig
> > index 74743a5ebe..2e1f7fa91f 100644
> > --- a/configs/qemu-riscv64_smode_defconfig
> > +++ b/configs/qemu-riscv64_smode_defconfig
> > @@ -9,3 +9,5 @@ CONFIG_DISPLAY_CPUINFO=y
> >  CONFIG_DISPLAY_BOARDINFO=y
> >  # CONFIG_CMD_MII is not set
> >  CONFIG_OF_PRIOR_STAGE=y
> > +CONFIG_USE_PREBOOT=y
> > +CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"
>
> Please insert the config option to the correct place, eg: you can run
> it like this:
>
> $ make savedefconfig
> $ cp defconfig configs/qemu-riscv64_smode_defconfig

Will do.

>
> > diff --git a/configs/sifive_fu540_defconfig b/configs/sifive_fu540_defconfig
> > index 48865e5f11..a852579309 100644
> > --- a/configs/sifive_fu540_defconfig
> > +++ b/configs/sifive_fu540_defconfig
> > @@ -9,3 +9,5 @@ CONFIG_MISC_INIT_R=y
> >  CONFIG_DISPLAY_CPUINFO=y
> >  CONFIG_DISPLAY_BOARDINFO=y
> >  CONFIG_OF_PRIOR_STAGE=y
> > +CONFIG_USE_PREBOOT=y
> > +CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"
> > diff --git a/include/configs/sifive-fu540.h b/include/configs/sifive-fu540.h
> > index 858b7a7da1..ba4aa0652c 100644
> > --- a/include/configs/sifive-fu540.h
> > +++ b/include/configs/sifive-fu540.h
> > @@ -40,8 +40,4 @@
> >         "ramdisk_addr_r=0x88300000\0" \
> >         BOOTENV
> >
> > -#define CONFIG_PREBOOT \
> > -       "setenv fdt_addr ${fdtcontroladdr};" \
> > -       "fdt addr ${fdtcontroladdr};"
> > -
> >  #endif /* __CONFIG_H */
> > --
>
> Regards,
> Bin
Atish Patra Aug. 29, 2019, 1:57 a.m. UTC | #3
On Wed, 2019-08-21 at 12:07 -0700, David Abdurachmanov wrote:
> Commit 37304aaf60bf92a5dc3ef222ba520698bd862a44 removed preboot
> commands in RISC-V targets and broke extlinux support as reported
> by Fu Wei <wefu@redhat.com>.
> 
> The patch finishes migration of CONFIG_USE_PREBOOT and CONFIG_REBOOT
> to Kconfig.
> 
> Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
> ---
>  configs/qemu-riscv64_smode_defconfig | 2 ++
>  configs/sifive_fu540_defconfig       | 2 ++
>  include/configs/sifive-fu540.h       | 4 ----
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/configs/qemu-riscv64_smode_defconfig b/configs/qemu-
> riscv64_smode_defconfig
> index 74743a5ebe..2e1f7fa91f 100644
> --- a/configs/qemu-riscv64_smode_defconfig
> +++ b/configs/qemu-riscv64_smode_defconfig
> @@ -9,3 +9,5 @@ CONFIG_DISPLAY_CPUINFO=y
>  CONFIG_DISPLAY_BOARDINFO=y
>  # CONFIG_CMD_MII is not set
>  CONFIG_OF_PRIOR_STAGE=y
> +CONFIG_USE_PREBOOT=y
> +CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr
> ${fdtcontroladdr};"
> diff --git a/configs/sifive_fu540_defconfig
> b/configs/sifive_fu540_defconfig
> index 48865e5f11..a852579309 100644
> --- a/configs/sifive_fu540_defconfig
> +++ b/configs/sifive_fu540_defconfig
> @@ -9,3 +9,5 @@ CONFIG_MISC_INIT_R=y
>  CONFIG_DISPLAY_CPUINFO=y
>  CONFIG_DISPLAY_BOARDINFO=y
>  CONFIG_OF_PRIOR_STAGE=y
> +CONFIG_USE_PREBOOT=y
> +CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr
> ${fdtcontroladdr};"
> diff --git a/include/configs/sifive-fu540.h b/include/configs/sifive-
> fu540.h
> index 858b7a7da1..ba4aa0652c 100644
> --- a/include/configs/sifive-fu540.h
> +++ b/include/configs/sifive-fu540.h
> @@ -40,8 +40,4 @@
>  	"ramdisk_addr_r=0x88300000\0" \
>  	BOOTENV
>  
> -#define CONFIG_PREBOOT \
> -	"setenv fdt_addr ${fdtcontroladdr};" \
> -	"fdt addr ${fdtcontroladdr};"
> -

As per the README, fdt_addr should be flash location. Why it was done
in the first place ?

Additionally, fdtcontroladdr is set what gdt->fdt_blob is set. On
latest U-boot in HiFive Unleashed, it is set to 0xff76e470. Not sure
the reasong. May be after relocation ?

However, 5.3 kernel possibly ovewriting that address resulting in boot
failures. Using fdt_addr_r works fine though.

As per following patch, we should do a tftpboot dtb to fdt_addr_r or
just using fdt_addr_r will also work as fdt_addr_r is set to the
address where OpenSBI keeps the DT.


>  #endif /* __CONFIG_H */
Vagrant Cascadian Sept. 26, 2019, 1:54 a.m. UTC | #4
On 2019-08-21, David Abdurachmanov wrote:
> Commit 37304aaf60bf92a5dc3ef222ba520698bd862a44 removed preboot
> commands in RISC-V targets and broke extlinux support as reported
> by Fu Wei <wefu@redhat.com>.
>
> The patch finishes migration of CONFIG_USE_PREBOOT and CONFIG_REBOOT
> to Kconfig.

Tested using qemu-riscv64_smode and it fixes extlinux booting. Thanks!

Please CC me on future updates to the patch series.

Tested-by: Vagrant Cascadian <vagrant@debian.org>

live well,
  vagrant

> Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
> ---
>  configs/qemu-riscv64_smode_defconfig | 2 ++
>  configs/sifive_fu540_defconfig       | 2 ++
>  include/configs/sifive-fu540.h       | 4 ----
>  3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/configs/qemu-riscv64_smode_defconfig b/configs/qemu-riscv64_smode_defconfig
> index 74743a5ebe..2e1f7fa91f 100644
> --- a/configs/qemu-riscv64_smode_defconfig
> +++ b/configs/qemu-riscv64_smode_defconfig
> @@ -9,3 +9,5 @@ CONFIG_DISPLAY_CPUINFO=y
>  CONFIG_DISPLAY_BOARDINFO=y
>  # CONFIG_CMD_MII is not set
>  CONFIG_OF_PRIOR_STAGE=y
> +CONFIG_USE_PREBOOT=y
> +CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"
> diff --git a/configs/sifive_fu540_defconfig b/configs/sifive_fu540_defconfig
> index 48865e5f11..a852579309 100644
> --- a/configs/sifive_fu540_defconfig
> +++ b/configs/sifive_fu540_defconfig
> @@ -9,3 +9,5 @@ CONFIG_MISC_INIT_R=y
>  CONFIG_DISPLAY_CPUINFO=y
>  CONFIG_DISPLAY_BOARDINFO=y
>  CONFIG_OF_PRIOR_STAGE=y
> +CONFIG_USE_PREBOOT=y
> +CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"
> diff --git a/include/configs/sifive-fu540.h b/include/configs/sifive-fu540.h
> index 858b7a7da1..ba4aa0652c 100644
> --- a/include/configs/sifive-fu540.h
> +++ b/include/configs/sifive-fu540.h
> @@ -40,8 +40,4 @@
>  	"ramdisk_addr_r=0x88300000\0" \
>  	BOOTENV
>  
> -#define CONFIG_PREBOOT \
> -	"setenv fdt_addr ${fdtcontroladdr};" \
> -	"fdt addr ${fdtcontroladdr};"
> -
>  #endif /* __CONFIG_H */
Vagrant Cascadian Dec. 18, 2019, 1:05 a.m. UTC | #5
On 2019-09-25, Vagrant Cascadian wrote:
> On 2019-08-21, David Abdurachmanov wrote:
>> Commit 37304aaf60bf92a5dc3ef222ba520698bd862a44 removed preboot
>> commands in RISC-V targets and broke extlinux support as reported
>> by Fu Wei <wefu@redhat.com>.
>>
>> The patch finishes migration of CONFIG_USE_PREBOOT and CONFIG_REBOOT
>> to Kconfig.
>
> Tested using qemu-riscv64_smode and it fixes extlinux booting. Thanks!
>
> Please CC me on future updates to the patch series.
>
> Tested-by: Vagrant Cascadian <vagrant@debian.org>

This patch, or something like it, is still needed with u-boot
v2020.01-rc5 for extlinux support to load the device-tree from the boot
firmware.

Is there a new approach in the works, or any chance to see something
like this get merged soon?

Thanks!


live well,
  vagrant

>> Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
>> ---
>>  configs/qemu-riscv64_smode_defconfig | 2 ++
>>  configs/sifive_fu540_defconfig       | 2 ++
>>  include/configs/sifive-fu540.h       | 4 ----
>>  3 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/configs/qemu-riscv64_smode_defconfig b/configs/qemu-riscv64_smode_defconfig
>> index 74743a5ebe..2e1f7fa91f 100644
>> --- a/configs/qemu-riscv64_smode_defconfig
>> +++ b/configs/qemu-riscv64_smode_defconfig
>> @@ -9,3 +9,5 @@ CONFIG_DISPLAY_CPUINFO=y
>>  CONFIG_DISPLAY_BOARDINFO=y
>>  # CONFIG_CMD_MII is not set
>>  CONFIG_OF_PRIOR_STAGE=y
>> +CONFIG_USE_PREBOOT=y
>> +CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"
>> diff --git a/configs/sifive_fu540_defconfig b/configs/sifive_fu540_defconfig
>> index 48865e5f11..a852579309 100644
>> --- a/configs/sifive_fu540_defconfig
>> +++ b/configs/sifive_fu540_defconfig
>> @@ -9,3 +9,5 @@ CONFIG_MISC_INIT_R=y
>>  CONFIG_DISPLAY_CPUINFO=y
>>  CONFIG_DISPLAY_BOARDINFO=y
>>  CONFIG_OF_PRIOR_STAGE=y
>> +CONFIG_USE_PREBOOT=y
>> +CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"
>> diff --git a/include/configs/sifive-fu540.h b/include/configs/sifive-fu540.h
>> index 858b7a7da1..ba4aa0652c 100644
>> --- a/include/configs/sifive-fu540.h
>> +++ b/include/configs/sifive-fu540.h
>> @@ -40,8 +40,4 @@
>>  	"ramdisk_addr_r=0x88300000\0" \
>>  	BOOTENV
>>  
>> -#define CONFIG_PREBOOT \
>> -	"setenv fdt_addr ${fdtcontroladdr};" \
>> -	"fdt addr ${fdtcontroladdr};"
>> -
>>  #endif /* __CONFIG_H */
David Abdurachmanov Dec. 18, 2019, 9 a.m. UTC | #6
On Wed, Dec 18, 2019 at 3:13 AM Vagrant Cascadian <vagrant@debian.org> wrote:
>
> On 2019-09-25, Vagrant Cascadian wrote:
> > On 2019-08-21, David Abdurachmanov wrote:
> >> Commit 37304aaf60bf92a5dc3ef222ba520698bd862a44 removed preboot
> >> commands in RISC-V targets and broke extlinux support as reported
> >> by Fu Wei <wefu@redhat.com>.
> >>
> >> The patch finishes migration of CONFIG_USE_PREBOOT and CONFIG_REBOOT
> >> to Kconfig.
> >
> > Tested using qemu-riscv64_smode and it fixes extlinux booting. Thanks!
> >
> > Please CC me on future updates to the patch series.
> >
> > Tested-by: Vagrant Cascadian <vagrant@debian.org>
>
> This patch, or something like it, is still needed with u-boot
> v2020.01-rc5 for extlinux support to load the device-tree from the boot
> firmware.
>
> Is there a new approach in the works, or any chance to see something
> like this get merged soon?

I do carry several experiment patches in Fedora/RISCV, which I didn't
yet sent for a review.
Basically that allows me to boot a single Fedora/RISCV disk image on
QEMU virt machine
and SiFive Unleashed.

See: http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/uboot-tools.spec#L36

Note some of the patches were merged in rc5.

You would want the following two patches:
http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/riscv64-set-fdt_addr.patch
http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/riscv-bootargs-preboot.patch

If you could review them I could send them out.

david
Vagrant Cascadian Dec. 18, 2019, 3:11 p.m. UTC | #7
On 2019-12-18, David Abdurachmanov wrote:
> On Wed, Dec 18, 2019 at 3:13 AM Vagrant Cascadian <vagrant@debian.org> wrote:
>>
>> On 2019-09-25, Vagrant Cascadian wrote:
>> > On 2019-08-21, David Abdurachmanov wrote:
>> >> Commit 37304aaf60bf92a5dc3ef222ba520698bd862a44 removed preboot
>> >> commands in RISC-V targets and broke extlinux support as reported
>> >> by Fu Wei <wefu@redhat.com>.
>> >>
>> >> The patch finishes migration of CONFIG_USE_PREBOOT and CONFIG_REBOOT
>> >> to Kconfig.
>> >
>> > Tested using qemu-riscv64_smode and it fixes extlinux booting. Thanks!
>> >
>> > Please CC me on future updates to the patch series.
>> >
>> > Tested-by: Vagrant Cascadian <vagrant@debian.org>
>>
>> This patch, or something like it, is still needed with u-boot
>> v2020.01-rc5 for extlinux support to load the device-tree from the boot
>> firmware.
>>
>> Is there a new approach in the works, or any chance to see something
>> like this get merged soon?
>
> I do carry several experiment patches in Fedora/RISCV, which I didn't
> yet sent for a review.
> Basically that allows me to boot a single Fedora/RISCV disk image on
> QEMU virt machine
> and SiFive Unleashed.
>
> See: http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/uboot-tools.spec#L36
>
> Note some of the patches were merged in rc5.

Thanks! I'll give your patches some testing when I get a chance.


Some potentially quite naive questions:

> You would want the following two patches:
> http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/riscv64-set-fdt_addr.patch

Why does it need fdt_addr=0x88000000 need to be set (and to the same
value as fdt_addr_r)? According to README fdt_addr is for the flash
media, which I don't think is used in the qemu case, at least. Is
fdt_addr being (ab)used for some other purpose? I guess the README also
gives free reign to use the variables for other purposes... but it would
be good to know why that is needed vs. just using fdt_addr_r as
documented.


> http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/riscv-bootargs-preboot.patch

CONFIG_PREBOOT="cp.l ${fdtcontroladdr} ${fdt_addr_r} 0x10000;"

What does cp.l do?

Do you need to force setting the console in CONFIG_BOOTARGS? It seemed
to autodetect the console on the installations I have running, possibly
getting the chosen console from device-tree?


live well,
  vagrant
David Abdurachmanov Dec. 19, 2019, 5:42 a.m. UTC | #8
On Thu, Dec 19, 2019 at 12:18 AM Vagrant Cascadian <vagrant@debian.org> wrote:
>
> On 2019-12-18, David Abdurachmanov wrote:
> > On Wed, Dec 18, 2019 at 3:13 AM Vagrant Cascadian <vagrant@debian.org> wrote:
> >>
> >> On 2019-09-25, Vagrant Cascadian wrote:
> >> > On 2019-08-21, David Abdurachmanov wrote:
> >> >> Commit 37304aaf60bf92a5dc3ef222ba520698bd862a44 removed preboot
> >> >> commands in RISC-V targets and broke extlinux support as reported
> >> >> by Fu Wei <wefu@redhat.com>.
> >> >>
> >> >> The patch finishes migration of CONFIG_USE_PREBOOT and CONFIG_REBOOT
> >> >> to Kconfig.
> >> >
> >> > Tested using qemu-riscv64_smode and it fixes extlinux booting. Thanks!
> >> >
> >> > Please CC me on future updates to the patch series.
> >> >
> >> > Tested-by: Vagrant Cascadian <vagrant@debian.org>
> >>
> >> This patch, or something like it, is still needed with u-boot
> >> v2020.01-rc5 for extlinux support to load the device-tree from the boot
> >> firmware.
> >>
> >> Is there a new approach in the works, or any chance to see something
> >> like this get merged soon?
> >
> > I do carry several experiment patches in Fedora/RISCV, which I didn't
> > yet sent for a review.
> > Basically that allows me to boot a single Fedora/RISCV disk image on
> > QEMU virt machine
> > and SiFive Unleashed.
> >
> > See: http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/uboot-tools.spec#L36
> >
> > Note some of the patches were merged in rc5.
>
> Thanks! I'll give your patches some testing when I get a chance.
>
>
> Some potentially quite naive questions:
>
> > You would want the following two patches:
> > http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/riscv64-set-fdt_addr.patch
>
> Why does it need fdt_addr=0x88000000 need to be set (and to the same
> value as fdt_addr_r)? According to README fdt_addr is for the flash
> media, which I don't think is used in the qemu case, at least. Is
> fdt_addr being (ab)used for some other purpose? I guess the README also
> gives free reign to use the variables for other purposes... but it would
> be good to know why that is needed vs. just using fdt_addr_r as
> documented.

The comments in uboot-tools.spec explain it.
This is only needed if you use EXTLINUX to boot your image. IIRC
EXTLINUX will assume DTB blob is available at fdt_addr or you can load
one via fdt/fdtdir label in extlinux.conf (never tried).
If you are booting in some other way you probably don't care about it.

>
>
> > http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/riscv-bootargs-preboot.patch
>
> CONFIG_PREBOOT="cp.l ${fdtcontroladdr} ${fdt_addr_r} 0x10000;"

This used to solve memory corruption for DTB in v5.3 kernel IIRC. That
was fixed in v5.4 kernel thus should be removed (I will test later).

>
> What does cp.l do?
>
> Do you need to force setting the console in CONFIG_BOOTARGS? It seemed
> to autodetect the console on the installations I have running, possibly
> getting the chosen console from device-tree?

It doesn't detect it for me. Well it does on QEMU, but not on SiFive
Unleashed. Both use different console (ttyS0 vs ttySIF0). I think the
kernel doesn't look into chosen console expect powerpc IIRC.

I can retest since this was added:
https://github.com/torvalds/linux/commit/2993c9b04e616df0848b655d7202a707a70fc876

I am updating kernel in Fedora/RISCV to 5.5-rc2 now thus I can
re-check various patches again.

david
>
>
> live well,
>   vagrant
Bin Meng Feb. 4, 2020, 3:29 p.m. UTC | #9
Hi,

On Thu, Dec 19, 2019 at 1:42 PM David Abdurachmanov
<david.abdurachmanov@gmail.com> wrote:
>
> On Thu, Dec 19, 2019 at 12:18 AM Vagrant Cascadian <vagrant@debian.org> wrote:
> >
> > On 2019-12-18, David Abdurachmanov wrote:
> > > On Wed, Dec 18, 2019 at 3:13 AM Vagrant Cascadian <vagrant@debian.org> wrote:
> > >>
> > >> On 2019-09-25, Vagrant Cascadian wrote:
> > >> > On 2019-08-21, David Abdurachmanov wrote:
> > >> >> Commit 37304aaf60bf92a5dc3ef222ba520698bd862a44 removed preboot
> > >> >> commands in RISC-V targets and broke extlinux support as reported
> > >> >> by Fu Wei <wefu@redhat.com>.
> > >> >>
> > >> >> The patch finishes migration of CONFIG_USE_PREBOOT and CONFIG_REBOOT
> > >> >> to Kconfig.
> > >> >
> > >> > Tested using qemu-riscv64_smode and it fixes extlinux booting. Thanks!
> > >> >
> > >> > Please CC me on future updates to the patch series.
> > >> >
> > >> > Tested-by: Vagrant Cascadian <vagrant@debian.org>
> > >>
> > >> This patch, or something like it, is still needed with u-boot
> > >> v2020.01-rc5 for extlinux support to load the device-tree from the boot
> > >> firmware.
> > >>
> > >> Is there a new approach in the works, or any chance to see something
> > >> like this get merged soon?
> > >
> > > I do carry several experiment patches in Fedora/RISCV, which I didn't
> > > yet sent for a review.
> > > Basically that allows me to boot a single Fedora/RISCV disk image on
> > > QEMU virt machine
> > > and SiFive Unleashed.
> > >
> > > See: http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/uboot-tools.spec#L36
> > >
> > > Note some of the patches were merged in rc5.
> >
> > Thanks! I'll give your patches some testing when I get a chance.
> >
> >
> > Some potentially quite naive questions:
> >
> > > You would want the following two patches:
> > > http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/riscv64-set-fdt_addr.patch
> >
> > Why does it need fdt_addr=0x88000000 need to be set (and to the same
> > value as fdt_addr_r)? According to README fdt_addr is for the flash
> > media, which I don't think is used in the qemu case, at least. Is
> > fdt_addr being (ab)used for some other purpose? I guess the README also
> > gives free reign to use the variables for other purposes... but it would
> > be good to know why that is needed vs. just using fdt_addr_r as
> > documented.
>
> The comments in uboot-tools.spec explain it.
> This is only needed if you use EXTLINUX to boot your image. IIRC
> EXTLINUX will assume DTB blob is available at fdt_addr or you can load
> one via fdt/fdtdir label in extlinux.conf (never tried).
> If you are booting in some other way you probably don't care about it.
>
> >
> >
> > > http://fedora.riscv.rocks:3000/rpms/uboot-tools/src/branch/master-riscv64/riscv-bootargs-preboot.patch
> >
> > CONFIG_PREBOOT="cp.l ${fdtcontroladdr} ${fdt_addr_r} 0x10000;"
>
> This used to solve memory corruption for DTB in v5.3 kernel IIRC. That
> was fixed in v5.4 kernel thus should be removed (I will test later).
>
> >
> > What does cp.l do?
> >
> > Do you need to force setting the console in CONFIG_BOOTARGS? It seemed
> > to autodetect the console on the installations I have running, possibly
> > getting the chosen console from device-tree?
>
> It doesn't detect it for me. Well it does on QEMU, but not on SiFive
> Unleashed. Both use different console (ttyS0 vs ttySIF0). I think the
> kernel doesn't look into chosen console expect powerpc IIRC.
>
> I can retest since this was added:
> https://github.com/torvalds/linux/commit/2993c9b04e616df0848b655d7202a707a70fc876
>
> I am updating kernel in Fedora/RISCV to 5.5-rc2 now thus I can
> re-check various patches again.
>

What's the status of this patch?

Regards,
Bin
diff mbox series

Patch

diff --git a/configs/qemu-riscv64_smode_defconfig b/configs/qemu-riscv64_smode_defconfig
index 74743a5ebe..2e1f7fa91f 100644
--- a/configs/qemu-riscv64_smode_defconfig
+++ b/configs/qemu-riscv64_smode_defconfig
@@ -9,3 +9,5 @@  CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
 # CONFIG_CMD_MII is not set
 CONFIG_OF_PRIOR_STAGE=y
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"
diff --git a/configs/sifive_fu540_defconfig b/configs/sifive_fu540_defconfig
index 48865e5f11..a852579309 100644
--- a/configs/sifive_fu540_defconfig
+++ b/configs/sifive_fu540_defconfig
@@ -9,3 +9,5 @@  CONFIG_MISC_INIT_R=y
 CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
 CONFIG_OF_PRIOR_STAGE=y
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"
diff --git a/include/configs/sifive-fu540.h b/include/configs/sifive-fu540.h
index 858b7a7da1..ba4aa0652c 100644
--- a/include/configs/sifive-fu540.h
+++ b/include/configs/sifive-fu540.h
@@ -40,8 +40,4 @@ 
 	"ramdisk_addr_r=0x88300000\0" \
 	BOOTENV
 
-#define CONFIG_PREBOOT \
-	"setenv fdt_addr ${fdtcontroladdr};" \
-	"fdt addr ${fdtcontroladdr};"
-
 #endif /* __CONFIG_H */