[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 6/9] target/riscv/tcg: handle profile MISA bits
From: |
Andrew Jones |
Subject: |
Re: [PATCH v4 6/9] target/riscv/tcg: handle profile MISA bits |
Date: |
Wed, 25 Oct 2023 18:16:05 +0200 |
On Wed, Oct 25, 2023 at 10:49:58AM -0300, Daniel Henrique Barboza wrote:
> The profile support is handling multi-letter extensions only. Let's add
> support for MISA bits as well.
>
> We'll go through every known MISA bit. If the profile doesn't declare the bit
> as mandatory, ignore it. Otherwise, set or clear the bit in env->misa_ext and
> env->misa_ext_mask depending on whether the profile was set to 'true' or
> 'false'.
>
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
> ---
> target/riscv/tcg/tcg-cpu.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
> index b2489a5317..57026cfcca 100644
> --- a/target/riscv/tcg/tcg-cpu.c
> +++ b/target/riscv/tcg/tcg-cpu.c
> @@ -804,6 +804,19 @@ static void cpu_set_profile(Object *obj, Visitor *v,
> const char *name,
> profile->user_set = true;
> profile->enabled = value;
>
> + for (i = 0; misa_bits[i] != 0; i++) {
> + uint32_t bit = misa_bits[i];
> +
> + if (!(profile->misa_ext & bit)) {
> + continue;
> + }
> +
> + g_hash_table_insert(misa_ext_user_opts,
> + GUINT_TO_POINTER(bit),
> + (gpointer)value);
> + riscv_cpu_write_misa_bit(cpu, bit, profile->enabled);
> + }
> +
> for (i = 0; profile->ext_offsets[i] != RISCV_PROFILE_EXT_LIST_END; i++) {
> ext_offset = profile->ext_offsets[i];
>
> --
> 2.41.0
>
>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
- Re: [PATCH v4 4/9] target/riscv/tcg: add MISA user options hash, (continued)
- [PATCH v4 8/9] target/riscv/tcg: honor user choice for G MISA bits, Daniel Henrique Barboza, 2023/10/25
- [PATCH v4 9/9] target/riscv/tcg: warn if profile exts are disabled, Daniel Henrique Barboza, 2023/10/25
- [PATCH v4 5/9] target/riscv/tcg: add riscv_cpu_write_misa_bit(), Daniel Henrique Barboza, 2023/10/25
- [PATCH v4 7/9] target/riscv/tcg: add hash table insert helpers, Daniel Henrique Barboza, 2023/10/25
- [PATCH v4 6/9] target/riscv/tcg: handle profile MISA bits, Daniel Henrique Barboza, 2023/10/25
- Re: [PATCH v4 6/9] target/riscv/tcg: handle profile MISA bits,
Andrew Jones <=