u-boot/drivers/cpu
Conor Dooley b90edde701 riscv: don't read riscv, isa in the riscv cpu's get_desc()
cpu_get_desc() for the RISC-V CPU currently reads "riscv,isa" to get
the description, but it is no longer a required property and cannot be
assummed to always be present, as the new "riscv,isa-extensions" and
"riscv,isa-base" properties may be present instead.

On RISC-V, cpu_get_desc() has two main uses - firstly providing an
informational name for the CPU for smbios or at boot with
DISPLAY_CPUINFO etc and secondly it forms the basis of ISA extension
detection in supports_extension() as it returns (a portion of) an ISA
string.

cpu_get_desc() returns a string, which aligned with "riscv,isa" but
the new property is a list of strings. Rather than add support for
the list of strings property, which would require creating an isa
string from "riscv,isa-extensions", modify the RISC-V CPU's
implementaion of cpu_get_desc() return the first compatible as the
cpu description instead. This may be fine for the informational cases,
but it would break extension dtection, given supports_extension()
expects cpu_get_desc() to return an ISA string.

Call dev_read_string() directly in supports_extension() to get the
contents of "riscv,isa" so that extension detection remains functional.
As a knock-on affect of this change, extension detection is no longer
broken for long ISA strings. Previously if the ISA string exceeded the
32 element array that supports_extension() passed to cpu_get_desc(),
it would return ENOSPC and no extensions would be detected.
This bug probably had no impact as U-Boot does not currently do anything
meaningful with the results of supports_extension() and most SoCs
supported by U-Boot don't have anywhere near that complex of an ISA
string. The QEMU virt machine's CPUs do however, so extension detection
doesn't work there.

Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2024-04-09 11:30:17 +08:00
..
at91_cpu.c cpu: at91: add compatible for ARM9260EJ-S 2021-09-21 10:05:37 +03:00
bmips_cpu.c common: Drop display_options.h from common header 2022-08-10 13:46:55 -04:00
cpu_sandbox.c sandbox: correct cpu nodes 2021-09-25 09:46:15 -06:00
cpu-uclass.c cpu: Remove unused NEEDS_MANUAL_RELOC code bits 2023-09-14 10:42:24 -04:00
imx8_cpu.c imx9: add i.MX93 variants support 2023-05-21 16:54:41 +02:00
imx9_cpu.c imx: move imx8 sci header file to include/firmware/imx 2023-05-21 16:54:32 +02:00
Kconfig imx: imx8_cpu: support i.MX9 2023-05-21 16:54:40 +02:00
Makefile imx: imx8_cpu: support i.MX9 2023-05-21 16:54:40 +02:00
microblaze_cpu.c event: Convert existing spy records to simple 2023-08-31 13:16:54 -04:00
mpc83xx_cpu.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
mpc83xx_cpu.h cpu: Add MPC83xx CPU driver 2018-09-18 08:12:21 -06:00
mtk_cpu.c cpu: add basic cpu driver for MediaTek ARM chips 2022-09-23 15:09:16 -04:00
riscv_cpu.c riscv: don't read riscv, isa in the riscv cpu's get_desc() 2024-04-09 11:30:17 +08:00