RISC-V: Minimal parser for "riscv, isa" strings
authorTsukasa OI <research_trasio@irq.a4lg.com>
Mon, 14 Mar 2022 20:38:41 +0000 (13:38 -0700)
committerPalmer Dabbelt <palmer@rivosinc.com>
Thu, 17 Mar 2022 19:17:49 +0000 (12:17 -0700)
commit2a31c54be097c74344b4fab20ea6104012d2cb8b
treee6c5ad44c9340e36999e77281a51a2f573b05047
parent58004f266918912771ee71f46bfb92bf64ab9108
RISC-V: Minimal parser for "riscv, isa" strings

Current hart ISA ("riscv,isa") parser don't correctly parse:

1. Multi-letter extensions
2. Version numbers

All ISA extensions ratified recently has multi-letter extensions
(except 'H'). The current "riscv,isa" parser that is easily confused
by multi-letter extensions and "p" in version numbers can be a huge
problem for adding new extensions through the device tree.

Leaving it would create incompatible hacks and would make "riscv,isa"
value unreliable.

This commit implements minimal parser for "riscv,isa" strings.  With this,
we can safely ignore multi-letter extensions and version numbers.

[Improved commit text and fixed a bug around 's' in base extension]
Signed-off-by: Atish Patra <atishp@rivosinc.com>
[Fixed workaround for QEMU]
Signed-off-by: Tsukasa OI <research_trasio@irq.a4lg.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/kernel/cpufeature.c