Skip to contentSkip to conversation

u-boot-riscv/master

GIT PULL Leo Liang 5 participants 15 messages May 21, 2025 – May 27, 2025

lore
Share & tools
lore

Leo Liang

author
#0 lore raw

Hi Tom,

The following changes since commit a3e09b24ffd4429909604f1b28455b44306edbaa:

Merge tag 'mmc-2025-05-20' of https://source.denx.de/u-boot/custodians/u-boot-mmc (2025-05-20 08:35:31 -0600)

are available in the Git repository at:

https://source.denx.de/u-boot/custodians/u-boot-riscv.git

for you to fetch changes up to ff6e20c32ff33c6963f7d0a79a0914681461f4fa:

riscv: dts: th1520: Complete clock tree (2025-05-21 16:49:58 +0800)

CI result shows no issue: https://source.denx.de/u-boot/custodians/u-boot-riscv/-/pipelines/26259

----------------------------------------------------------------
- Initial SPL support for T-Head TH1520 SoC
- Improve usability of TH1520 with mainline SPL
- Support building RV32 & RV64 images
- riscv: Improve jh7110 support
----------------------------------------------------------------
E Shattow (3):
riscv: starfive: jh7110: move uart0 clock frequency to config header
riscv: dts: jh7110: remove redundant parent nodes
riscv: dts: jh7110: override syscrg assigned clock rates with defaults

Mayuresh Chitale (4):
riscv: image: Add new image type for RV64
riscv: Select appropriate image type
booti/bootm: riscv: Verify image arch type
riscv: insn-def.h: Fix header guard

Yao Zi (16):
riscv: dts: binman.dtsi: Drop filename property for proper U-Boot
riscv: Access gd with inline assembly when building with LTO or Clang
riscv: lib: Split out support for T-Head cache management operations
configs: th1520_lpi4a: Add UART clock frequency
riscv: cpu: Add TH1520 CPU support
ram: thead: Add initial DDR controller support for TH1520
riscv: dts: th1520: Preserve necessary devices for SPL
riscv: dts: lichee-module-4a: Preserve memory node for SPL
riscv: dts: th1520: Add DRAM controller
riscv: dts: th1520: Add binman configuration
board: thead: licheepi4a: Enable SPL support
doc: thead: lpi4a: Update documentation
riscv: cpu: th1520: Initialize IOPMPs in SPL
clk: thead: Port clock controller driver of TH1520 SoC
riscv: cpu: th1520: Select clock driver
riscv: dts: th1520: Complete clock tree

 arch/riscv/Kconfig                                 |    9 +
 arch/riscv/cpu/cpu.c                               |    6 +
 arch/riscv/cpu/cv1800b/Kconfig                     |    1 +
 arch/riscv/cpu/cv1800b/Makefile                    |    1 -
 arch/riscv/cpu/th1520/Kconfig                      |   22 +
 arch/riscv/cpu/th1520/Makefile                     |    8 +
 arch/riscv/cpu/th1520/cache.c                      |   32 +
 arch/riscv/cpu/th1520/cpu.c                        |   21 +
 arch/riscv/cpu/th1520/dram.c                       |   21 +
 arch/riscv/cpu/th1520/spl.c                        |   96 ++
 arch/riscv/dts/binman.dtsi                         |   15 +-
 arch/riscv/dts/jh7110-common-u-boot.dtsi           |    1 -
 arch/riscv/dts/jh7110-u-boot.dtsi                  |   73 +-
 arch/riscv/dts/th1520-lichee-module-4a.dtsi        |    9 +-
 arch/riscv/dts/th1520-lichee-pi-4a.dts             |    1 +
 arch/riscv/dts/th1520.dtsi                         |   91 +-
 arch/riscv/dts/thead-th1520-binman.dtsi            |   55 ++
 arch/riscv/include/asm/arch-th1520/cpu.h           |    9 +
 arch/riscv/include/asm/arch-th1520/iopmp.h         |   42 +
 arch/riscv/include/asm/arch-th1520/spl.h           |   10 +
 arch/riscv/include/asm/global_data.h               |   19 +
 arch/riscv/include/asm/insn-def.h                  |    6 +-
 arch/riscv/include/asm/u-boot.h                    |    4 +
 arch/riscv/lib/Makefile                            |    1 +
 arch/riscv/lib/bootm.c                             |    4 +
 .../riscv/{cpu/cv1800b/cache.c => lib/thead_cmo.c} |    0
 board/thead/th1520_lpi4a/Kconfig                   |    5 +-
 board/thead/th1520_lpi4a/Makefile                  |    1 +
 board/thead/th1520_lpi4a/spl.c                     |   48 +
 boot/image.c                                       |    3 +-
 cmd/booti.c                                        |    7 +-
 common/board_r.c                                   |    4 +-
 common/init/board_init.c                           |    7 +-
 configs/th1520_lpi4a_defconfig                     |   18 +
 doc/board/thead/lpi4a.rst                          |   58 +-
 drivers/clk/Kconfig                                |    1 +
 drivers/clk/Makefile                               |    1 +
 drivers/clk/thead/Kconfig                          |   19 +
 drivers/clk/thead/Makefile                         |    5 +
 drivers/clk/thead/clk-th1520-ap.c                  | 1031 ++++++++++++++++++++
 drivers/ram/Kconfig                                |    1 +
 drivers/ram/Makefile                               |    4 +
 drivers/ram/thead/Kconfig                          |    5 +
 drivers/ram/thead/Makefile                         |    1 +
 drivers/ram/thead/th1520_ddr.c                     |  787 +++++++++++++++
 include/configs/starfive-visionfive2.h             |    2 +
 include/configs/th1520_lpi4a.h                     |    1 +
 include/image.h                                    |    3 +-
 48 files changed, 2459 insertions(+), 110 deletions(-)
 create mode 100644 arch/riscv/cpu/th1520/Kconfig
 create mode 100644 arch/riscv/cpu/th1520/Makefile
 create mode 100644 arch/riscv/cpu/th1520/cache.c
 create mode 100644 arch/riscv/cpu/th1520/cpu.c
 create mode 100644 arch/riscv/cpu/th1520/dram.c
 create mode 100644 arch/riscv/cpu/th1520/spl.c
 create mode 100644 arch/riscv/dts/thead-th1520-binman.dtsi
 create mode 100644 arch/riscv/include/asm/arch-th1520/cpu.h
 create mode 100644 arch/riscv/include/asm/arch-th1520/iopmp.h
 create mode 100644 arch/riscv/include/asm/arch-th1520/spl.h
 rename arch/riscv/{cpu/cv1800b/cache.c => lib/thead_cmo.c} (100%)
 create mode 100644 board/thead/th1520_lpi4a/spl.c
 create mode 100644 drivers/clk/thead/Kconfig
 create mode 100644 drivers/clk/thead/Makefile
 create mode 100644 drivers/clk/thead/clk-th1520-ap.c
 create mode 100644 drivers/ram/thead/Kconfig
 create mode 100644 drivers/ram/thead/Makefile
 create mode 100644 drivers/ram/thead/th1520_ddr.c

Best regards,
Leo

#2 lore raw
Quoted 6 lines · Tom Rini
Quoted 4 lines · Leo Liang

The following changes since commit a3e09b24ffd4429909604f1b28455b44306edbaa:

Merge tag 'mmc-2025-05-20' of https://source.denx.de/u-boot/custodians/u-boot-mmc (2025-05-20 08:35:31 -0600)

Quoted 7 lines
Quoted 5 lines

are available in the Git repository at:

https://source.denx.de/u-boot/custodians/u-boot-riscv.git

[...]

Merged into u-boot/master, thanks!

This PR seems to have made my CI blow up, and I'm not entirely sure if that's something intentional or not. I've not yet bisected, but since the error is "Image arch not compatible with host arch", I can only imagine the patch in question is:

| Subject: [PATCH v2 1/3] riscv: image: Add new image type for RV64
| Date: Fri,  4 Apr 2025 14:48:55 +0000	[thread overview]
| Message-ID: <[email protected]> (raw)
| In-Reply-To: <[email protected]>
| 
| Similar to ARM and X86, introduce a new image type which allows u-boot
| to distinguish between images built for 32-bit vs 64-bit Risc-V CPUs.
| 
| Signed-off-by: Mayuresh Chitale <[email protected]>
| Reviewed-by: Maxim Moskalets <[email protected]>
| ---
|  boot/image.c    | 3 ++-
|  include/image.h | 3 ++-
|  2 files changed, 4 insertions(+), 2 deletions(-)
| 
| diff --git a/boot/image.c b/boot/image.c
| index 139c5bd035a..45299a7dc33 100644
| --- a/boot/image.c
| +++ b/boot/image.c
| @@ -92,7 +92,8 @@ static const table_entry_t uimage_arch[] = {
|  	{	IH_ARCH_ARC,		"arc",		"ARC",		},
|  	{	IH_ARCH_X86_64,		"x86_64",	"AMD x86_64",	},
|  	{	IH_ARCH_XTENSA,		"xtensa",	"Xtensa",	},
| -	{	IH_ARCH_RISCV,		"riscv",	"RISC-V",	},
| +	{	IH_ARCH_RISCV,		"riscv",	"RISC-V 32 Bit",},
| +	{	IH_ARCH_RISCV64,	"riscv64",	"RISC-V 64 Bit",},
|  	{	-1,			"",		"",		},
|  };
|  
| diff --git a/include/image.h b/include/image.h
| index 07912606f33..411bfcd0877 100644
| --- a/include/image.h
| +++ b/include/image.h
| @@ -138,7 +138,8 @@ enum {
|  	IH_ARCH_ARC,			/* Synopsys DesignWare ARC */
|  	IH_ARCH_X86_64,			/* AMD x86_64, Intel and Via */
|  	IH_ARCH_XTENSA,			/* Xtensa	*/
| -	IH_ARCH_RISCV,			/* RISC-V */
| +	IH_ARCH_RISCV,			/* RISC-V 32 bit*/
| +	IH_ARCH_RISCV64,		/* RISC-V 64 bit*/
|  
|  	IH_ARCH_COUNT,
|  };
| -- 
| 2.43.0
| 

since it is changing the existing "riscv" image type to be the 32-bit image and requiring the new entry for 64-bit. My CI job uses the system mkimage to create the image that U-Boot is loading, so it doesn't know about the new define etc. Maybe it's not considered a problem if a new U-Boot cannot boot an old image, but the comment above the enum reads:

|/*
| * CPU Architecture Codes (supported by Linux)
| *
| * The following are exposed to uImage header.
| * New IDs *MUST* be appended at the end of the list and *NEVER*
| * inserted for backward compatibility.
| */

The overwhelming majority of existing supported boards in U-Boot are 64-bit platforms, and the 64-bit platforms are the ones that have been supported for longer, so my thought would be that the compatibility of 64-bit platforms should be prioritised over 32-bit? Or even add explicit 32-bit and 64-bit entries and the existing one is a catch-all for compatibility reasons?

Hopefully my lack of bisection isn't causing me to blame something incorrect, but I'll go try to replicate now :)

#3 lore raw
Quoted 84 lines · Conor Dooley
Quoted 6 lines · Tom Rini
Quoted 4 lines · Leo Liang

The following changes since commit a3e09b24ffd4429909604f1b28455b44306edbaa:

Merge tag 'mmc-2025-05-20' of https://source.denx.de/u-boot/custodians/u-boot-mmc (2025-05-20 08:35:31 -0600)

Quoted 7 lines
Quoted 5 lines

are available in the Git repository at:

https://source.denx.de/u-boot/custodians/u-boot-riscv.git

[...]

Merged into u-boot/master, thanks!

This PR seems to have made my CI blow up, and I'm not entirely sure if that's something intentional or not. I've not yet bisected, but since the error is "Image arch not compatible with host arch", I can only imagine the patch in question is:

| Subject: [PATCH v2 1/3] riscv: image: Add new image type for RV64
| Date: Fri,  4 Apr 2025 14:48:55 +0000	[thread overview]
| Message-ID: <[email protected]> (raw)
| In-Reply-To: <[email protected]>
| 
| Similar to ARM and X86, introduce a new image type which allows u-boot
| to distinguish between images built for 32-bit vs 64-bit Risc-V CPUs.
| 
| Signed-off-by: Mayuresh Chitale <[email protected]>
| Reviewed-by: Maxim Moskalets <[email protected]>
| ---
|  boot/image.c    | 3 ++-
|  include/image.h | 3 ++-
|  2 files changed, 4 insertions(+), 2 deletions(-)
| 
| diff --git a/boot/image.c b/boot/image.c
| index 139c5bd035a..45299a7dc33 100644
| --- a/boot/image.c
| +++ b/boot/image.c
| @@ -92,7 +92,8 @@ static const table_entry_t uimage_arch[] = {
|  	{	IH_ARCH_ARC,		"arc",		"ARC",		},
|  	{	IH_ARCH_X86_64,		"x86_64",	"AMD x86_64",	},
|  	{	IH_ARCH_XTENSA,		"xtensa",	"Xtensa",	},
| -	{	IH_ARCH_RISCV,		"riscv",	"RISC-V",	},
| +	{	IH_ARCH_RISCV,		"riscv",	"RISC-V 32 Bit",},
| +	{	IH_ARCH_RISCV64,	"riscv64",	"RISC-V 64 Bit",},
|  	{	-1,			"",		"",		},
|  };
|  
| diff --git a/include/image.h b/include/image.h
| index 07912606f33..411bfcd0877 100644
| --- a/include/image.h
| +++ b/include/image.h
| @@ -138,7 +138,8 @@ enum {
|  	IH_ARCH_ARC,			/* Synopsys DesignWare ARC */
|  	IH_ARCH_X86_64,			/* AMD x86_64, Intel and Via */
|  	IH_ARCH_XTENSA,			/* Xtensa	*/
| -	IH_ARCH_RISCV,			/* RISC-V */
| +	IH_ARCH_RISCV,			/* RISC-V 32 bit*/
| +	IH_ARCH_RISCV64,		/* RISC-V 64 bit*/
|  
|  	IH_ARCH_COUNT,
|  };
| -- 
| 2.43.0
| 

since it is changing the existing "riscv" image type to be the 32-bit image and requiring the new entry for 64-bit. My CI job uses the system mkimage to create the image that U-Boot is loading, so it doesn't know about the new define etc. Maybe it's not considered a problem if a new U-Boot cannot boot an old image, but the comment above the enum reads:

|/*
| * CPU Architecture Codes (supported by Linux)
| *
| * The following are exposed to uImage header.
| * New IDs *MUST* be appended at the end of the list and *NEVER*
| * inserted for backward compatibility.
| */

The overwhelming majority of existing supported boards in U-Boot are 64-bit platforms, and the 64-bit platforms are the ones that have been supported for longer, so my thought would be that the compatibility of 64-bit platforms should be prioritised over 32-bit? Or even add explicit 32-bit and 64-bit entries and the existing one is a catch-all for compatibility reasons?

Quoted 2 lines

Hopefully my lack of bisection isn't causing me to blame something incorrect, but I'll go try to replicate now :)

Ugh. No, this is a problem that needs to be fixed and I'm sorry I missed it during reviews. We need to keep the list compatible.

Signature · 1 line
Tom
author
#4 lore raw
Quoted 85 lines · Tom Rini
Quoted 84 lines · Conor Dooley
Quoted 6 lines · Tom Rini
Quoted 4 lines · Leo Liang

The following changes since commit a3e09b24ffd4429909604f1b28455b44306edbaa:

Merge tag 'mmc-2025-05-20' of https://source.denx.de/u-boot/custodians/u-boot-mmc (2025-05-20 08:35:31 -0600)

Quoted 7 lines
Quoted 5 lines

are available in the Git repository at:

https://source.denx.de/u-boot/custodians/u-boot-riscv.git

[...]

Merged into u-boot/master, thanks!

This PR seems to have made my CI blow up, and I'm not entirely sure if that's something intentional or not. I've not yet bisected, but since the error is "Image arch not compatible with host arch", I can only imagine the patch in question is:

| Subject: [PATCH v2 1/3] riscv: image: Add new image type for RV64
| Date: Fri,  4 Apr 2025 14:48:55 +0000	[thread overview]
| Message-ID: <[email protected]> (raw)
| In-Reply-To: <[email protected]>
| 
| Similar to ARM and X86, introduce a new image type which allows u-boot
| to distinguish between images built for 32-bit vs 64-bit Risc-V CPUs.
| 
| Signed-off-by: Mayuresh Chitale <[email protected]>
| Reviewed-by: Maxim Moskalets <[email protected]>
| ---
|  boot/image.c    | 3 ++-
|  include/image.h | 3 ++-
|  2 files changed, 4 insertions(+), 2 deletions(-)
| 
| diff --git a/boot/image.c b/boot/image.c
| index 139c5bd035a..45299a7dc33 100644
| --- a/boot/image.c
| +++ b/boot/image.c
| @@ -92,7 +92,8 @@ static const table_entry_t uimage_arch[] = {
|  	{	IH_ARCH_ARC,		"arc",		"ARC",		},
|  	{	IH_ARCH_X86_64,		"x86_64",	"AMD x86_64",	},
|  	{	IH_ARCH_XTENSA,		"xtensa",	"Xtensa",	},
| -	{	IH_ARCH_RISCV,		"riscv",	"RISC-V",	},
| +	{	IH_ARCH_RISCV,		"riscv",	"RISC-V 32 Bit",},
| +	{	IH_ARCH_RISCV64,	"riscv64",	"RISC-V 64 Bit",},
|  	{	-1,			"",		"",		},
|  };
|  
| diff --git a/include/image.h b/include/image.h
| index 07912606f33..411bfcd0877 100644
| --- a/include/image.h
| +++ b/include/image.h
| @@ -138,7 +138,8 @@ enum {
|  	IH_ARCH_ARC,			/* Synopsys DesignWare ARC */
|  	IH_ARCH_X86_64,			/* AMD x86_64, Intel and Via */
|  	IH_ARCH_XTENSA,			/* Xtensa	*/
| -	IH_ARCH_RISCV,			/* RISC-V */
| +	IH_ARCH_RISCV,			/* RISC-V 32 bit*/
| +	IH_ARCH_RISCV64,		/* RISC-V 64 bit*/
|  
|  	IH_ARCH_COUNT,
|  };
| -- 
| 2.43.0
| 

since it is changing the existing "riscv" image type to be the 32-bit image and requiring the new entry for 64-bit. My CI job uses the system mkimage to create the image that U-Boot is loading, so it doesn't know about the new define etc. Maybe it's not considered a problem if a new U-Boot cannot boot an old image, but the comment above the enum reads:

|/*
| * CPU Architecture Codes (supported by Linux)
| *
| * The following are exposed to uImage header.
| * New IDs *MUST* be appended at the end of the list and *NEVER*
| * inserted for backward compatibility.
| */

The overwhelming majority of existing supported boards in U-Boot are 64-bit platforms, and the 64-bit platforms are the ones that have been supported for longer, so my thought would be that the compatibility of 64-bit platforms should be prioritised over 32-bit? Or even add explicit 32-bit and 64-bit entries and the existing one is a catch-all for compatibility reasons?

Quoted 5 lines
Quoted 2 lines

Hopefully my lack of bisection isn't causing me to blame something incorrect, but I'll go try to replicate now :)

Ugh. No, this is a problem that needs to be fixed and I'm sorry I missed it during reviews. We need to keep the list compatible.

Hi Conor, Tom,

I am so sorry! I did not catch the compatibility issue as well. How do you think we should proceed from here?
Maybe revert the whole patchset first?
And then send a fix up patch after?

Best regards,
Leo

Quoted 3 lines
Signature · 2 lines
-- 
Tom
#5 lore raw
Quoted 92 lines · Leo Liang
Quoted 85 lines · Tom Rini
Quoted 84 lines · Conor Dooley
Quoted 6 lines · Tom Rini
Quoted 4 lines · Leo Liang

The following changes since commit a3e09b24ffd4429909604f1b28455b44306edbaa:

Merge tag 'mmc-2025-05-20' of https://source.denx.de/u-boot/custodians/u-boot-mmc (2025-05-20 08:35:31 -0600)

Quoted 7 lines
Quoted 5 lines

are available in the Git repository at:

https://source.denx.de/u-boot/custodians/u-boot-riscv.git

[...]

Merged into u-boot/master, thanks!

This PR seems to have made my CI blow up, and I'm not entirely sure if that's something intentional or not. I've not yet bisected, but since the error is "Image arch not compatible with host arch", I can only imagine the patch in question is:

| Subject: [PATCH v2 1/3] riscv: image: Add new image type for RV64
| Date: Fri,  4 Apr 2025 14:48:55 +0000	[thread overview]
| Message-ID: <[email protected]> (raw)
| In-Reply-To: <[email protected]>
| 
| Similar to ARM and X86, introduce a new image type which allows u-boot
| to distinguish between images built for 32-bit vs 64-bit Risc-V CPUs.
| 
| Signed-off-by: Mayuresh Chitale <[email protected]>
| Reviewed-by: Maxim Moskalets <[email protected]>
| ---
|  boot/image.c    | 3 ++-
|  include/image.h | 3 ++-
|  2 files changed, 4 insertions(+), 2 deletions(-)
| 
| diff --git a/boot/image.c b/boot/image.c
| index 139c5bd035a..45299a7dc33 100644
| --- a/boot/image.c
| +++ b/boot/image.c
| @@ -92,7 +92,8 @@ static const table_entry_t uimage_arch[] = {
|  	{	IH_ARCH_ARC,		"arc",		"ARC",		},
|  	{	IH_ARCH_X86_64,		"x86_64",	"AMD x86_64",	},
|  	{	IH_ARCH_XTENSA,		"xtensa",	"Xtensa",	},
| -	{	IH_ARCH_RISCV,		"riscv",	"RISC-V",	},
| +	{	IH_ARCH_RISCV,		"riscv",	"RISC-V 32 Bit",},
| +	{	IH_ARCH_RISCV64,	"riscv64",	"RISC-V 64 Bit",},
|  	{	-1,			"",		"",		},
|  };
|  
| diff --git a/include/image.h b/include/image.h
| index 07912606f33..411bfcd0877 100644
| --- a/include/image.h
| +++ b/include/image.h
| @@ -138,7 +138,8 @@ enum {
|  	IH_ARCH_ARC,			/* Synopsys DesignWare ARC */
|  	IH_ARCH_X86_64,			/* AMD x86_64, Intel and Via */
|  	IH_ARCH_XTENSA,			/* Xtensa	*/
| -	IH_ARCH_RISCV,			/* RISC-V */
| +	IH_ARCH_RISCV,			/* RISC-V 32 bit*/
| +	IH_ARCH_RISCV64,		/* RISC-V 64 bit*/
|  
|  	IH_ARCH_COUNT,
|  };
| -- 
| 2.43.0
| 

since it is changing the existing "riscv" image type to be the 32-bit image and requiring the new entry for 64-bit. My CI job uses the system mkimage to create the image that U-Boot is loading, so it doesn't know about the new define etc. Maybe it's not considered a problem if a new U-Boot cannot boot an old image, but the comment above the enum reads:

|/*
| * CPU Architecture Codes (supported by Linux)
| *
| * The following are exposed to uImage header.
| * New IDs *MUST* be appended at the end of the list and *NEVER*
| * inserted for backward compatibility.
| */

The overwhelming majority of existing supported boards in U-Boot are 64-bit platforms, and the 64-bit platforms are the ones that have been supported for longer, so my thought would be that the compatibility of 64-bit platforms should be prioritised over 32-bit? Or even add explicit 32-bit and 64-bit entries and the existing one is a catch-all for compatibility reasons?

Quoted 5 lines
Quoted 2 lines

Hopefully my lack of bisection isn't causing me to blame something incorrect, but I'll go try to replicate now :)

Ugh. No, this is a problem that needs to be fixed and I'm sorry I missed it during reviews. We need to keep the list compatible.

Quoted 6 lines

Hi Conor, Tom,

I am so sorry! I did not catch the compatibility issue as well. How do you think we should proceed from here?
Maybe revert the whole patchset first?
And then send a fix up patch after?

Can we just do a patch to fix things as they stand now?

Signature · 1 line
Tom
#6 lore raw
In reply to Conor Dooley
Quoted 77 lines · Conor Dooley
Quoted 6 lines · Tom Rini
Quoted 4 lines · Leo Liang

The following changes since commit a3e09b24ffd4429909604f1b28455b44306edbaa:

Merge tag 'mmc-2025-05-20' of https://source.denx.de/u-boot/custodians/u-boot-mmc (2025-05-20 08:35:31 -0600)

Quoted 7 lines
Quoted 5 lines

are available in the Git repository at:

https://source.denx.de/u-boot/custodians/u-boot-riscv.git

[...]

Merged into u-boot/master, thanks!

This PR seems to have made my CI blow up, and I'm not entirely sure if that's something intentional or not. I've not yet bisected, but since the error is "Image arch not compatible with host arch", I can only imagine the patch in question is:

| Subject: [PATCH v2 1/3] riscv: image: Add new image type for RV64
| Date: Fri,  4 Apr 2025 14:48:55 +0000	[thread overview]
| Message-ID: <[email protected]> (raw)
| In-Reply-To: <[email protected]>
| 
| Similar to ARM and X86, introduce a new image type which allows u-boot
| to distinguish between images built for 32-bit vs 64-bit Risc-V CPUs.
| 
| Signed-off-by: Mayuresh Chitale <[email protected]>
| Reviewed-by: Maxim Moskalets <[email protected]>
| ---
|  boot/image.c    | 3 ++-
|  include/image.h | 3 ++-
|  2 files changed, 4 insertions(+), 2 deletions(-)
| 
| diff --git a/boot/image.c b/boot/image.c
| index 139c5bd035a..45299a7dc33 100644
| --- a/boot/image.c
| +++ b/boot/image.c
| @@ -92,7 +92,8 @@ static const table_entry_t uimage_arch[] = {
|  	{	IH_ARCH_ARC,		"arc",		"ARC",		},
|  	{	IH_ARCH_X86_64,		"x86_64",	"AMD x86_64",	},
|  	{	IH_ARCH_XTENSA,		"xtensa",	"Xtensa",	},
| -	{	IH_ARCH_RISCV,		"riscv",	"RISC-V",	},
| +	{	IH_ARCH_RISCV,		"riscv",	"RISC-V 32 Bit",},
| +	{	IH_ARCH_RISCV64,	"riscv64",	"RISC-V 64 Bit",},
|  	{	-1,			"",		"",		},
|  };
|  
| diff --git a/include/image.h b/include/image.h
| index 07912606f33..411bfcd0877 100644
| --- a/include/image.h
| +++ b/include/image.h
| @@ -138,7 +138,8 @@ enum {
|  	IH_ARCH_ARC,			/* Synopsys DesignWare ARC */
|  	IH_ARCH_X86_64,			/* AMD x86_64, Intel and Via */
|  	IH_ARCH_XTENSA,			/* Xtensa	*/
| -	IH_ARCH_RISCV,			/* RISC-V */
| +	IH_ARCH_RISCV,			/* RISC-V 32 bit*/
| +	IH_ARCH_RISCV64,		/* RISC-V 64 bit*/
|  
|  	IH_ARCH_COUNT,
|  };
| -- 
| 2.43.0
| 

since it is changing the existing "riscv" image type to be the 32-bit image and requiring the new entry for 64-bit. My CI job uses the system mkimage to create the image that U-Boot is loading, so it doesn't know about the new define etc. Maybe it's not considered a problem if a new U-Boot cannot boot an old image, but the comment above the enum reads:

|/*
| * CPU Architecture Codes (supported by Linux)
| *
| * The following are exposed to uImage header.
| * New IDs *MUST* be appended at the end of the list and *NEVER*
| * inserted for backward compatibility.
| */
Quoted 6 lines

The overwhelming majority of existing supported boards in U-Boot are 64-bit platforms, and the 64-bit platforms are the ones that have been supported for longer, so my thought would be that the compatibility of 64-bit platforms should be prioritised over 32-bit? Or even add explicit 32-bit and 64-bit entries and the existing one is a catch-all for compatibility reasons?

I've mentioned entries with bitwidth explicitly specified in my previous reply (and there hasn't been any response).

Quoted 7 lines

I'll consider IH_ARCH_RISCV32 a better idea, instead of implying 32bit when no suffix attached. We (and the Linux kernel) mix 32-bit and 64-bit variants of RISC-V together, thus it's hard to tell the exact bitwidth of "IH_ARCH_RISCV" without inspecting the code around. To me, it sounds more like "RISC-V, but no bitwidth specified".

It will be nice if we could avoid this kind of ambiguity.

(referring my own reply[1])

I'll second explicit 32-bit and 64-bit entries, and keeping IH_ARCH_RISCV for compatibility consideration.

Quoted 3 lines

Hopefully my lack of bisection isn't causing me to blame something incorrect, but I'll go try to replicate now :)

Regards,
Yao Zi

[1]: https://lore.kernel.org/u-boot/[email protected]/

#7 lore raw
Quoted 94 lines · Yao Zi
Quoted 77 lines · Conor Dooley
Quoted 6 lines · Tom Rini
Quoted 4 lines · Leo Liang

The following changes since commit a3e09b24ffd4429909604f1b28455b44306edbaa:

Merge tag 'mmc-2025-05-20' of https://source.denx.de/u-boot/custodians/u-boot-mmc (2025-05-20 08:35:31 -0600)

Quoted 7 lines
Quoted 5 lines

are available in the Git repository at:

https://source.denx.de/u-boot/custodians/u-boot-riscv.git

[...]

Merged into u-boot/master, thanks!

This PR seems to have made my CI blow up, and I'm not entirely sure if that's something intentional or not. I've not yet bisected, but since the error is "Image arch not compatible with host arch", I can only imagine the patch in question is:

| Subject: [PATCH v2 1/3] riscv: image: Add new image type for RV64
| Date: Fri,  4 Apr 2025 14:48:55 +0000	[thread overview]
| Message-ID: <[email protected]> (raw)
| In-Reply-To: <[email protected]>
| 
| Similar to ARM and X86, introduce a new image type which allows u-boot
| to distinguish between images built for 32-bit vs 64-bit Risc-V CPUs.
| 
| Signed-off-by: Mayuresh Chitale <[email protected]>
| Reviewed-by: Maxim Moskalets <[email protected]>
| ---
|  boot/image.c    | 3 ++-
|  include/image.h | 3 ++-
|  2 files changed, 4 insertions(+), 2 deletions(-)
| 
| diff --git a/boot/image.c b/boot/image.c
| index 139c5bd035a..45299a7dc33 100644
| --- a/boot/image.c
| +++ b/boot/image.c
| @@ -92,7 +92,8 @@ static const table_entry_t uimage_arch[] = {
|  	{	IH_ARCH_ARC,		"arc",		"ARC",		},
|  	{	IH_ARCH_X86_64,		"x86_64",	"AMD x86_64",	},
|  	{	IH_ARCH_XTENSA,		"xtensa",	"Xtensa",	},
| -	{	IH_ARCH_RISCV,		"riscv",	"RISC-V",	},
| +	{	IH_ARCH_RISCV,		"riscv",	"RISC-V 32 Bit",},
| +	{	IH_ARCH_RISCV64,	"riscv64",	"RISC-V 64 Bit",},
|  	{	-1,			"",		"",		},
|  };
|  
| diff --git a/include/image.h b/include/image.h
| index 07912606f33..411bfcd0877 100644
| --- a/include/image.h
| +++ b/include/image.h
| @@ -138,7 +138,8 @@ enum {
|  	IH_ARCH_ARC,			/* Synopsys DesignWare ARC */
|  	IH_ARCH_X86_64,			/* AMD x86_64, Intel and Via */
|  	IH_ARCH_XTENSA,			/* Xtensa	*/
| -	IH_ARCH_RISCV,			/* RISC-V */
| +	IH_ARCH_RISCV,			/* RISC-V 32 bit*/
| +	IH_ARCH_RISCV64,		/* RISC-V 64 bit*/
|  
|  	IH_ARCH_COUNT,
|  };
| -- 
| 2.43.0
| 

since it is changing the existing "riscv" image type to be the 32-bit image and requiring the new entry for 64-bit. My CI job uses the system mkimage to create the image that U-Boot is loading, so it doesn't know about the new define etc. Maybe it's not considered a problem if a new U-Boot cannot boot an old image, but the comment above the enum reads:

|/*
| * CPU Architecture Codes (supported by Linux)
| *
| * The following are exposed to uImage header.
| * New IDs *MUST* be appended at the end of the list and *NEVER*
| * inserted for backward compatibility.
| */
Quoted 6 lines

The overwhelming majority of existing supported boards in U-Boot are 64-bit platforms, and the 64-bit platforms are the ones that have been supported for longer, so my thought would be that the compatibility of 64-bit platforms should be prioritised over 32-bit? Or even add explicit 32-bit and 64-bit entries and the existing one is a catch-all for compatibility reasons?

I've mentioned entries with bitwidth explicitly specified in my previous reply (and there hasn't been any response).

Quoted 6 lines

I'll consider IH_ARCH_RISCV32 a better idea, instead of implying 32bit when no suffix attached. We (and the Linux kernel) mix 32-bit and 64-bit variants of RISC-V together, thus it's hard to tell the exact bitwidth of "IH_ARCH_RISCV" without inspecting the code around. To me, it sounds more like "RISC-V, but no bitwidth specified".

Quoted 7 lines
Quoted 1 line

It will be nice if we could avoid this kind of ambiguity.

(referring my own reply[1])

I'll second explicit 32-bit and 64-bit entries, and keeping IH_ARCH_RISCV for compatibility consideration.

Yeah, I noticed your mail after I sent this report. I think this is the way to go that makes most sense to me.

Quoted 1 line

[1]: https://lore.kernel.org/u-boot/[email protected]/

#8 lore raw
In reply to Yao Zi
Quoted 95 lines · Yao Zi
Quoted 77 lines · Conor Dooley
Quoted 6 lines · Tom Rini
Quoted 4 lines · Leo Liang

The following changes since commit a3e09b24ffd4429909604f1b28455b44306edbaa:

Merge tag 'mmc-2025-05-20' of https://source.denx.de/u-boot/custodians/u-boot-mmc (2025-05-20 08:35:31 -0600)

Quoted 7 lines
Quoted 5 lines

are available in the Git repository at:

https://source.denx.de/u-boot/custodians/u-boot-riscv.git

[...]

Merged into u-boot/master, thanks!

This PR seems to have made my CI blow up, and I'm not entirely sure if that's something intentional or not. I've not yet bisected, but since the error is "Image arch not compatible with host arch", I can only imagine the patch in question is:

| Subject: [PATCH v2 1/3] riscv: image: Add new image type for RV64
| Date: Fri,  4 Apr 2025 14:48:55 +0000       [thread overview]
| Message-ID: <[email protected]> (raw)
| In-Reply-To: <[email protected]>
|
| Similar to ARM and X86, introduce a new image type which allows u-boot
| to distinguish between images built for 32-bit vs 64-bit Risc-V CPUs.
|
| Signed-off-by: Mayuresh Chitale <[email protected]>
| Reviewed-by: Maxim Moskalets <[email protected]>
| ---
|  boot/image.c    | 3 ++-
|  include/image.h | 3 ++-
|  2 files changed, 4 insertions(+), 2 deletions(-)
|
| diff --git a/boot/image.c b/boot/image.c
| index 139c5bd035a..45299a7dc33 100644
| --- a/boot/image.c
| +++ b/boot/image.c
| @@ -92,7 +92,8 @@ static const table_entry_t uimage_arch[] = {
|     {       IH_ARCH_ARC,            "arc",          "ARC",          },
|     {       IH_ARCH_X86_64,         "x86_64",       "AMD x86_64",   },
|     {       IH_ARCH_XTENSA,         "xtensa",       "Xtensa",       },
| -   {       IH_ARCH_RISCV,          "riscv",        "RISC-V",       },
| +   {       IH_ARCH_RISCV,          "riscv",        "RISC-V 32 Bit",},
| +   {       IH_ARCH_RISCV64,        "riscv64",      "RISC-V 64 Bit",},
|     {       -1,                     "",             "",             },
|  };
|
| diff --git a/include/image.h b/include/image.h
| index 07912606f33..411bfcd0877 100644
| --- a/include/image.h
| +++ b/include/image.h
| @@ -138,7 +138,8 @@ enum {
|     IH_ARCH_ARC,                    /* Synopsys DesignWare ARC */
|     IH_ARCH_X86_64,                 /* AMD x86_64, Intel and Via */
|     IH_ARCH_XTENSA,                 /* Xtensa       */
| -   IH_ARCH_RISCV,                  /* RISC-V */
| +   IH_ARCH_RISCV,                  /* RISC-V 32 bit*/
| +   IH_ARCH_RISCV64,                /* RISC-V 64 bit*/
|
|     IH_ARCH_COUNT,
|  };
| --
| 2.43.0
|

since it is changing the existing "riscv" image type to be the 32-bit image and requiring the new entry for 64-bit. My CI job uses the system mkimage to create the image that U-Boot is loading, so it doesn't know about the new define etc. Maybe it's not considered a problem if a new U-Boot cannot boot an old image, but the comment above the enum reads:

|/*
| * CPU Architecture Codes (supported by Linux)
| *
| * The following are exposed to uImage header.
| * New IDs *MUST* be appended at the end of the list and *NEVER*
| * inserted for backward compatibility.
| */
Quoted 6 lines

The overwhelming majority of existing supported boards in U-Boot are 64-bit platforms, and the 64-bit platforms are the ones that have been supported for longer, so my thought would be that the compatibility of 64-bit platforms should be prioritised over 32-bit? Or even add explicit 32-bit and 64-bit entries and the existing one is a catch-all for compatibility reasons?

I've mentioned entries with bitwidth explicitly specified in my previous reply (and there hasn't been any response).

Quoted 6 lines

I'll consider IH_ARCH_RISCV32 a better idea, instead of implying 32bit when no suffix attached. We (and the Linux kernel) mix 32-bit and 64-bit variants of RISC-V together, thus it's hard to tell the exact bitwidth of "IH_ARCH_RISCV" without inspecting the code around. To me, it sounds more like "RISC-V, but no bitwidth specified".

Quoted 7 lines
Quoted 1 line

It will be nice if we could avoid this kind of ambiguity.

(referring my own reply[1])

I'll second explicit 32-bit and 64-bit entries, and keeping IH_ARCH_RISCV for compatibility consideration.

Are you suggesting something like this :

{ IH_ARCH_RISCV, "riscv", "RISC-V",},
{ IH_ARCH_RISCV32, "riscv32", "RISC-V 32 Bit",},
{ IH_ARCH_RISCV64, "riscv64", "RISC-V 64 Bit",},

I tried to implement it like on ARM64. However the problem is that while on ARM64 it switches to aarch32 if it encounters an IH_ARCH_ARM kernel image, there is no equivalent mechanism for Risc-V yet. Another option could be to disable this check in the bootm flow for now until a similar mechanism is implemented on Risc-V.

Quoted 8 lines
Quoted 3 lines

Hopefully my lack of bisection isn't causing me to blame something incorrect, but I'll go try to replicate now :)

Regards,
Yao Zi

[1]: https://lore.kernel.org/u-boot/[email protected]/

#9 lore raw
Quoted 93 lines · Mayuresh Chitale
Quoted 83 lines · Yao Zi
Quoted 65 lines · Conor Dooley
Quoted 1 line · Tom Rini

On Wed, 21 May 2025 17:50:03 +0800, Leo Liang wrote:

This PR seems to have made my CI blow up, and I'm not entirely sure if that's something intentional or not. I've not yet bisected, but since the error is "Image arch not compatible with host arch", I can only imagine the patch in question is:

| Subject: [PATCH v2 1/3] riscv: image: Add new image type for RV64
| Date: Fri,  4 Apr 2025 14:48:55 +0000       [thread overview]
| Message-ID: <[email protected]> (raw)
| In-Reply-To: <[email protected]>
|
| Similar to ARM and X86, introduce a new image type which allows u-boot
| to distinguish between images built for 32-bit vs 64-bit Risc-V CPUs.
|
| Signed-off-by: Mayuresh Chitale <[email protected]>
| Reviewed-by: Maxim Moskalets <[email protected]>
| ---
|  boot/image.c    | 3 ++-
|  include/image.h | 3 ++-
|  2 files changed, 4 insertions(+), 2 deletions(-)
|
| diff --git a/boot/image.c b/boot/image.c
| index 139c5bd035a..45299a7dc33 100644
| --- a/boot/image.c
| +++ b/boot/image.c
| @@ -92,7 +92,8 @@ static const table_entry_t uimage_arch[] = {
|     {       IH_ARCH_ARC,            "arc",          "ARC",          },
|     {       IH_ARCH_X86_64,         "x86_64",       "AMD x86_64",   },
|     {       IH_ARCH_XTENSA,         "xtensa",       "Xtensa",       },
| -   {       IH_ARCH_RISCV,          "riscv",        "RISC-V",       },
| +   {       IH_ARCH_RISCV,          "riscv",        "RISC-V 32 Bit",},
| +   {       IH_ARCH_RISCV64,        "riscv64",      "RISC-V 64 Bit",},
|     {       -1,                     "",             "",             },
|  };
|
| diff --git a/include/image.h b/include/image.h
| index 07912606f33..411bfcd0877 100644
| --- a/include/image.h
| +++ b/include/image.h
| @@ -138,7 +138,8 @@ enum {
|     IH_ARCH_ARC,                    /* Synopsys DesignWare ARC */
|     IH_ARCH_X86_64,                 /* AMD x86_64, Intel and Via */
|     IH_ARCH_XTENSA,                 /* Xtensa       */
| -   IH_ARCH_RISCV,                  /* RISC-V */
| +   IH_ARCH_RISCV,                  /* RISC-V 32 bit*/
| +   IH_ARCH_RISCV64,                /* RISC-V 64 bit*/
|
|     IH_ARCH_COUNT,
|  };
| --
| 2.43.0
|

since it is changing the existing "riscv" image type to be the 32-bit image and requiring the new entry for 64-bit. My CI job uses the system mkimage to create the image that U-Boot is loading, so it doesn't know about the new define etc. Maybe it's not considered a problem if a new U-Boot cannot boot an old image, but the comment above the enum reads:

|/*
| * CPU Architecture Codes (supported by Linux)
| *
| * The following are exposed to uImage header.
| * New IDs *MUST* be appended at the end of the list and *NEVER*
| * inserted for backward compatibility.
| */
Quoted 6 lines

The overwhelming majority of existing supported boards in U-Boot are 64-bit platforms, and the 64-bit platforms are the ones that have been supported for longer, so my thought would be that the compatibility of 64-bit platforms should be prioritised over 32-bit? Or even add explicit 32-bit and 64-bit entries and the existing one is a catch-all for compatibility reasons?

I've mentioned entries with bitwidth explicitly specified in my previous reply (and there hasn't been any response).

Quoted 6 lines

I'll consider IH_ARCH_RISCV32 a better idea, instead of implying 32bit when no suffix attached. We (and the Linux kernel) mix 32-bit and 64-bit variants of RISC-V together, thus it's hard to tell the exact bitwidth of "IH_ARCH_RISCV" without inspecting the code around. To me, it sounds more like "RISC-V, but no bitwidth specified".

Quoted 7 lines
Quoted 1 line

It will be nice if we could avoid this kind of ambiguity.

(referring my own reply[1])

I'll second explicit 32-bit and 64-bit entries, and keeping IH_ARCH_RISCV for compatibility consideration.

Are you suggesting something like this :

Quoted 7 lines

{ IH_ARCH_RISCV, "riscv", "RISC-V",},
{ IH_ARCH_RISCV32, "riscv32", "RISC-V 32 Bit",},
{ IH_ARCH_RISCV64, "riscv64", "RISC-V 64 Bit",},

I tried to implement it like on ARM64. However the problem is that while on ARM64 it switches to aarch32 if it encounters an IH_ARCH_ARM kernel image, there is no equivalent mechanism for Risc-V yet.

But we don't even want that, since the current behaviour on a 64-bit system is not to do anything 32-bit related, right? My 64-bit images created with my system mkimage use IH_ARCH_RISCV.

Quoted 3 lines

Another
option could be to disable this check in the bootm flow for now until a similar mechanism is implemented on Risc-V.

Why not just allow IH_ARCH_RISCV to retain the current "dumb" behaviour permanently, and only implement the strict checking when the explicit width types are detected?

#10 lore raw
Quoted 106 lines · Conor Dooley
Quoted 93 lines · Mayuresh Chitale
Quoted 83 lines · Yao Zi
Quoted 65 lines · Conor Dooley
Quoted 1 line · Tom Rini

On Wed, 21 May 2025 17:50:03 +0800, Leo Liang wrote:

This PR seems to have made my CI blow up, and I'm not entirely sure if that's something intentional or not. I've not yet bisected, but since the error is "Image arch not compatible with host arch", I can only imagine the patch in question is:

| Subject: [PATCH v2 1/3] riscv: image: Add new image type for RV64
| Date: Fri,  4 Apr 2025 14:48:55 +0000       [thread overview]
| Message-ID: <[email protected]> (raw)
| In-Reply-To: <[email protected]>
|
| Similar to ARM and X86, introduce a new image type which allows u-boot
| to distinguish between images built for 32-bit vs 64-bit Risc-V CPUs.
|
| Signed-off-by: Mayuresh Chitale <[email protected]>
| Reviewed-by: Maxim Moskalets <[email protected]>
| ---
|  boot/image.c    | 3 ++-
|  include/image.h | 3 ++-
|  2 files changed, 4 insertions(+), 2 deletions(-)
|
| diff --git a/boot/image.c b/boot/image.c
| index 139c5bd035a..45299a7dc33 100644
| --- a/boot/image.c
| +++ b/boot/image.c
| @@ -92,7 +92,8 @@ static const table_entry_t uimage_arch[] = {
|     {       IH_ARCH_ARC,            "arc",          "ARC",          },
|     {       IH_ARCH_X86_64,         "x86_64",       "AMD x86_64",   },
|     {       IH_ARCH_XTENSA,         "xtensa",       "Xtensa",       },
| -   {       IH_ARCH_RISCV,          "riscv",        "RISC-V",       },
| +   {       IH_ARCH_RISCV,          "riscv",        "RISC-V 32 Bit",},
| +   {       IH_ARCH_RISCV64,        "riscv64",      "RISC-V 64 Bit",},
|     {       -1,                     "",             "",             },
|  };
|
| diff --git a/include/image.h b/include/image.h
| index 07912606f33..411bfcd0877 100644
| --- a/include/image.h
| +++ b/include/image.h
| @@ -138,7 +138,8 @@ enum {
|     IH_ARCH_ARC,                    /* Synopsys DesignWare ARC */
|     IH_ARCH_X86_64,                 /* AMD x86_64, Intel and Via */
|     IH_ARCH_XTENSA,                 /* Xtensa       */
| -   IH_ARCH_RISCV,                  /* RISC-V */
| +   IH_ARCH_RISCV,                  /* RISC-V 32 bit*/
| +   IH_ARCH_RISCV64,                /* RISC-V 64 bit*/
|
|     IH_ARCH_COUNT,
|  };
| --
| 2.43.0
|

since it is changing the existing "riscv" image type to be the 32-bit image and requiring the new entry for 64-bit. My CI job uses the system mkimage to create the image that U-Boot is loading, so it doesn't know about the new define etc. Maybe it's not considered a problem if a new U-Boot cannot boot an old image, but the comment above the enum reads:

|/*
| * CPU Architecture Codes (supported by Linux)
| *
| * The following are exposed to uImage header.
| * New IDs *MUST* be appended at the end of the list and *NEVER*
| * inserted for backward compatibility.
| */
Quoted 6 lines

The overwhelming majority of existing supported boards in U-Boot are 64-bit platforms, and the 64-bit platforms are the ones that have been supported for longer, so my thought would be that the compatibility of 64-bit platforms should be prioritised over 32-bit? Or even add explicit 32-bit and 64-bit entries and the existing one is a catch-all for compatibility reasons?

I've mentioned entries with bitwidth explicitly specified in my previous reply (and there hasn't been any response).

Quoted 6 lines

I'll consider IH_ARCH_RISCV32 a better idea, instead of implying 32bit when no suffix attached. We (and the Linux kernel) mix 32-bit and 64-bit variants of RISC-V together, thus it's hard to tell the exact bitwidth of "IH_ARCH_RISCV" without inspecting the code around. To me, it sounds more like "RISC-V, but no bitwidth specified".

Quoted 7 lines
Quoted 1 line

It will be nice if we could avoid this kind of ambiguity.

(referring my own reply[1])

I'll second explicit 32-bit and 64-bit entries, and keeping IH_ARCH_RISCV for compatibility consideration.

Are you suggesting something like this :

Quoted 7 lines

{ IH_ARCH_RISCV, "riscv", "RISC-V",},
{ IH_ARCH_RISCV32, "riscv32", "RISC-V 32 Bit",},
{ IH_ARCH_RISCV64, "riscv64", "RISC-V 64 Bit",},

I tried to implement it like on ARM64. However the problem is that while on ARM64 it switches to aarch32 if it encounters an IH_ARCH_ARM kernel image, there is no equivalent mechanism for Risc-V yet.

But we don't even want that, since the current behaviour on a 64-bit system is not to do anything 32-bit related, right? My 64-bit images created with my system mkimage use IH_ARCH_RISCV.

Quoted 7 lines
Quoted 3 lines

Another
option could be to disable this check in the bootm flow for now until a similar mechanism is implemented on Risc-V.

Why not just allow IH_ARCH_RISCV to retain the current "dumb" behaviour permanently, and only implement the strict checking when the explicit width types are detected?

This seems most reasonable to me for the current situation.

Signature · 1 line
Tom
#11 lore raw
Quoted 112 lines · Tom Rini
Quoted 110 lines · Conor Dooley
Quoted 93 lines · Mayuresh Chitale
Quoted 83 lines · Yao Zi
Quoted 65 lines · Conor Dooley
Quoted 1 line · Tom Rini

On Wed, 21 May 2025 17:50:03 +0800, Leo Liang wrote:

This PR seems to have made my CI blow up, and I'm not entirely sure if that's something intentional or not. I've not yet bisected, but since the error is "Image arch not compatible with host arch", I can only imagine the patch in question is:

| Subject: [PATCH v2 1/3] riscv: image: Add new image type for RV64
| Date: Fri,  4 Apr 2025 14:48:55 +0000       [thread overview]
| Message-ID: <[email protected]> (raw)
| In-Reply-To: <[email protected]>
|
| Similar to ARM and X86, introduce a new image type which allows u-boot
| to distinguish between images built for 32-bit vs 64-bit Risc-V CPUs.
|
| Signed-off-by: Mayuresh Chitale <[email protected]>
| Reviewed-by: Maxim Moskalets <[email protected]>
| ---
|  boot/image.c    | 3 ++-
|  include/image.h | 3 ++-
|  2 files changed, 4 insertions(+), 2 deletions(-)
|
| diff --git a/boot/image.c b/boot/image.c
| index 139c5bd035a..45299a7dc33 100644
| --- a/boot/image.c
| +++ b/boot/image.c
| @@ -92,7 +92,8 @@ static const table_entry_t uimage_arch[] = {
|     {       IH_ARCH_ARC,            "arc",          "ARC",          },
|     {       IH_ARCH_X86_64,         "x86_64",       "AMD x86_64",   },
|     {       IH_ARCH_XTENSA,         "xtensa",       "Xtensa",       },
| -   {       IH_ARCH_RISCV,          "riscv",        "RISC-V",       },
| +   {       IH_ARCH_RISCV,          "riscv",        "RISC-V 32 Bit",},
| +   {       IH_ARCH_RISCV64,        "riscv64",      "RISC-V 64 Bit",},
|     {       -1,                     "",             "",             },
|  };
|
| diff --git a/include/image.h b/include/image.h
| index 07912606f33..411bfcd0877 100644
| --- a/include/image.h
| +++ b/include/image.h
| @@ -138,7 +138,8 @@ enum {
|     IH_ARCH_ARC,                    /* Synopsys DesignWare ARC */
|     IH_ARCH_X86_64,                 /* AMD x86_64, Intel and Via */
|     IH_ARCH_XTENSA,                 /* Xtensa       */
| -   IH_ARCH_RISCV,                  /* RISC-V */
| +   IH_ARCH_RISCV,                  /* RISC-V 32 bit*/
| +   IH_ARCH_RISCV64,                /* RISC-V 64 bit*/
|
|     IH_ARCH_COUNT,
|  };
| --
| 2.43.0
|

since it is changing the existing "riscv" image type to be the 32-bit image and requiring the new entry for 64-bit. My CI job uses the system mkimage to create the image that U-Boot is loading, so it doesn't know about the new define etc. Maybe it's not considered a problem if a new U-Boot cannot boot an old image, but the comment above the enum reads:

|/*
| * CPU Architecture Codes (supported by Linux)
| *
| * The following are exposed to uImage header.
| * New IDs *MUST* be appended at the end of the list and *NEVER*
| * inserted for backward compatibility.
| */
Quoted 6 lines

The overwhelming majority of existing supported boards in U-Boot are 64-bit platforms, and the 64-bit platforms are the ones that have been supported for longer, so my thought would be that the compatibility of 64-bit platforms should be prioritised over 32-bit? Or even add explicit 32-bit and 64-bit entries and the existing one is a catch-all for compatibility reasons?

I've mentioned entries with bitwidth explicitly specified in my previous reply (and there hasn't been any response).

Quoted 6 lines

I'll consider IH_ARCH_RISCV32 a better idea, instead of implying 32bit when no suffix attached. We (and the Linux kernel) mix 32-bit and 64-bit variants of RISC-V together, thus it's hard to tell the exact bitwidth of "IH_ARCH_RISCV" without inspecting the code around. To me, it sounds more like "RISC-V, but no bitwidth specified".

Quoted 7 lines
Quoted 1 line

It will be nice if we could avoid this kind of ambiguity.

(referring my own reply[1])

I'll second explicit 32-bit and 64-bit entries, and keeping IH_ARCH_RISCV for compatibility consideration.

Are you suggesting something like this :

Quoted 7 lines

{ IH_ARCH_RISCV, "riscv", "RISC-V",},
{ IH_ARCH_RISCV32, "riscv32", "RISC-V 32 Bit",},
{ IH_ARCH_RISCV64, "riscv64", "RISC-V 64 Bit",},

I tried to implement it like on ARM64. However the problem is that while on ARM64 it switches to aarch32 if it encounters an IH_ARCH_ARM kernel image, there is no equivalent mechanism for Risc-V yet.

But we don't even want that, since the current behaviour on a 64-bit system is not to do anything 32-bit related, right? My 64-bit images created with my system mkimage use IH_ARCH_RISCV.

Quoted 3 lines

Another
option could be to disable this check in the bootm flow for now until a similar mechanism is implemented on Risc-V.

Quoted 5 lines
Quoted 3 lines

Why not just allow IH_ARCH_RISCV to retain the current "dumb" behaviour permanently, and only implement the strict checking when the explicit width types are detected?

This seems most reasonable to me for the current situation.

Ok. In that case, I think the patch set needs to be reverted.

Quoted 3 lines

--
Tom

#12 lore raw
Quoted 113 lines · Mayuresh Chitale
Quoted 112 lines · Tom Rini
Quoted 110 lines · Conor Dooley
Quoted 93 lines · Mayuresh Chitale
Quoted 83 lines · Yao Zi
Quoted 65 lines · Conor Dooley
Quoted 1 line · Tom Rini

On Wed, 21 May 2025 17:50:03 +0800, Leo Liang wrote:

This PR seems to have made my CI blow up, and I'm not entirely sure if that's something intentional or not. I've not yet bisected, but since the error is "Image arch not compatible with host arch", I can only imagine the patch in question is:

| Subject: [PATCH v2 1/3] riscv: image: Add new image type for RV64
| Date: Fri,  4 Apr 2025 14:48:55 +0000       [thread overview]
| Message-ID: <[email protected]> (raw)
| In-Reply-To: <[email protected]>
|
| Similar to ARM and X86, introduce a new image type which allows u-boot
| to distinguish between images built for 32-bit vs 64-bit Risc-V CPUs.
|
| Signed-off-by: Mayuresh Chitale <[email protected]>
| Reviewed-by: Maxim Moskalets <[email protected]>
| ---
|  boot/image.c    | 3 ++-
|  include/image.h | 3 ++-
|  2 files changed, 4 insertions(+), 2 deletions(-)
|
| diff --git a/boot/image.c b/boot/image.c
| index 139c5bd035a..45299a7dc33 100644
| --- a/boot/image.c
| +++ b/boot/image.c
| @@ -92,7 +92,8 @@ static const table_entry_t uimage_arch[] = {
|     {       IH_ARCH_ARC,            "arc",          "ARC",          },
|     {       IH_ARCH_X86_64,         "x86_64",       "AMD x86_64",   },
|     {       IH_ARCH_XTENSA,         "xtensa",       "Xtensa",       },
| -   {       IH_ARCH_RISCV,          "riscv",        "RISC-V",       },
| +   {       IH_ARCH_RISCV,          "riscv",        "RISC-V 32 Bit",},
| +   {       IH_ARCH_RISCV64,        "riscv64",      "RISC-V 64 Bit",},
|     {       -1,                     "",             "",             },
|  };
|
| diff --git a/include/image.h b/include/image.h
| index 07912606f33..411bfcd0877 100644
| --- a/include/image.h
| +++ b/include/image.h
| @@ -138,7 +138,8 @@ enum {
|     IH_ARCH_ARC,                    /* Synopsys DesignWare ARC */
|     IH_ARCH_X86_64,                 /* AMD x86_64, Intel and Via */
|     IH_ARCH_XTENSA,                 /* Xtensa       */
| -   IH_ARCH_RISCV,                  /* RISC-V */
| +   IH_ARCH_RISCV,                  /* RISC-V 32 bit*/
| +   IH_ARCH_RISCV64,                /* RISC-V 64 bit*/
|
|     IH_ARCH_COUNT,
|  };
| --
| 2.43.0
|

since it is changing the existing "riscv" image type to be the 32-bit image and requiring the new entry for 64-bit. My CI job uses the system mkimage to create the image that U-Boot is loading, so it doesn't know about the new define etc. Maybe it's not considered a problem if a new U-Boot cannot boot an old image, but the comment above the enum reads:

|/*
| * CPU Architecture Codes (supported by Linux)
| *
| * The following are exposed to uImage header.
| * New IDs *MUST* be appended at the end of the list and *NEVER*
| * inserted for backward compatibility.
| */
Quoted 6 lines

The overwhelming majority of existing supported boards in U-Boot are 64-bit platforms, and the 64-bit platforms are the ones that have been supported for longer, so my thought would be that the compatibility of 64-bit platforms should be prioritised over 32-bit? Or even add explicit 32-bit and 64-bit entries and the existing one is a catch-all for compatibility reasons?

I've mentioned entries with bitwidth explicitly specified in my previous reply (and there hasn't been any response).

Quoted 6 lines

I'll consider IH_ARCH_RISCV32 a better idea, instead of implying 32bit when no suffix attached. We (and the Linux kernel) mix 32-bit and 64-bit variants of RISC-V together, thus it's hard to tell the exact bitwidth of "IH_ARCH_RISCV" without inspecting the code around. To me, it sounds more like "RISC-V, but no bitwidth specified".

Quoted 7 lines
Quoted 1 line

It will be nice if we could avoid this kind of ambiguity.

(referring my own reply[1])

I'll second explicit 32-bit and 64-bit entries, and keeping IH_ARCH_RISCV for compatibility consideration.

Are you suggesting something like this :

Quoted 7 lines

{ IH_ARCH_RISCV, "riscv", "RISC-V",},
{ IH_ARCH_RISCV32, "riscv32", "RISC-V 32 Bit",},
{ IH_ARCH_RISCV64, "riscv64", "RISC-V 64 Bit",},

I tried to implement it like on ARM64. However the problem is that while on ARM64 it switches to aarch32 if it encounters an IH_ARCH_ARM kernel image, there is no equivalent mechanism for Risc-V yet.

But we don't even want that, since the current behaviour on a 64-bit system is not to do anything 32-bit related, right? My 64-bit images created with my system mkimage use IH_ARCH_RISCV.

Quoted 3 lines

Another
option could be to disable this check in the bootm flow for now until a similar mechanism is implemented on Risc-V.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Why not just allow IH_ARCH_RISCV to retain the current "dumb" behaviour permanently, and only implement the strict checking when the explicit width types are detected?

This seems most reasonable to me for the current situation.

Ok. In that case, I think the patch set needs to be reverted.

Please post a revert and Link: to this thread, thanks!

Signature · 1 line
Tom
#13 lore raw
Quoted 5 lines · Tom Rini
Quoted 3 lines · Mayuresh Chitale
Quoted 2 lines · Tom Rini

On Mon, May 26, 2025 at 10:17:54AM +0100, Conor Dooley wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Mayuresh Chitale
Quoted 7 lines · Yao Zi
Quoted 6 lines · Conor Dooley
Quoted 4 lines · Tom Rini
Quoted 1 line · Leo Liang

This PR seems to have made my CI blow up, and I'm not

entirely sure if

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

that's something intentional or not. I've not yet bisected,

but since

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

the error is "Image arch not compatible with host arch", I

can only

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

imagine the patch in question is:
| Subject: [PATCH v2 1/3] riscv: image: Add new image type

for RV64

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| Date: Fri, 4 Apr 2025 14:48:55 +0000 [thread

overview]

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| Message-ID: <

[email protected]> (raw)

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| In-Reply-To: <

[email protected]>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

|
| Similar to ARM and X86, introduce a new image type which

allows u-boot

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| to distinguish between images built for 32-bit vs 64-bit

Risc-V CPUs.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
|
| Signed-off-by: Mayuresh Chitale <[email protected]>
| Reviewed-by: Maxim Moskalets <[email protected]>
| ---
|  boot/image.c    | 3 ++-
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
|  include/image.h | 3 ++-
|  2 files changed, 4 insertions(+), 2 deletions(-)
|
| diff --git a/boot/image.c b/boot/image.c
| index 139c5bd035a..45299a7dc33 100644
| --- a/boot/image.c
| +++ b/boot/image.c
| @@ -92,7 +92,8 @@ static const table_entry_t uimage_arch[]

