Skip to contentSkip to conversation

Update RISC-V Instruction Sets

PATCH Superseded Jamie Gibbons via buildroot 1 participant 6 messages Aug 15, 2023 – Aug 16, 2023 RISC-V

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Update RISC-V Instruction Sets

Hi all,

As per an earlier discussion with Thomas Petazzoni, we have decided that it best to update the RISC-V instruction sets. This patch series updates the kconfig to allow C and V to be selected as part of the general purpose instruction set, thus allowing IMAFD + C and IMAFD + V to be a part of a general purpose selection and keeping other configurations as custom.
With this I have updated the microchip_mpfs_icicle_defconfig to make use of these changes.
Finally, I have included a fix to the post-image script to allow an sdcard.img to be built for the Microchip MPFS Icicle kit. When merging, some changes were made that broke this. The hss-payload-generator tool looks for the u-boot.bin image in the directory this command is run from. This binary file is located in the output images directory. All changes to this script were made to try to ensure optimise paths and methods while achieving a working solution.
This patch set is indended to be applied to the next branch as that is where the Microchip Icicle kit patch series has previously been applied.

Looking forward to your feedback.

Regards,
Jamie.

Jamie Gibbons (3):
arch/Config.in.riscv: update instruction set ext configs/microchip_mpfs_icicle_defconfig: update instruction sets board/microchip/mpfs_icicle: update post-image script

 arch/Config.in.riscv                      | 24 ++++++++++++++---------
 board/microchip/mpfs_icicle/post-image.sh |  6 ++++--
 configs/microchip_mpfs_icicle_defconfig   |  5 +----
 3 files changed, 20 insertions(+), 15 deletions(-)
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 1/3 arch/Config.in.riscv: update instruction set ext

Allow a RISC-V G core to support C and V. Move custom RVC and RVV instructions from RISC-V custom core to RISC-V general core.

---
 arch/Config.in.riscv | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)
arch/Config.in.riscv +15 -9
index 3dfbb4165f..ab839fd8a4 100644
@@ -35,6 +35,21 @@ config BR2_riscv_g
 	help
 	  General purpose (G) is equivalent to IMAFD.
 
+if BR2_riscv_g
+
+comment "Instruction Set Extensions"
+
+config BR2_RISCV_ISA_CUSTOM_RVC
+	bool "Compressed Instructions (C)"
+	select BR2_RISCV_ISA_RVC
+
+config BR2_RISCV_ISA_CUSTOM_RVV
+	bool "Vector Instructions (V)"
+	select BR2_RISCV_ISA_RVV
+	select BR2_ARCH_NEEDS_GCC_AT_LEAST_12
+
+endif
+
 config BR2_riscv_custom
 	bool "Custom architecture"
 	select BR2_RISCV_ISA_RVI
@@ -62,15 +77,6 @@ config BR2_RISCV_ISA_CUSTOM_RVD
 	depends on BR2_RISCV_ISA_RVF
 	select BR2_RISCV_ISA_RVD
 
-config BR2_RISCV_ISA_CUSTOM_RVC
-	bool "Compressed Instructions (C)"
-	select BR2_RISCV_ISA_RVC
-
-config BR2_RISCV_ISA_CUSTOM_RVV
-	bool "Vector Instructions (V)"
-	select BR2_RISCV_ISA_RVV
-	select BR2_ARCH_NEEDS_GCC_AT_LEAST_12
-
 endif
 
 choice
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 1/3] arch/Config.in.riscv: update instruction set ext

Quoted 4 lines · On Tue, 15 Aug 2023 11:05:58 +0100 Jamie Gibbons via buildroot…
arch/Config.in.riscv +4 -0
+if BR2_riscv_g
+
+comment "Instruction Set Extensions"
+

arch/Config.in.riscv config BR2_riscv_g · line 51

Quoted 10 lines
arch/Config.in.riscv +10 -0
+config BR2_RISCV_ISA_CUSTOM_RVC
+	bool "Compressed Instructions (C)"
+	select BR2_RISCV_ISA_RVC
+
+config BR2_RISCV_ISA_CUSTOM_RVV
+	bool "Vector Instructions (V)"
+	select BR2_RISCV_ISA_RVV
+	select BR2_ARCH_NEEDS_GCC_AT_LEAST_12
+
+endif

