[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] target/riscv/cpu.c: do not skip misa logic in riscv_cpu_
From: |
Bin Meng |
Subject: |
Re: [PATCH 2/2] target/riscv/cpu.c: do not skip misa logic in riscv_cpu_realize() |
Date: |
Wed, 11 Jan 2023 13:56:08 +0800 |
On Wed, Jan 11, 2023 at 4:17 AM Daniel Henrique Barboza
<dbarboza@ventanamicro.com> wrote:
>
> All RISCV CPUs are setting cpu->cfg during their cpu_init() functions,
> meaning that there's no reason to skip all the misa validation and setup
> if misa_ext was set beforehand - especially since we're setting an
> updated value in set_misa() in the end.
>
> Put this code chunk into a new riscv_cpu_validate_set_extensions()
> helper and always execute it regardless of what the board set in
> env->misa_ext.
>
> This will put more responsibility in how each board is going to init
> their attributes and extensions if they're not using the defaults.
> It'll also allow realize() to do its job looking only at the extensions
> enabled per se, not corner cases that some CPUs might have, and we won't
> have to change multiple code paths to fix or change how extensions work.
>
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> ---
> target/riscv/cpu.c | 485 +++++++++++++++++++++++----------------------
> 1 file changed, 248 insertions(+), 237 deletions(-)
>
Reviewed-by: Bin Meng <bmeng@tinylab.org>