= {

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| { IH_ARCH_ARC, "arc", "ARC",

         },
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| { IH_ARCH_X86_64, "x86_64", "AMD

x86_64", },

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| { IH_ARCH_XTENSA, "xtensa",

"Xtensa", },

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| - { IH_ARCH_RISCV, "riscv",

"RISC-V", },

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| + { IH_ARCH_RISCV, "riscv", "RISC-V

32 Bit",},

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| + { IH_ARCH_RISCV64, "riscv64", "RISC-V

64 Bit",},

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| { -1, "", "",

        },
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
|  };
|
| diff --git a/include/image.h b/include/image.h
| index 07912606f33..411bfcd0877 100644
| --- a/include/image.h
| +++ b/include/image.h
| @@ -138,7 +138,8 @@ enum {
|     IH_ARCH_ARC,                    /* Synopsys DesignWare

ARC */

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| IH_ARCH_X86_64, /* AMD x86_64, Intel

and Via */

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
|     IH_ARCH_XTENSA,                 /* Xtensa       */
| -   IH_ARCH_RISCV,                  /* RISC-V */
| +   IH_ARCH_RISCV,                  /* RISC-V 32 bit*/
| +   IH_ARCH_RISCV64,                /* RISC-V 64 bit*/
|
|     IH_ARCH_COUNT,
|  };
| --
| 2.43.0
|

since it is changing the existing "riscv" image type to be

the 32-bit

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

image and requiring the new entry for 64-bit. My CI job uses

the system

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

mkimage to create the image that U-Boot is loading, so it

doesn't know

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

about the new define etc. Maybe it's not considered a problem

if a new

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

U-Boot cannot boot an old image, but the comment above the

enum reads:

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
|/*
| * CPU Architecture Codes (supported by Linux)
| *
| * The following are exposed to uImage header.
| * New IDs *MUST* be appended at the end of the list and

*NEVER*

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

| * inserted for backward compatibility.
| */
The overwhelming majority of existing supported boards in

U-Boot are

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

64-bit platforms, and the 64-bit platforms are the ones that

have been

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

supported for longer, so my thought would be that the

compatibility of

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

64-bit platforms should be prioritised over 32-bit? Or even

add explicit

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

32-bit and 64-bit entries and the existing one is a catch-all

for

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

compatibility reasons?

I've mentioned entries with bitwidth explicitly specified in my

previous

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

reply (and there hasn't been any response).

Quoted 1 line

I'll consider IH_ARCH_RISCV32 a better idea, instead of

implying 32bit

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

when no suffix attached. We (and the Linux kernel) mix 32-bit

and 64-bit

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

variants of RISC-V together, thus it's hard to tell the exact

bitwidth

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

of "IH_ARCH_RISCV" without inspecting the code around. To me,

it sounds

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines

more like "RISC-V, but no bitwidth specified".

It will be nice if we could avoid this kind of ambiguity.

(referring my own reply[1])

I'll second explicit 32-bit and 64-bit entries, and keeping IH_ARCH_RISCV for compatibility consideration.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Are you suggesting something like this :

{ IH_ARCH_RISCV, "riscv", "RISC-V",},
{ IH_ARCH_RISCV32, "riscv32", "RISC-V 32 Bit",},
{ IH_ARCH_RISCV64, "riscv64", "RISC-V 64 Bit",},

I tried to implement it like on ARM64. However the problem is that while on ARM64 it switches to aarch32 if it encounters an

IH_ARCH_ARM

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line

kernel image, there is no equivalent mechanism for Risc-V yet.

But we don't even want that, since the current behaviour on a 64-bit system is not to do anything 32-bit related, right? My 64-bit images created with my system mkimage use IH_ARCH_RISCV.

Quoted 2 lines

Another
option could be to disable this check in the bootm flow for now

until

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

a similar mechanism is implemented on Risc-V.

Why not just allow IH_ARCH_RISCV to retain the current "dumb"

behaviour

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

permanently, and only implement the strict checking when the

explicit

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

width types are detected?

This seems most reasonable to me for the current situation.

Ok. In that case, I think the patch set needs to be reverted.

Please post a revert and Link: to this thread, thanks!

Ok. I am wondering how this problem can be solved as there would always be older versions of tools or images etc which won't be compatible with this change.

Quoted 3 lines

--
Tom

#14 lore raw
Quoted 159 lines · Mayuresh Chitale
Quoted 5 lines · Tom Rini
Quoted 3 lines · Mayuresh Chitale
Quoted 2 lines · Tom Rini

On Mon, May 26, 2025 at 10:17:54AM +0100, Conor Dooley wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Mayuresh Chitale
Quoted 7 lines · Yao Zi
Quoted 6 lines · Conor Dooley
Quoted 4 lines · Tom Rini
Quoted 1 line · Leo Liang

This PR seems to have made my CI blow up, and I'm not

entirely sure if

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

that's something intentional or not. I've not yet bisected,

but since

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

the error is "Image arch not compatible with host arch", I

can only

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

imagine the patch in question is:
| Subject: [PATCH v2 1/3] riscv: image: Add new image type

for RV64

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| Date: Fri, 4 Apr 2025 14:48:55 +0000 [thread

overview]

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| Message-ID: <

[email protected]> (raw)

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| In-Reply-To: <

[email protected]>

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

|
| Similar to ARM and X86, introduce a new image type which

allows u-boot

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| to distinguish between images built for 32-bit vs 64-bit

Risc-V CPUs.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
|
| Signed-off-by: Mayuresh Chitale <[email protected]>
| Reviewed-by: Maxim Moskalets <[email protected]>
| ---
|  boot/image.c    | 3 ++-
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
|  include/image.h | 3 ++-
|  2 files changed, 4 insertions(+), 2 deletions(-)
|
| diff --git a/boot/image.c b/boot/image.c
| index 139c5bd035a..45299a7dc33 100644
| --- a/boot/image.c
| +++ b/boot/image.c
| @@ -92,7 +92,8 @@ static const table_entry_t uimage_arch[]

= {

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| { IH_ARCH_ARC, "arc", "ARC",

         },
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| { IH_ARCH_X86_64, "x86_64", "AMD

x86_64", },

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| { IH_ARCH_XTENSA, "xtensa",

"Xtensa", },

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| - { IH_ARCH_RISCV, "riscv",

"RISC-V", },

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| + { IH_ARCH_RISCV, "riscv", "RISC-V

32 Bit",},

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| + { IH_ARCH_RISCV64, "riscv64", "RISC-V

64 Bit",},

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| { -1, "", "",

        },
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
|  };
|
| diff --git a/include/image.h b/include/image.h
| index 07912606f33..411bfcd0877 100644
| --- a/include/image.h
| +++ b/include/image.h
| @@ -138,7 +138,8 @@ enum {
|     IH_ARCH_ARC,                    /* Synopsys DesignWare

ARC */

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

| IH_ARCH_X86_64, /* AMD x86_64, Intel

and Via */

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
|     IH_ARCH_XTENSA,                 /* Xtensa       */
| -   IH_ARCH_RISCV,                  /* RISC-V */
| +   IH_ARCH_RISCV,                  /* RISC-V 32 bit*/
| +   IH_ARCH_RISCV64,                /* RISC-V 64 bit*/
|
|     IH_ARCH_COUNT,
|  };
| --
| 2.43.0
|

since it is changing the existing "riscv" image type to be

the 32-bit

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

image and requiring the new entry for 64-bit. My CI job uses

the system

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

mkimage to create the image that U-Boot is loading, so it

doesn't know

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

about the new define etc. Maybe it's not considered a problem

if a new

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

U-Boot cannot boot an old image, but the comment above the

enum reads:

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
|/*
| * CPU Architecture Codes (supported by Linux)
| *
| * The following are exposed to uImage header.
| * New IDs *MUST* be appended at the end of the list and

*NEVER*

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

| * inserted for backward compatibility.
| */
The overwhelming majority of existing supported boards in

U-Boot are

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

64-bit platforms, and the 64-bit platforms are the ones that

have been

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

supported for longer, so my thought would be that the

compatibility of

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

64-bit platforms should be prioritised over 32-bit? Or even

add explicit

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

32-bit and 64-bit entries and the existing one is a catch-all

for

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

compatibility reasons?

I've mentioned entries with bitwidth explicitly specified in my

previous

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

reply (and there hasn't been any response).

Quoted 1 line

I'll consider IH_ARCH_RISCV32 a better idea, instead of

implying 32bit

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

when no suffix attached. We (and the Linux kernel) mix 32-bit

and 64-bit

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

variants of RISC-V together, thus it's hard to tell the exact

bitwidth

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

of "IH_ARCH_RISCV" without inspecting the code around. To me,

it sounds

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines

more like "RISC-V, but no bitwidth specified".

It will be nice if we could avoid this kind of ambiguity.

(referring my own reply[1])

I'll second explicit 32-bit and 64-bit entries, and keeping IH_ARCH_RISCV for compatibility consideration.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Are you suggesting something like this :

{ IH_ARCH_RISCV, "riscv", "RISC-V",},
{ IH_ARCH_RISCV32, "riscv32", "RISC-V 32 Bit",},
{ IH_ARCH_RISCV64, "riscv64", "RISC-V 64 Bit",},

I tried to implement it like on ARM64. However the problem is that while on ARM64 it switches to aarch32 if it encounters an

IH_ARCH_ARM

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line

kernel image, there is no equivalent mechanism for Risc-V yet.

But we don't even want that, since the current behaviour on a 64-bit system is not to do anything 32-bit related, right? My 64-bit images created with my system mkimage use IH_ARCH_RISCV.

Quoted 2 lines

Another
option could be to disable this check in the bootm flow for now

until

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

a similar mechanism is implemented on Risc-V.

Why not just allow IH_ARCH_RISCV to retain the current "dumb"

behaviour

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

permanently, and only implement the strict checking when the

explicit

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line

width types are detected?

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

This seems most reasonable to me for the current situation.

Ok. In that case, I think the patch set needs to be reverted.

Please post a revert and Link: to this thread, thanks!

Ok. I am wondering how this problem can be solved as there would always be older versions of tools or images etc which won't be compatible with this change.

It's only been in a -rc release, correct? I'm fine saying no one should have shipped that.

Signature · 1 line
Tom