I believe this is still not correct: now those options are only available for the BR2_riscv_g case, no longer for the custom RISC-V core case.

Those two options should be available both as add-ons for the riscv_g *and* for the riscv custom cases.

Best regards,

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Re: [Buildroot] [PATCH 1/3] arch/Config.in.riscv: update instruction set ext

Hi Thomas,

Quoted 25 lines · Thomas Petazzoni

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 4 lines · On Tue, 15 Aug 2023 11:05:58 +0100 Jamie Gibbons via buildroot…
arch/Config.in.riscv +4 -0
+if BR2_riscv_g
+
+comment "Instruction Set Extensions"
+

arch/Config.in.riscv config BR2_riscv_g · line 51

Quoted 10 lines
arch/Config.in.riscv +10 -0
+config BR2_RISCV_ISA_CUSTOM_RVC
+     bool "Compressed Instructions (C)"
+     select BR2_RISCV_ISA_RVC
+
+config BR2_RISCV_ISA_CUSTOM_RVV
+     bool "Vector Instructions (V)"
+     select BR2_RISCV_ISA_RVV
+     select BR2_ARCH_NEEDS_GCC_AT_LEAST_12
+
+endif

I believe this is still not correct: now those options are only available for the BR2_riscv_g case, no longer for the custom RISC-V core case.

Quoted 3 lines

Those two options should be available both as add-ons for the riscv_g *and* for the riscv custom cases.

Apologies, I misunderstood your suggestion to "move" the options. I will update this and send a v2.

Regards,

Jamie.

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

PATCH 2/3 configs/microchip_mpfs_icicle_defconfig: update instruction sets

In reply to Jamie Gibbons via buildroot

Update the instruction sets for MPFS icicle kit to mirror the configuration update, i.e. It is now classed as a RISC-V G core with support for C, IMAFDC.

---
 configs/microchip_mpfs_icicle_defconfig | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
configs/microchip_mpfs_icicle_defconfig +1 -4
index b2568cae6a..a3b3093982 100644
@@ -1,8 +1,5 @@
 BR2_riscv=y
-BR2_riscv_custom=y
-BR2_RISCV_ISA_CUSTOM_RVM=y
-BR2_RISCV_ISA_CUSTOM_RVF=y
-BR2_RISCV_ISA_CUSTOM_RVD=y
+BR2_riscv_g=y
 BR2_RISCV_ISA_CUSTOM_RVC=y
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_1=y
 BR2_TARGET_GENERIC_HOSTNAME="mpfs_icicle"
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

PATCH 3/3 board/microchip/mpfs_icicle: update post-image script

In reply to Jamie Gibbons via buildroot

The hss-payload-generator could not find where u-boot.bin was when looking for it using the config.yaml. This needs to be ran in the same directory as the u-boot.bin file to enable it to find it. Fix the post image script to allow an image to get built.

---
 board/microchip/mpfs_icicle/post-image.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
board/microchip/mpfs_icicle/post-image.sh +4 -2
index 04b34bbd40..2368aa42f6 100755
@@ -2,7 +2,9 @@
 HSS_PAYLOAD_GENERATOR=${HOST_DIR}/bin/hss-payload-generator
 MKIMAGE=${HOST_DIR}/bin/mkimage
 
-"${HSS_PAYLOAD_GENERATOR}" -c board/microchip/mpfs_icicle/config.yaml "${BINARIES_DIR}"/payload.bin
-cp board/microchip/mpfs_icicle/mpfs_icicle.its "${BINARIES_DIR}"/mpfs_icicle.its
+cd "${BINARIES_DIR}" || exit
+"${HSS_PAYLOAD_GENERATOR}" -c "${CONFIG_DIR}"/board/microchip/mpfs_icicle/config.yaml payload.bin
+cd "${CONFIG_DIR}" || exit
+cp "${CONFIG_DIR}"/board/microchip/mpfs_icicle/mpfs_icicle.its "${BINARIES_DIR}"/mpfs_icicle.its
 (cd "${BINARIES_DIR}" && "${MKIMAGE}" -f mpfs_icicle.its mpfs_icicle.itb)
 support/scripts/genimage.sh -c board/microchip/mpfs_icicle/genimage.cfg
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot