[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] target/riscv: Add short-isa-string option
From: |
Alistair Francis |
Subject: |
Re: [PATCH 2/2] target/riscv: Add short-isa-string option |
Date: |
Mon, 9 May 2022 11:51:50 +0200 |
On Sun, Apr 24, 2022 at 7:22 AM Tsukasa OI <research_trasio@irq.a4lg.com> wrote:
>
> Because some operating systems don't correctly parse long ISA extension
> string, this commit adds short-isa-string boolean option to disable
> generating long ISA extension strings on Device Tree.
>
> Operating Systems which short-isa-string might be helpful:
>
> 1. Linux (5.17 or earlier)
> 2. FreeBSD (at least 14.0-CURRENT)
> 3. OpenBSD (at least current development version)
>
> Signed-off-by: Tsukasa OI <research_trasio@irq.a4lg.com>
> ---
> target/riscv/cpu.c | 5 ++++-
> target/riscv/cpu.h | 2 ++
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index c765f7ff00..9718cd0e7e 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -834,6 +834,8 @@ static Property riscv_cpu_properties[] = {
> DEFINE_PROP_BOOL("x-aia", RISCVCPU, cfg.aia, false),
>
> DEFINE_PROP_UINT64("resetvec", RISCVCPU, cfg.resetvec, DEFAULT_RSTVEC),
> +
> + DEFINE_PROP_BOOL("short-isa-string", RISCVCPU, cfg.short_isa_string,
> false),
> DEFINE_PROP_END_OF_LIST(),
> };
>
> @@ -989,7 +991,8 @@ char *riscv_isa_string(RISCVCPU *cpu)
> }
> }
> *p = '\0';
> - riscv_isa_string_ext(cpu, &isa_str, maxlen);
> + if (!cpu->cfg.short_isa_string)
> + riscv_isa_string_ext(cpu, &isa_str, maxlen);
I don't love this, the long strings are part of the ISA, it seems
strange to add an option to disable them.
Can you provide more details on what this breaks?
Alistair
> return isa_str;
> }
>
> diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
> index 34c22d5d3b..5b7fe32218 100644
> --- a/target/riscv/cpu.h
> +++ b/target/riscv/cpu.h
> @@ -408,6 +408,8 @@ struct RISCVCPUConfig {
> bool aia;
> bool debug;
> uint64_t resetvec;
> +
> + bool short_isa_string;
> };
>
> typedef struct RISCVCPUConfig RISCVCPUConfig;
> --
> 2.32.0
>
- Re: [PATCH 2/2] target/riscv: Add short-isa-string option,
Alistair Francis <=