Skip to contentSkip to conversation

riscv: add Kconfig entries for the F and D ISA extensions support

PATCH New Eric Lin 4 participants 12 messages May 21, 2019 – May 29, 2019 RISC-V

lore
Share & tools
lore

Eric Lin

author
#0 lore raw

PATCH 1/1 riscv: add Kconfig entries for the F and D ISA extensions support

This patch add Kconfig entries for the F (Single-Precision) and D (Double-Precision) floating point instruction-set extensions.

---
 arch/riscv/Kconfig  |  8 ++++++++
 arch/riscv/Makefile | 12 ++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)
arch/riscv/Kconfig +8 -0
index 362f3cdc65..a8031fa230 100644
@@ -91,6 +91,14 @@ config RISCV_ISA_C
 	  when building U-Boot, which results in compressed instructions in the
 	  U-Boot binary.
 
+config RISCV_ISA_F
+	bool "Emit Floating-point instructions"
+	default n
+	help
+	  Adds "F" to the ISA subsets that the toolchain is allowed to emit
+	  when building U-Boot, which results in Single and Double-precision instructions
+	  in the U-Boot binary.
+
 config RISCV_ISA_A
 	def_bool y
 
arch/riscv/Makefile +8 -4
index 0b80eb8d86..87ec0ea4b5 100644
@@ -5,15 +5,19 @@
 
 ifeq ($(CONFIG_ARCH_RV64I),y)
 	ARCH_BASE = rv64im
-	ABI = lp64
+	ABI := lp64
 endif
 ifeq ($(CONFIG_ARCH_RV32I),y)
 	ARCH_BASE = rv32im
-	ABI = ilp32
+	ABI := ilp32
 endif
 ifeq ($(CONFIG_RISCV_ISA_A),y)
 	ARCH_A = a
 endif
+ifeq ($(CONFIG_RISCV_ISA_F),y)
+	ARCH_F = fd
+	ABI := $(ABI)d
+endif
 ifeq ($(CONFIG_RISCV_ISA_C),y)
 	ARCH_C = c
 endif
@@ -24,8 +28,8 @@ ifeq ($(CONFIG_CMODEL_MEDANY),y)
 	CMODEL = medany
 endif
 
-ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI) \
-	     -mcmodel=$(CMODEL)
+ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_F)$(ARCH_C) -mabi=$(ABI) \
+			         -mcmodel=$(CMODEL)
 
 PLATFORM_CPPFLAGS	+= $(ARCH_FLAGS)
 CFLAGS_EFI		+= $(ARCH_FLAGS)
Signature · 1 line
2.17.0
#1 lore raw

PATCH 1/1 riscv: add Kconfig entries for the F and D ISA extensions support

Hi Eric,

Quoted 2 lines · Eric Lin

This patch add Kconfig entries for the F (Single-Precision)

adds

Quoted 2 lines

and D (Double-Precision) floating point instruction-set extensions.

Could you please provide reason that why U-Boot has to be compiled using F/D extension?

Quoted 11 lines
---
 arch/riscv/Kconfig  |  8 ++++++++
 arch/riscv/Makefile | 12 ++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)
arch/riscv/Kconfig +0 -0
index 362f3cdc65..a8031fa230 100644

arch/riscv/Kconfig config RISCV_ISA_C · line 96

Quoted 6 lines
arch/riscv/Kconfig +3 -0
@@ -91,6 +91,14 @@ config RISCV_ISA_C
          when building U-Boot, which results in compressed instructions in the
          U-Boot binary.
 
+config RISCV_ISA_F
+       bool "Emit Floating-point instructions"
+       default n

this can be dropped as default is n

arch/riscv/Kconfig config RISCV_ISA_C · line 99

Quoted 3 lines
arch/riscv/Kconfig +3 -0
+       help
+         Adds "F" to the ISA subsets that the toolchain is allowed to emit
+         when building U-Boot, which results in Single and Double-precision instructions

This does not match what the config name says. The config name is for F and it cannot indicate both F and D here.

Quoted 33 lines
arch/riscv/Kconfig +2 -0
+         in the U-Boot binary.
+
 config RISCV_ISA_A
        def_bool y
 
arch/riscv/Makefile +6 -2
index 0b80eb8d86..87ec0ea4b5 100644
@@ -5,15 +5,19 @@
 
 ifeq ($(CONFIG_ARCH_RV64I),y)
        ARCH_BASE = rv64im
-       ABI = lp64
+       ABI := lp64
 endif
 ifeq ($(CONFIG_ARCH_RV32I),y)
        ARCH_BASE = rv32im
-       ABI = ilp32
+       ABI := ilp32
 endif
 ifeq ($(CONFIG_RISCV_ISA_A),y)
        ARCH_A = a
 endif
+ifeq ($(CONFIG_RISCV_ISA_F),y)
+       ARCH_F = fd
+       ABI := $(ABI)d
+endif
 ifeq ($(CONFIG_RISCV_ISA_C),y)
        ARCH_C = c
 endif
@@ -24,8 +28,8 @@ ifeq ($(CONFIG_CMODEL_MEDANY),y)
        CMODEL = medany

arch/riscv/Makefile ifeq ($(CONFIG_CMODEL_MEDANY),y)

Quoted 10 lines
arch/riscv/Makefile +2 -3
 endif
 
-ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI) \
-            -mcmodel=$(CMODEL)
+ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_F)$(ARCH_C) -mabi=$(ABI) \
+                                -mcmodel=$(CMODEL)
 
 PLATFORM_CPPFLAGS      += $(ARCH_FLAGS)
 CFLAGS_EFI             += $(ARCH_FLAGS)
--

Regards,
Bin

#2 lore raw

PATCH 1/1 riscv: add Kconfig entries for the F and D ISA extensions support

Hi Bin,

Quoted 9 lines

-----Original Message-----
From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Tuesday, May 21, 2019 3:56 PM
To: Eric Te-Sheng Lin(林德晟)
Cc: U-Boot Mailing List; Lukas Auer; Anup Patel; Rick Jian-Zhi Chen(陳建志); Greentime Ying-Han Hu(胡英漢); dslin1010 at gmail.com
Subject: Re: [PATCH] riscv: add Kconfig entries for the F and D ISA extensions support

Quoted 8 lines

Hi Eric,

Quoted 2 lines · Eric Lin

This patch add Kconfig entries for the F (Single-Precision)

adds

OK I'll correct it as adds

Quoted 6 lines
Quoted 2 lines

