Skip to content

Commit

Permalink
target/riscv: Add short-isa-string option
Browse files Browse the repository at this point in the history
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.

For instance, enabling Zfinx and Zdinx extensions and booting Linux (5.17 or
earlier) with FPU support caused a kernel panic.

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>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <7c1fe5f06b0a7646a47e9bcdddb1042bb60c69c8.1652181972.git.research_trasio@irq.a4lg.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
  • Loading branch information
a4lg authored and taylorsimpson committed Jun 6, 2022
1 parent 619382a commit f25c3f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion target/riscv/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,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(),
};

Expand Down Expand Up @@ -1049,7 +1051,9 @@ 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);
}
return isa_str;
}

Expand Down
2 changes: 2 additions & 0 deletions target/riscv/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ struct RISCVCPUConfig {
bool aia;
bool debug;
uint64_t resetvec;

bool short_isa_string;
};

typedef struct RISCVCPUConfig RISCVCPUConfig;
Expand Down

0 comments on commit f25c3f3

Please sign in to comment.