Skip to contentSkip to conversation

riscv: Support riscv64 image type

PATCH In review Rick Chen 4 participants 6 messages Apr 10, 2023 – Jul 27, 2023 RISC-V

lore
Share & tools
lore

Rick Chen

author
#0 lore raw

PATCH 1/1 riscv: Support riscv64 image type

Allow U-Boot to load 32 or 64 bits RISC-V Kernel Image distinguishly. It helps to avoid someone maybe make a mistake to run 32-bit U-Boot to load 64-bit kernel.

---
The patchset is based on Simon's patch:
riscv: Add a 64-bit image type
---

---
 arch/riscv/include/asm/u-boot.h | 4 ++++
 cmd/booti.c                     | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
arch/riscv/include/asm/u-boot.h +4 -0
index d5e1d5f323..e3b4a0357c 100644
@@ -23,6 +23,10 @@
 #include <asm/u-boot-riscv.h>
 
 /* For image.h:image_check_target_arch() */
+#ifdef CONFIG_ARCH_RV64I
+#define IH_ARCH_DEFAULT IH_ARCH_RISCV64
+#else
 #define IH_ARCH_DEFAULT IH_ARCH_RISCV
+#endif
 
 #endif	/* _U_BOOT_H_ */
cmd/booti.c +1 -1
index 6ac39193db..dc0b0ae41c 100644
@@ -119,7 +119,7 @@ int do_booti(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 
 	images.os.os = IH_OS_LINUX;
 #ifdef CONFIG_RISCV_SMODE
-	images.os.arch = IH_ARCH_RISCV;
+	images.os.arch = IH_ARCH_DEFAULT;
 #elif CONFIG_ARM64
 	images.os.arch = IH_ARCH_ARM64;
 #endif
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw

Hi Rick,

Quoted 7 lines · Rick Chen

Allow U-Boot to load 32 or 64 bits RISC-V Kernel Image distinguishly. It helps to avoid someone maybe make a mistake to run 32-bit U-Boot to load 64-bit kernel.

Quoted 8 lines

---
The patchset is based on Simon's patch:
riscv: Add a 64-bit image type
---

---
 arch/riscv/include/asm/u-boot.h | 4 ++++
 cmd/booti.c                     | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

I don't know much about RISC-V, but I assume U-Boot is able to do this successfully? Does it not need to switch modes first?

Regards,
Simon

#2 lore raw

Hi Simon,

Quoted 19 lines

Hi Rick,

Quoted 7 lines · Rick Chen

Allow U-Boot to load 32 or 64 bits RISC-V Kernel Image distinguishly. It helps to avoid someone maybe make a mistake to run 32-bit U-Boot to load 64-bit kernel.

Quoted 8 lines

---
The patchset is based on Simon's patch:
riscv: Add a 64-bit image type
---

---
 arch/riscv/include/asm/u-boot.h | 4 ++++
 cmd/booti.c                     | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
Quoted 4 lines

I don't know much about RISC-V, but I assume U-Boot is able to do this successfully? Does it not need to switch modes first?

No, it is not need to switch modes as far as I know.
Here only provide a check mechanism just like arm to see if loader and OS are match

But This patch is for bootm flow.
Maybe I still need to check if it is necessary to prepare a patch for binman flow ?
/arch/riscv/dts/binman.dtsi
arch = "riscv";

maybe provide another binman64.dtsi for arch="riscv64"

Thanks,
Rick

Quoted 3 lines

Regards,
Simon

#3 lore raw

Hi Rick,

Quoted 31 lines · Rick Chen

Hi Simon,

Quoted 19 lines

Hi Rick,

Quoted 7 lines · Rick Chen

Allow U-Boot to load 32 or 64 bits RISC-V Kernel Image distinguishly. It helps to avoid someone maybe make a mistake to run 32-bit U-Boot to load 64-bit kernel.

Quoted 8 lines

---
The patchset is based on Simon's patch:
riscv: Add a 64-bit image type
---

---
 arch/riscv/include/asm/u-boot.h | 4 ++++
 cmd/booti.c                     | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
Quoted 4 lines

I don't know much about RISC-V, but I assume U-Boot is able to do this successfully? Does it not need to switch modes first?

No, it is not need to switch modes as far as I know.
Here only provide a check mechanism just like arm to see if loader and OS are match

Quoted 7 lines

But This patch is for bootm flow.
Maybe I still need to check if it is necessary to prepare a patch for binman flow ?
/arch/riscv/dts/binman.dtsi
arch = "riscv";

maybe provide another binman64.dtsi for arch="riscv64"

Yes I think that is needed too. Are you going to update this patch, or send a second one?

Regards,
Simon

#4 lore raw
Quoted 40 lines

Hi Rick,

Quoted 37 lines · Rick Chen

Hi Simon,

Quoted 19 lines

Hi Rick,

Quoted 7 lines · Rick Chen

Allow U-Boot to load 32 or 64 bits RISC-V Kernel Image distinguishly. It helps to avoid someone maybe make a mistake to run 32-bit U-Boot to load 64-bit kernel.

Quoted 8 lines

---
The patchset is based on Simon's patch:
riscv: Add a 64-bit image type
---

---
 arch/riscv/include/asm/u-boot.h | 4 ++++
 cmd/booti.c                     | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
Quoted 4 lines

I don't know much about RISC-V, but I assume U-Boot is able to do this successfully? Does it not need to switch modes first?

No, it is not need to switch modes as far as I know.
Here only provide a check mechanism just like arm to see if loader and OS are match

But This patch is for bootm flow.
Maybe I still need to check if it is necessary to prepare a patch for binman flow ?
/arch/riscv/dts/binman.dtsi
arch = "riscv";

Quoted 4 lines
Quoted 1 line

maybe provide another binman64.dtsi for arch="riscv64"

Yes I think that is needed too. Are you going to update this patch, or send a second one?

Hi Simon,

OK.

HI Leo,

I am a little busy on other things.Can you help to update this patch ?

Thanks.
Rick

Quoted 3 lines

Regards,
Simon

#5 lore raw

Hi Rick,

Quoted 45 lines · Rick Chen
Quoted 40 lines

Hi Rick,

Quoted 37 lines · Rick Chen

Hi Simon,

Quoted 19 lines

Hi Rick,

Quoted 7 lines · Rick Chen

Allow U-Boot to load 32 or 64 bits RISC-V Kernel Image distinguishly. It helps to avoid someone maybe make a mistake to run 32-bit U-Boot to load 64-bit kernel.

Quoted 8 lines

---
The patchset is based on Simon's patch:
riscv: Add a 64-bit image type
---

---
 arch/riscv/include/asm/u-boot.h | 4 ++++
 cmd/booti.c                     | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
Quoted 4 lines

I don't know much about RISC-V, but I assume U-Boot is able to do this successfully? Does it not need to switch modes first?

No, it is not need to switch modes as far as I know.
Here only provide a check mechanism just like arm to see if loader and OS are match

But This patch is for bootm flow.
Maybe I still need to check if it is necessary to prepare a patch for binman flow ?
/arch/riscv/dts/binman.dtsi
arch = "riscv";

Quoted 4 lines
Quoted 1 line

maybe provide another binman64.dtsi for arch="riscv64"

Yes I think that is needed too. Are you going to update this patch, or send a second one?

Quoted 8 lines

Hi Simon,

OK.

HI Leo,

I am a little busy on other things.Can you help to update this patch ?

No problem!
I will send a v2 patch ASAP.

Best regards,
Leo

Quoted 6 lines

Thanks.
Rick

Quoted 3 lines

Regards,
Simon