and D (Double-Precision) floating point instruction-set extensions.

Could you please provide reason that why U-Boot has to be compiled using F/D extension?

Cause on AE350 platform, we have two different kinds of toolchain v5d (support I/M/A/C/F/D ISA) and
v5 (support I/M/A/C ISA). If we use the v5d toolchain to build U-Boot it will build fail, so we would like to add F/D extension on U-Boot.

Quoted 13 lines

arch/riscv/Kconfig config RISCV_ISA_C · line 91

Quoted 12 lines
---
 arch/riscv/Kconfig  |  8 ++++++++
 arch/riscv/Makefile | 12 ++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)
arch/riscv/Kconfig index renamed from arch/riscv/Kconfig +0 -0

362f3cdc65..a8031fa230 100644

arch/riscv/Kconfig +0 -0
@@ -91,6 +91,14 @@ config RISCV_ISA_C
          when building U-Boot, which results in compressed instructions

in the

Quoted 7 lines

arch/riscv/Kconfig config RISCV_ISA_C · line 96

Quoted 5 lines
arch/riscv/Kconfig +3 -0
          U-Boot binary.
 
+config RISCV_ISA_F
+       bool "Emit Floating-point instructions"
+       default n

this can be dropped as default is n

OK, I'll drop it

Quoted 8 lines

arch/riscv/Kconfig config RISCV_ISA_C

Quoted 4 lines
arch/riscv/Kconfig +4 -0
+       help
+         Adds "F" to the ISA subsets that the toolchain is allowed to emit
+         when building U-Boot, which results in Single and
+ Double-precision instructions

This does not match what the config name says. The config name is for F and it cannot indicate both F and D here.

OK, I'll correct it as follows to cover F and D:
config RISCV_ISA_FD
bool "Emit Floating-point instructions"
help
Adds "F" and "D" to the ISA subsets that the toolchain is allowed to emit when building U-Boot, which results in Single and Double-precision instructions in the U-Boot binary.

Quoted 11 lines
Quoted 11 lines
arch/riscv/Kconfig +2 -0
+         in the U-Boot binary.
+
 config RISCV_ISA_A
        def_bool y
arch/riscv/Makefile index renamed from arch/riscv/Makefile +0 -0

0b80eb8d86..87ec0ea4b5 100644

arch/riscv/Makefile +0 -0
@@ -5,15 +5,19 @@
 
Quoted 15 lines
Quoted 5 lines
arch/riscv/Makefile +1 -1
 ifeq ($(CONFIG_ARCH_RV64I),y)
        ARCH_BASE = rv64im
-       ABI = lp64
+       ABI := lp64
 endif

arch/riscv/Makefile line 18

Quoted 10 lines
arch/riscv/Makefile +3 -1
 ifeq ($(CONFIG_ARCH_RV32I),y)
        ARCH_BASE = rv32im
-       ABI = ilp32
+       ABI := ilp32
 endif
 ifeq ($(CONFIG_RISCV_ISA_A),y)
        ARCH_A = a
 endif
+ifeq ($(CONFIG_RISCV_ISA_F),y)
+       ARCH_F = fd

ifeq ($(CONFIG_RISCV_ISA_FD),y)
ARCH_FD = fd

Quoted 9 lines
Quoted 9 lines
arch/riscv/Makefile +2 -0
+       ABI := $(ABI)d
+endif
 ifeq ($(CONFIG_RISCV_ISA_C),y)
        ARCH_C = c
 endif
@@ -24,8 +28,8 @@ ifeq ($(CONFIG_CMODEL_MEDANY),y)
        CMODEL = medany
 endif
 
Quoted 3 lines

arch/riscv/Makefile ifeq ($(CONFIG_CMODEL_MEDANY),y)

Quoted 3 lines
arch/riscv/Makefile +1 -2
-ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI) \
-            -mcmodel=$(CMODEL)
+ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_F)$(ARCH_C)

ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_FD)$(ARCH_C)

Quoted 9 lines

-mabi=$(ABI) \

arch/riscv/Makefile ifeq ($(CONFIG_CMODEL_MEDANY),y)

Quoted 5 lines
arch/riscv/Makefile +1 -1
+                                -mcmodel=$(CMODEL)
 
 PLATFORM_CPPFLAGS      += $(ARCH_FLAGS)
 CFLAGS_EFI             += $(ARCH_FLAGS)
--

Regards,
Bin

Thanks for your review.

Regards,
Eric
CONFIDENTIALITY NOTICE:

This e-mail (and its attachments) may contain confidential and legally privileged information or information protected from disclosure. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein is strictly prohibited. In this case, please immediately notify the sender by return e-mail, delete the message (and any accompanying documents) and destroy all printed hard copies. Thank you for your cooperation.

Copyright ANDES TECHNOLOGY CORPORATION - All Rights Reserved.

#3 lore raw

PATCH 1/1 riscv: add Kconfig entries for the F and D ISA extensions support

Hi Eric,

Quoted 26 lines · On Wed, May 22, 2019 at 4:23 PM <[email protected]> wrote:

Hi Bin,

Quoted 9 lines

-----Original Message-----
From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Tuesday, May 21, 2019 3:56 PM
To: Eric Te-Sheng Lin(林德晟)
Cc: U-Boot Mailing List; Lukas Auer; Anup Patel; Rick Jian-Zhi Chen(陳建志); Greentime Ying-Han Hu(胡英漢); dslin1010 at gmail.com
Subject: Re: [PATCH] riscv: add Kconfig entries for the F and D ISA extensions support

Quoted 8 lines

Hi Eric,

Quoted 2 lines · Eric Lin

This patch add Kconfig entries for the F (Single-Precision)

adds

OK I'll correct it as adds

Quoted 3 lines
Quoted 2 lines

and D (Double-Precision) floating point instruction-set extensions.

Quoted 6 lines
Quoted 3 lines

Could you please provide reason that why U-Boot has to be compiled using F/D extension?

Cause on AE350 platform, we have two different kinds of toolchain v5d (support I/M/A/C/F/D ISA) and
v5 (support I/M/A/C ISA). If we use the v5d toolchain to build U-Boot it will build fail, so we would like to add F/D extension on U-Boot.

I don't understand. What difference do these two toochains have? Isn't the v5d toolchain's default -march string be pre-configured to imafd? But even if the toolchain is pre-configured to generate fd instruction, I think it can be override by the compiler flags. Can you please share the details of the toolchain you used? I suspect you have to fix your toolchain, not U-Boot.

Quoted 81 lines
Quoted 14 lines

arch/riscv/Kconfig config RISCV_ISA_C · line 91

Quoted 13 lines
---
 arch/riscv/Kconfig  |  8 ++++++++
 arch/riscv/Makefile | 12 ++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)
arch/riscv/Kconfig index renamed from arch/riscv/Kconfig +0 -0

362f3cdc65..a8031fa230 100644

arch/riscv/Kconfig +0 -0
@@ -91,6 +91,14 @@ config RISCV_ISA_C
          when building U-Boot, which results in compressed instructions

in the

Quoted 7 lines

arch/riscv/Kconfig config RISCV_ISA_C · line 96

Quoted 5 lines
arch/riscv/Kconfig +3 -0
          U-Boot binary.
 
+config RISCV_ISA_F
+       bool "Emit Floating-point instructions"
+       default n

this can be dropped as default is n

OK, I'll drop it

Quoted 8 lines

arch/riscv/Kconfig config RISCV_ISA_C

Quoted 4 lines
arch/riscv/Kconfig +4 -0
+       help
+         Adds "F" to the ISA subsets that the toolchain is allowed to emit
+         when building U-Boot, which results in Single and
+ Double-precision instructions

This does not match what the config name says. The config name is for F and it cannot indicate both F and D here.

OK, I'll correct it as follows to cover F and D:
config RISCV_ISA_FD
bool "Emit Floating-point instructions"
help
Adds "F" and "D" to the ISA subsets that the toolchain is allowed to emit when building U-Boot, which results in Single and Double-precision instructions in the U-Boot binary.

Quoted 11 lines
Quoted 11 lines
arch/riscv/Kconfig +2 -0
+         in the U-Boot binary.
+
 config RISCV_ISA_A
        def_bool y
arch/riscv/Makefile index renamed from arch/riscv/Makefile +0 -0

0b80eb8d86..87ec0ea4b5 100644

arch/riscv/Makefile +0 -0
@@ -5,15 +5,19 @@
 
Quoted 15 lines
Quoted 5 lines
arch/riscv/Makefile +1 -1
 ifeq ($(CONFIG_ARCH_RV64I),y)
        ARCH_BASE = rv64im
-       ABI = lp64
+       ABI := lp64
 endif

arch/riscv/Makefile line 18

Quoted 10 lines
arch/riscv/Makefile +3 -1
 ifeq ($(CONFIG_ARCH_RV32I),y)
        ARCH_BASE = rv32im
-       ABI = ilp32
+       ABI := ilp32
 endif
 ifeq ($(CONFIG_RISCV_ISA_A),y)
        ARCH_A = a
 endif
+ifeq ($(CONFIG_RISCV_ISA_F),y)
+       ARCH_F = fd

ifeq ($(CONFIG_RISCV_ISA_FD),y)
ARCH_FD = fd

Quoted 9 lines
Quoted 9 lines
arch/riscv/Makefile +2 -0
+       ABI := $(ABI)d
+endif
 ifeq ($(CONFIG_RISCV_ISA_C),y)
        ARCH_C = c
 endif
@@ -24,8 +28,8 @@ ifeq ($(CONFIG_CMODEL_MEDANY),y)
        CMODEL = medany
 endif
 
Quoted 11 lines
Quoted 3 lines

arch/riscv/Makefile ifeq ($(CONFIG_CMODEL_MEDANY),y)

Quoted 3 lines
arch/riscv/Makefile +1 -2
-ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI) \
-            -mcmodel=$(CMODEL)
+ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_F)$(ARCH_C)

ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_FD)$(ARCH_C)

Quoted 5 lines

-mabi=$(ABI) \

Quoted 4 lines
arch/riscv/Makefile +1 -0
+                                -mcmodel=$(CMODEL)
 
 PLATFORM_CPPFLAGS      += $(ARCH_FLAGS)
 CFLAGS_EFI             += $(ARCH_FLAGS)

Regards,
Bin

#4 lore raw

PATCH 1/1 riscv: add Kconfig entries for the F and D ISA extensions support

Hi Bin

Bin Meng <[email protected]> 於 2019年5月22日 週三 下午5:25寫道:

Quoted 37 lines

Hi Eric,

Quoted 26 lines · On Wed, May 22, 2019 at 4:23 PM <[email protected]> wrote:

Hi Bin,

Quoted 9 lines

-----Original Message-----
From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Tuesday, May 21, 2019 3:56 PM
To: Eric Te-Sheng Lin(林德晟)
Cc: U-Boot Mailing List; Lukas Auer; Anup Patel; Rick Jian-Zhi Chen(陳建志); Greentime Ying-Han Hu(胡英漢); dslin1010 at gmail.com
Subject: Re: [PATCH] riscv: add Kconfig entries for the F and D ISA extensions support

Quoted 8 lines

Hi Eric,

Quoted 2 lines · Eric Lin

This patch add Kconfig entries for the F (Single-Precision)

adds

OK I'll correct it as adds

Quoted 3 lines
Quoted 2 lines

and D (Double-Precision) floating point instruction-set extensions.

Quoted 6 lines
Quoted 3 lines

Could you please provide reason that why U-Boot has to be compiled using F/D extension?

Cause on AE350 platform, we have two different kinds of toolchain v5d (support I/M/A/C/F/D ISA) and
v5 (support I/M/A/C ISA). If we use the v5d toolchain to build U-Boot it will build fail, so we would like to add F/D extension on U-Boot.

Quoted 7 lines

I don't understand. What difference do these two toochains have? Isn't the v5d toolchain's default -march string be pre-configured to imafd? But even if the toolchain is pre-configured to generate fd instruction, I think it can be override by the compiler flags. Can you please share the details of the toolchain you used? I suspect you have to fix your toolchain, not U-Boot.

It's seems the ABI issue. Because our toolchain don't support
multilib, the v5d toolchain libraries ABI is ilp64d.
If I use the v5d toolchain to build U-Boot with -mabi=lp64, it will
get link error as below:
...
riscv64-linux-ld.bfd:
/nds64le-linux-glibc-v5d/bin/../lib/gcc/riscv64-linux/7.3.0/libgcc.a(save-restore.o):
can't link double-float modules with soft-float modules riscv64-linux-ld.bfd: failed to merge target specific data of file /nds64le-linux-glibc-v5d/bin/../lib/gcc/riscv64-linux/7.3.0/libgcc.a(save-restore.o) examples/standalone/Makefile:62: recipe for target 'examples/standalone/hello_world' failed
...

so we would like to override the compiler flag mabi to lp64d.

Quoted 88 lines
Quoted 88 lines
Quoted 14 lines

arch/riscv/Kconfig config RISCV_ISA_C · line 91

Quoted 13 lines
---
 arch/riscv/Kconfig  |  8 ++++++++
 arch/riscv/Makefile | 12 ++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)
arch/riscv/Kconfig index renamed from arch/riscv/Kconfig +0 -0

362f3cdc65..a8031fa230 100644

arch/riscv/Kconfig +0 -0
@@ -91,6 +91,14 @@ config RISCV_ISA_C
          when building U-Boot, which results in compressed instructions

in the

Quoted 7 lines

arch/riscv/Kconfig config RISCV_ISA_C · line 96

Quoted 5 lines
arch/riscv/Kconfig +3 -0
          U-Boot binary.
 
+config RISCV_ISA_F
+       bool "Emit Floating-point instructions"
+       default n

this can be dropped as default is n

OK, I'll drop it

Quoted 8 lines

arch/riscv/Kconfig config RISCV_ISA_C

Quoted 4 lines
arch/riscv/Kconfig +4 -0
+       help
+         Adds "F" to the ISA subsets that the toolchain is allowed to emit
+         when building U-Boot, which results in Single and
+ Double-precision instructions

This does not match what the config name says. The config name is for F and it cannot indicate both F and D here.

OK, I'll correct it as follows to cover F and D:
config RISCV_ISA_FD
bool "Emit Floating-point instructions"
help
Adds "F" and "D" to the ISA subsets that the toolchain is allowed to emit when building U-Boot, which results in Single and Double-precision instructions in the U-Boot binary.

Quoted 11 lines
Quoted 11 lines
arch/riscv/Kconfig +2 -0
+         in the U-Boot binary.
+
 config RISCV_ISA_A
        def_bool y
arch/riscv/Makefile index renamed from arch/riscv/Makefile +0 -0

0b80eb8d86..87ec0ea4b5 100644

arch/riscv/Makefile +0 -0
@@ -5,15 +5,19 @@
 
Quoted 15 lines
Quoted 5 lines
arch/riscv/Makefile +1 -1
 ifeq ($(CONFIG_ARCH_RV64I),y)
        ARCH_BASE = rv64im
-       ABI = lp64
+       ABI := lp64
 endif

arch/riscv/Makefile line 18

Quoted 10 lines
arch/riscv/Makefile +3 -1
 ifeq ($(CONFIG_ARCH_RV32I),y)
        ARCH_BASE = rv32im
-       ABI = ilp32
+       ABI := ilp32
 endif
 ifeq ($(CONFIG_RISCV_ISA_A),y)
        ARCH_A = a
 endif
+ifeq ($(CONFIG_RISCV_ISA_F),y)
+       ARCH_F = fd

ifeq ($(CONFIG_RISCV_ISA_FD),y)
ARCH_FD = fd

Quoted 9 lines
Quoted 9 lines
arch/riscv/Makefile +2 -0
+       ABI := $(ABI)d
+endif
 ifeq ($(CONFIG_RISCV_ISA_C),y)
        ARCH_C = c
 endif
@@ -24,8 +28,8 @@ ifeq ($(CONFIG_CMODEL_MEDANY),y)
        CMODEL = medany
 endif
 
Quoted 3 lines

arch/riscv/Makefile ifeq ($(CONFIG_CMODEL_MEDANY),y)

Quoted 3 lines
arch/riscv/Makefile +1 -2
-ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI) \
-            -mcmodel=$(CMODEL)
+ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_F)$(ARCH_C)

ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_FD)$(ARCH_C)

Quoted 1 line

-mabi=$(ABI) \

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

arch/riscv/Makefile ifeq ($(CONFIG_CMODEL_MEDANY),y) · line 35

Quoted 4 lines
arch/riscv/Makefile +1 -0
+                                -mcmodel=$(CMODEL)
 
 PLATFORM_CPPFLAGS      += $(ARCH_FLAGS)
 CFLAGS_EFI             += $(ARCH_FLAGS)

Regards,
Bin

Thanks for your review
Eric

#5 lore raw

PATCH 1/1 riscv: add Kconfig entries for the F and D ISA extensions support

Hi Bin

Bin Meng <[email protected]> 於 2019年5月22日 週三 下午5:25寫道:

Quoted 37 lines

Hi Eric,

Quoted 26 lines · On Wed, May 22, 2019 at 4:23 PM <[email protected]> wrote:

Hi Bin,

Quoted 9 lines

-----Original Message-----
From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Tuesday, May 21, 2019 3:56 PM
To: Eric Te-Sheng Lin(林德晟)
Cc: U-Boot Mailing List; Lukas Auer; Anup Patel; Rick Jian-Zhi Chen(陳建志); Greentime Ying-Han Hu(胡英漢); dslin1010 at gmail.com
Subject: Re: [PATCH] riscv: add Kconfig entries for the F and D ISA extensions support

Quoted 8 lines

Hi Eric,

Quoted 2 lines · Eric Lin

This patch add Kconfig entries for the F (Single-Precision)

adds

OK I'll correct it as adds

Quoted 3 lines
Quoted 2 lines

and D (Double-Precision) floating point instruction-set extensions.

Quoted 6 lines
Quoted 3 lines

Could you please provide reason that why U-Boot has to be compiled using F/D extension?

Cause on AE350 platform, we have two different kinds of toolchain v5d (support I/M/A/C/F/D ISA) and
v5 (support I/M/A/C ISA). If we use the v5d toolchain to build U-Boot it will build fail, so we would like to add F/D extension on U-Boot.

Quoted 7 lines

I don't understand. What difference do these two toochains have? Isn't the v5d toolchain's default -march string be pre-configured to imafd? But even if the toolchain is pre-configured to generate fd instruction, I think it can be override by the compiler flags. Can you please share the details of the toolchain you used? I suspect you have to fix your toolchain, not U-Boot.

It's seems the ABI issue. Because our toolchain don't support
multilib, the v5d toolchain libraries ABI is ilp64d.
If I use the v5d toolchain to build U-Boot with -mabi=lp64, it will
get link error as below:
...
riscv64-linux-ld.bfd:
/nds64le-linux-glibc-v5d/bin/../lib/gcc/riscv64-linux/7.3.0/libgcc.a(save-restore.o):
can't link double-float modules with soft-float modules riscv64-linux-ld.bfd: failed to merge target specific data of file /nds64le-linux-glibc-v5d/bin/../lib/gcc/riscv64-linux/7.3.0/libgcc.a(save-restore.o) examples/standalone/Makefile:62: recipe for target 'examples/standalone/hello_world' failed
...

so we would like to override the compiler flag mabi to lp64d.

Quoted 88 lines
Quoted 88 lines
Quoted 14 lines

arch/riscv/Kconfig config RISCV_ISA_C · line 91

Quoted 13 lines
---
 arch/riscv/Kconfig  |  8 ++++++++
 arch/riscv/Makefile | 12 ++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)
arch/riscv/Kconfig index renamed from arch/riscv/Kconfig +0 -0

362f3cdc65..a8031fa230 100644

arch/riscv/Kconfig +0 -0
@@ -91,6 +91,14 @@ config RISCV_ISA_C
          when building U-Boot, which results in compressed instructions

in the

Quoted 7 lines

arch/riscv/Kconfig config RISCV_ISA_C · line 96

Quoted 5 lines
arch/riscv/Kconfig +3 -0
          U-Boot binary.
 
+config RISCV_ISA_F
+       bool "Emit Floating-point instructions"
+       default n

this can be dropped as default is n

OK, I'll drop it

Quoted 8 lines

arch/riscv/Kconfig config RISCV_ISA_C

Quoted 4 lines
arch/riscv/Kconfig +4 -0
+       help
+         Adds "F" to the ISA subsets that the toolchain is allowed to emit
+         when building U-Boot, which results in Single and
+ Double-precision instructions

This does not match what the config name says. The config name is for F and it cannot indicate both F and D here.

OK, I'll correct it as follows to cover F and D:
config RISCV_ISA_FD
bool "Emit Floating-point instructions"
help
Adds "F" and "D" to the ISA subsets that the toolchain is allowed to emit when building U-Boot, which results in Single and Double-precision instructions in the U-Boot binary.

Quoted 11 lines
Quoted 11 lines
arch/riscv/Kconfig +2 -0
+         in the U-Boot binary.
+
 config RISCV_ISA_A
        def_bool y
arch/riscv/Makefile index renamed from arch/riscv/Makefile +0 -0

0b80eb8d86..87ec0ea4b5 100644

arch/riscv/Makefile +0 -0
@@ -5,15 +5,19 @@
 
Quoted 15 lines
Quoted 5 lines
arch/riscv/Makefile +1 -1
 ifeq ($(CONFIG_ARCH_RV64I),y)
        ARCH_BASE = rv64im
-       ABI = lp64
+       ABI := lp64
 endif

arch/riscv/Makefile line 18

Quoted 10 lines
arch/riscv/Makefile +3 -1
 ifeq ($(CONFIG_ARCH_RV32I),y)
        ARCH_BASE = rv32im
-       ABI = ilp32
+       ABI := ilp32
 endif
 ifeq ($(CONFIG_RISCV_ISA_A),y)
        ARCH_A = a
 endif
+ifeq ($(CONFIG_RISCV_ISA_F),y)
+       ARCH_F = fd

ifeq ($(CONFIG_RISCV_ISA_FD),y)
ARCH_FD = fd

Quoted 9 lines
Quoted 9 lines
arch/riscv/Makefile +2 -0
+       ABI := $(ABI)d
+endif
 ifeq ($(CONFIG_RISCV_ISA_C),y)
        ARCH_C = c
 endif
@@ -24,8 +28,8 @@ ifeq ($(CONFIG_CMODEL_MEDANY),y)
        CMODEL = medany
 endif
 
Quoted 3 lines

arch/riscv/Makefile ifeq ($(CONFIG_CMODEL_MEDANY),y)

Quoted 3 lines
arch/riscv/Makefile +1 -2
-ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI) \
-            -mcmodel=$(CMODEL)
+ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_F)$(ARCH_C)

ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_FD)$(ARCH_C)

Quoted 1 line

-mabi=$(ABI) \

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

arch/riscv/Makefile ifeq ($(CONFIG_CMODEL_MEDANY),y) · line 35

Quoted 4 lines
arch/riscv/Makefile +1 -0
+                                -mcmodel=$(CMODEL)
 
 PLATFORM_CPPFLAGS      += $(ARCH_FLAGS)
 CFLAGS_EFI             += $(ARCH_FLAGS)

Regards,
Bin

Thanks for your review
Eric

#6 lore raw

PATCH 1/1 riscv: add Kconfig entries for the F and D ISA extensions support

In reply to Eric Lin

Hi Bin

Bin Meng <[email protected]> 於 2019年5月22日 週三 下午5:25寫道:

Quoted 37 lines

Hi Eric,

Quoted 26 lines · On Wed, May 22, 2019 at 4:23 PM <[email protected]> wrote:

Hi Bin,

Quoted 9 lines

-----Original Message-----
From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Tuesday, May 21, 2019 3:56 PM
To: Eric Te-Sheng Lin(林德晟)
Cc: U-Boot Mailing List; Lukas Auer; Anup Patel; Rick Jian-Zhi Chen(陳建志); Greentime Ying-Han Hu(胡英漢); dslin1010 at gmail.com
Subject: Re: [PATCH] riscv: add Kconfig entries for the F and D ISA extensions support

Quoted 8 lines

Hi Eric,

Quoted 2 lines · Eric Lin

This patch add Kconfig entries for the F (Single-Precision)

adds

OK I'll correct it as adds

Quoted 3 lines
Quoted 2 lines

and D (Double-Precision) floating point instruction-set extensions.

Quoted 6 lines
Quoted 3 lines

Could you please provide reason that why U-Boot has to be compiled using F/D extension?

Cause on AE350 platform, we have two different kinds of toolchain v5d (support I/M/A/C/F/D ISA) and
v5 (support I/M/A/C ISA). If we use the v5d toolchain to build U-Boot it will build fail, so we would like to add F/D extension on U-Boot.

Quoted 7 lines

I don't understand. What difference do these two toochains have? Isn't the v5d toolchain's default -march string be pre-configured to imafd? But even if the toolchain is pre-configured to generate fd instruction, I think it can be override by the compiler flags. Can you please share the details of the toolchain you used? I suspect you have to fix your toolchain, not U-Boot.

It's seems the ABI issue. Because our toolchain don't support
multilib, the v5d toolchain libraries ABI is ilp64d.
If I use the v5d toolchain to build U-Boot with -mabi=lp64, it will
get link error as below:
...
riscv64-linux-ld.bfd:
/nds64le-linux-glibc-v5d/bin/../lib/gcc/riscv64-linux/7.3.0/libgcc.a(save-restore.o):
can't link double-float modules with soft-float modules riscv64-linux-ld.bfd: failed to merge target specific data of file /nds64le-linux-glibc-v5d/bin/../lib/gcc/riscv64-linux/7.3.0/libgcc.a(save-restore.o) examples/standalone/Makefile:62: recipe for target 'examples/standalone/hello_world' failed
...

so we would like to override the compiler flag mabi to lp64d.

Quoted 88 lines
Quoted 88 lines
Quoted 14 lines

arch/riscv/Kconfig config RISCV_ISA_C · line 91

Quoted 13 lines
---
 arch/riscv/Kconfig  |  8 ++++++++
 arch/riscv/Makefile | 12 ++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)
arch/riscv/Kconfig index renamed from arch/riscv/Kconfig +0 -0

362f3cdc65..a8031fa230 100644

arch/riscv/Kconfig +0 -0
@@ -91,6 +91,14 @@ config RISCV_ISA_C
          when building U-Boot, which results in compressed instructions

in the

Quoted 7 lines

arch/riscv/Kconfig config RISCV_ISA_C · line 96

Quoted 5 lines
arch/riscv/Kconfig +3 -0
          U-Boot binary.
 
+config RISCV_ISA_F
+       bool "Emit Floating-point instructions"
+       default n

this can be dropped as default is n

OK, I'll drop it

Quoted 8 lines

arch/riscv/Kconfig config RISCV_ISA_C

Quoted 4 lines
arch/riscv/Kconfig +4 -0
+       help
+         Adds "F" to the ISA subsets that the toolchain is allowed to emit
+         when building U-Boot, which results in Single and
+ Double-precision instructions

This does not match what the config name says. The config name is for F and it cannot indicate both F and D here.

OK, I'll correct it as follows to cover F and D:
config RISCV_ISA_FD
bool "Emit Floating-point instructions"
help
Adds "F" and "D" to the ISA subsets that the toolchain is allowed to emit when building U-Boot, which results in Single and Double-precision instructions in the U-Boot binary.

Quoted 11 lines
Quoted 11 lines
arch/riscv/Kconfig +2 -0
+         in the U-Boot binary.
+
 config RISCV_ISA_A
        def_bool y
arch/riscv/Makefile index renamed from arch/riscv/Makefile +0 -0

0b80eb8d86..87ec0ea4b5 100644

arch/riscv/Makefile +0 -0
@@ -5,15 +5,19 @@
 
Quoted 15 lines
Quoted 5 lines
arch/riscv/Makefile +1 -1
 ifeq ($(CONFIG_ARCH_RV64I),y)
        ARCH_BASE = rv64im
-       ABI = lp64
+       ABI := lp64
 endif

arch/riscv/Makefile line 18

Quoted 10 lines
arch/riscv/Makefile +3 -1
 ifeq ($(CONFIG_ARCH_RV32I),y)
        ARCH_BASE = rv32im
-       ABI = ilp32
+       ABI := ilp32
 endif
 ifeq ($(CONFIG_RISCV_ISA_A),y)
        ARCH_A = a
 endif
+ifeq ($(CONFIG_RISCV_ISA_F),y)
+       ARCH_F = fd

ifeq ($(CONFIG_RISCV_ISA_FD),y)
ARCH_FD = fd

Quoted 9 lines
Quoted 9 lines
arch/riscv/Makefile +2 -0
+       ABI := $(ABI)d
+endif
 ifeq ($(CONFIG_RISCV_ISA_C),y)
        ARCH_C = c
 endif
@@ -24,8 +28,8 @@ ifeq ($(CONFIG_CMODEL_MEDANY),y)
        CMODEL = medany
 endif
 
Quoted 3 lines

arch/riscv/Makefile ifeq ($(CONFIG_CMODEL_MEDANY),y)

Quoted 3 lines
arch/riscv/Makefile +1 -2
-ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI) \
-            -mcmodel=$(CMODEL)
+ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_F)$(ARCH_C)

ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_FD)$(ARCH_C)

Quoted 1 line

-mabi=$(ABI) \

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

arch/riscv/Makefile ifeq ($(CONFIG_CMODEL_MEDANY),y) · line 35

Quoted 4 lines
arch/riscv/Makefile +1 -0
+                                -mcmodel=$(CMODEL)
 
 PLATFORM_CPPFLAGS      += $(ARCH_FLAGS)
 CFLAGS_EFI             += $(ARCH_FLAGS)

Regards,
Bin

Thanks for your review
Eric

#7 lore raw

PATCH 1/1 riscv: add Kconfig entries for the F and D ISA extensions support

In reply to Eric Lin

Hi Eric,

Quoted 49 lines · Eric Lin

Hi Bin

Bin Meng <[email protected]> 於 2019年5月22日 週三 下午5:25寫道:

Quoted 37 lines

Hi Eric,

Quoted 26 lines · On Wed, May 22, 2019 at 4:23 PM <[email protected]> wrote:

Hi Bin,

Quoted 9 lines

-----Original Message-----
From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Tuesday, May 21, 2019 3:56 PM
To: Eric Te-Sheng Lin(林德晟)
Cc: U-Boot Mailing List; Lukas Auer; Anup Patel; Rick Jian-Zhi Chen(陳建志); Greentime Ying-Han Hu(胡英漢); dslin1010 at gmail.com
Subject: Re: [PATCH] riscv: add Kconfig entries for the F and D ISA extensions support

Quoted 8 lines

Hi Eric,

Quoted 2 lines · Eric Lin

This patch add Kconfig entries for the F (Single-Precision)

adds

OK I'll correct it as adds

Quoted 3 lines
Quoted 2 lines

and D (Double-Precision) floating point instruction-set extensions.

Quoted 6 lines
Quoted 3 lines

Could you please provide reason that why U-Boot has to be compiled using F/D extension?

Cause on AE350 platform, we have two different kinds of toolchain v5d (support I/M/A/C/F/D ISA) and
v5 (support I/M/A/C ISA). If we use the v5d toolchain to build U-Boot it will build fail, so we would like to add F/D extension on U-Boot.

Quoted 7 lines

I don't understand. What difference do these two toochains have? Isn't the v5d toolchain's default -march string be pre-configured to imafd? But even if the toolchain is pre-configured to generate fd instruction, I think it can be override by the compiler flags. Can you please share the details of the toolchain you used? I suspect you have to fix your toolchain, not U-Boot.

Quoted 4 lines

It's seems the ABI issue. Because our toolchain don't support multilib, the v5d toolchain libraries ABI is ilp64d.
If I use the v5d toolchain to build U-Boot with -mabi=lp64, it will get link error as below:

Then please fix your compiler. Passing -mabi=lp64 to compiler is definitely correct.

Quoted 11 lines

...
riscv64-linux-ld.bfd:
/nds64le-linux-glibc-v5d/bin/../lib/gcc/riscv64-linux/7.3.0/libgcc.a(save-restore.o):
can't link double-float modules with soft-float modules riscv64-linux-ld.bfd: failed to merge target specific data of file /nds64le-linux-glibc-v5d/bin/../lib/gcc/riscv64-linux/7.3.0/libgcc.a(save-restore.o) examples/standalone/Makefile:62: recipe for target 'examples/standalone/hello_world' failed
...

so we would like to override the compiler flag mabi to lp64d.

No, adding this to U-Boot is a workaround to your compiler.

Regards,
Bin

#8 lore raw

PATCH 1/1 riscv: add Kconfig entries for the F and D ISA extensions support

Hi Bin,

Quoted 52 lines · Bin Meng

Hi Eric,

Quoted 49 lines · Eric Lin

Hi Bin

Bin Meng <[email protected]> ??? 2019???5???22??? ?????? ??????5:25?????????

Quoted 44 lines

Hi Eric,

Quoted 26 lines · On Wed, May 22, 2019 at 4:23 PM <[email protected]> wrote:

Hi Bin,

Quoted 9 lines

-----Original Message-----
From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Tuesday, May 21, 2019 3:56 PM
To: Eric Te-Sheng Lin(?????????)
Cc: U-Boot Mailing List; Lukas Auer; Anup Patel; Rick Jian-Zhi Chen(?????????); Greentime Ying-Han Hu(?????????); dslin1010 at gmail.com
Subject: Re: [PATCH] riscv: add Kconfig entries for the F and D ISA extensions support

Quoted 8 lines

Hi Eric,

Quoted 2 lines · Eric Lin

This patch add Kconfig entries for the F (Single-Precision)

adds

OK I'll correct it as adds

Quoted 3 lines
Quoted 2 lines

and D (Double-Precision) floating point instruction-set extensions.

Quoted 6 lines
Quoted 3 lines

Could you please provide reason that why U-Boot has to be compiled using F/D extension?

Cause on AE350 platform, we have two different kinds of toolchain v5d (support I/M/A/C/F/D ISA) and
v5 (support I/M/A/C ISA). If we use the v5d toolchain to build U-Boot it will build fail, so we would like to add F/D extension on U-Boot.

I don't understand. What difference do these two toochains have? Isn't the v5d toolchain's default -march string be pre-configured to imafd? But even if the toolchain is pre-configured to generate fd instruction, I think it can be override by the compiler flags. Can you please share the details of the toolchain you used? I suspect you have to fix your toolchain, not U-Boot.

Quoted 7 lines
Quoted 4 lines

It's seems the ABI issue. Because our toolchain don't support multilib, the v5d toolchain libraries ABI is ilp64d.
If I use the v5d toolchain to build U-Boot with -mabi=lp64, it will get link error as below:

Then please fix your compiler. Passing -mabi=lp64 to compiler is definitely correct.

One of our customer ever used floating point in their project. They want to calculate something with floating point instructions in u-Boot before entering kernel.

IMHO, we may consider this case for user to use -mabi=ilp64d.
This CONFIG will be useful for them to compile their codes and linking together with u-Boot.

Thanks :)

#9 lore raw

PATCH 1/1 riscv: add Kconfig entries for the F and D ISA extensions support

Hi Greentime,

Quoted 60 lines · Greentime Hu

Hi Bin,

Quoted 57 lines · Bin Meng

Hi Eric,

Quoted 53 lines · Eric Lin

Hi Bin

Bin Meng <[email protected]> ??? 2019???5???22??? ?????? ??????5:25?????????

Quoted 37 lines

Hi Eric,

Quoted 26 lines · On Wed, May 22, 2019 at 4:23 PM <[email protected]> wrote:

Hi Bin,

Quoted 9 lines

-----Original Message-----
From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Tuesday, May 21, 2019 3:56 PM
To: Eric Te-Sheng Lin(?????????)
Cc: U-Boot Mailing List; Lukas Auer; Anup Patel; Rick Jian-Zhi Chen(?????????); Greentime Ying-Han Hu(?????????); dslin1010 at gmail.com
Subject: Re: [PATCH] riscv: add Kconfig entries for the F and D ISA extensions support

Quoted 8 lines

Hi Eric,

Quoted 2 lines · Eric Lin

This patch add Kconfig entries for the F (Single-Precision)

adds

OK I'll correct it as adds

Quoted 3 lines
Quoted 2 lines

and D (Double-Precision) floating point instruction-set extensions.

Quoted 6 lines
Quoted 3 lines

Could you please provide reason that why U-Boot has to be compiled using F/D extension?

Cause on AE350 platform, we have two different kinds of toolchain v5d (support I/M/A/C/F/D ISA) and
v5 (support I/M/A/C ISA). If we use the v5d toolchain to build U-Boot it will build fail, so we would like to add F/D extension on U-Boot.

Quoted 7 lines

I don't understand. What difference do these two toochains have? Isn't the v5d toolchain's default -march string be pre-configured to imafd? But even if the toolchain is pre-configured to generate fd instruction, I think it can be override by the compiler flags. Can you please share the details of the toolchain you used? I suspect you have to fix your toolchain, not U-Boot.

It's seems the ABI issue. Because our toolchain don't support multilib, the v5d toolchain libraries ABI is ilp64d.
If I use the v5d toolchain to build U-Boot with -mabi=lp64, it will get link error as below:

Quoted 6 lines
Quoted 2 lines

Then please fix your compiler. Passing -mabi=lp64 to compiler is definitely correct.

One of our customer ever used floating point in their project. They want to calculate something with floating point instructions in u-Boot before entering kernel.

This is a new use case. For other architectures like x86, we don't allow U-Boot to be compiled using hardware float ABI. Why can't they use software floating point instead?

Quoted 6 lines

IMHO, we may consider this case for user to use -mabi=ilp64d.
This CONFIG will be useful for them to compile their codes and linking together with u-Boot.

Thanks :)

Regards,
Bin

#10 lore raw

PATCH 1/1 riscv: add Kconfig entries for the F and D ISA extensions support

Hi Bin,

Quoted 66 lines · Bin Meng

Hi Greentime,

Quoted 63 lines · Greentime Hu

Hi Bin,

Quoted 59 lines · Bin Meng

Hi Eric,

Quoted 49 lines · Eric Lin

Hi Bin

Bin Meng <[email protected]> ??? 2019???5???22??? ?????? ??????5:25?????????

Quoted 37 lines

Hi Eric,

Quoted 26 lines · On Wed, May 22, 2019 at 4:23 PM <[email protected]> wrote:

Hi Bin,

Quoted 9 lines

-----Original Message-----
From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Tuesday, May 21, 2019 3:56 PM
To: Eric Te-Sheng Lin(?????????)
Cc: U-Boot Mailing List; Lukas Auer; Anup Patel; Rick Jian-Zhi Chen(?????????); Greentime Ying-Han Hu(?????????); dslin1010 at gmail.com
Subject: Re: [PATCH] riscv: add Kconfig entries for the F and D ISA extensions support

Quoted 8 lines

Hi Eric,

Quoted 2 lines · Eric Lin

This patch add Kconfig entries for the F (Single-Precision)

adds

OK I'll correct it as adds

Quoted 3 lines
Quoted 2 lines

and D (Double-Precision) floating point instruction-set extensions.

Quoted 6 lines
Quoted 3 lines

Could you please provide reason that why U-Boot has to be compiled using F/D extension?

Cause on AE350 platform, we have two different kinds of toolchain v5d (support I/M/A/C/F/D ISA) and
v5 (support I/M/A/C ISA). If we use the v5d toolchain to build U-Boot it will build fail, so we would like to add F/D extension on U-Boot.

Quoted 7 lines

I don't understand. What difference do these two toochains have? Isn't the v5d toolchain's default -march string be pre-configured to imafd? But even if the toolchain is pre-configured to generate fd instruction, I think it can be override by the compiler flags. Can you please share the details of the toolchain you used? I suspect you have to fix your toolchain, not U-Boot.

Quoted 4 lines

It's seems the ABI issue. Because our toolchain don't support multilib, the v5d toolchain libraries ABI is ilp64d.
If I use the v5d toolchain to build U-Boot with -mabi=lp64, it will get link error as below:

Then please fix your compiler. Passing -mabi=lp64 to compiler is definitely correct.

Quoted 7 lines
Quoted 3 lines

One of our customer ever used floating point in their project. They want to calculate something with floating point instructions in u-Boot before entering kernel.

This is a new use case. For other architectures like x86, we don't allow U-Boot to be compiled using hardware float ABI. Why can't they use software floating point instead?

It's because they'd like to calculate something very quickly. It may just be done in few cycles with floating point instructions and it will be very useful for their usages instead of using soft-float.

That's the reason they ask us to provide such kind of CONFIG and we think it might also be helpful for users who are trying to do some mathematics with floating point instructions in u-Boot.

Thanks. :)

Quoted 9 lines
Quoted 6 lines

IMHO, we may consider this case for user to use -mabi=ilp64d.
This CONFIG will be useful for them to compile their codes and linking together with u-Boot.

Thanks :)

Regards,
Bin

#11 lore raw

PATCH 1/1 riscv: add Kconfig entries for the F and D ISA extensions support

Quoted 77 lines · Greentime Hu

Hi Bin,

Quoted 66 lines · Bin Meng

Hi Greentime,

Quoted 63 lines · Greentime Hu

Hi Bin,

Quoted 59 lines · Bin Meng

Hi Eric,

Quoted 49 lines · Eric Lin

Hi Bin

Bin Meng <[email protected]> ??? 2019???5???22??? ?????? ??????5:25?????????

Quoted 37 lines

Hi Eric,

Quoted 26 lines · On Wed, May 22, 2019 at 4:23 PM <[email protected]> wrote:

Hi Bin,

Quoted 9 lines

-----Original Message-----
From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Tuesday, May 21, 2019 3:56 PM
To: Eric Te-Sheng Lin(?????????)
Cc: U-Boot Mailing List; Lukas Auer; Anup Patel; Rick Jian-Zhi Chen(?????????); Greentime Ying-Han Hu(?????????); dslin1010 at gmail.com
Subject: Re: [PATCH] riscv: add Kconfig entries for the F and D ISA extensions support

Quoted 8 lines

Hi Eric,

Quoted 2 lines · Eric Lin

This patch add Kconfig entries for the F (Single-Precision)

adds

OK I'll correct it as adds

Quoted 3 lines
Quoted 2 lines

and D (Double-Precision) floating point instruction-set extensions.

Quoted 6 lines
Quoted 3 lines

Could you please provide reason that why U-Boot has to be compiled using F/D extension?

Cause on AE350 platform, we have two different kinds of toolchain v5d (support I/M/A/C/F/D ISA) and
v5 (support I/M/A/C ISA). If we use the v5d toolchain to build U-Boot it will build fail, so we would like to add F/D extension on U-Boot.

Quoted 7 lines

I don't understand. What difference do these two toochains have? Isn't the v5d toolchain's default -march string be pre-configured to imafd? But even if the toolchain is pre-configured to generate fd instruction, I think it can be override by the compiler flags. Can you please share the details of the toolchain you used? I suspect you have to fix your toolchain, not U-Boot.

Quoted 4 lines

It's seems the ABI issue. Because our toolchain don't support multilib, the v5d toolchain libraries ABI is ilp64d.
If I use the v5d toolchain to build U-Boot with -mabi=lp64, it will get link error as below:

Then please fix your compiler. Passing -mabi=lp64 to compiler is definitely correct.

Quoted 7 lines
Quoted 3 lines

One of our customer ever used floating point in their project. They want to calculate something with floating point instructions in u-Boot before entering kernel.

This is a new use case. For other architectures like x86, we don't allow U-Boot to be compiled using hardware float ABI. Why can't they use software floating point instead?

Quoted 8 lines

It's because they'd like to calculate something very quickly. It may just be done in few cycles with floating point instructions and it will be very useful for their usages instead of using soft-float.

That's the reason they ask us to provide such kind of CONFIG and we think it might also be helpful for users who are trying to do some mathematics with floating point instructions in u-Boot.

I will have to leave this to other people to comment. I personally do not like this to be supported in the upstream U-Boot. However if others do not object, I am OK too.

Regards,
Bin