OSDN Git Service

target/riscv/kvm: do not use riscv_cpu_add_misa_properties()
authorDaniel Henrique Barboza <dbarboza@ventanamicro.com>
Mon, 25 Sep 2023 17:57:03 +0000 (14:57 -0300)
committerAlistair Francis <alistair.francis@wdc.com>
Thu, 12 Oct 2023 02:21:37 +0000 (12:21 +1000)
commitefa365b711075eee996a657ec4b399e27ec8fa4f
tree31c80106fd458018ce90d1ed49bf0f7d672c6aaa
parentfb80f33377df221728d6c3c298f19b0da7ba277a
target/riscv/kvm: do not use riscv_cpu_add_misa_properties()

riscv_cpu_add_misa_properties() is being used to fill the missing KVM
MISA properties but it is a TCG helper that was adapted to do so. We'll
move it to tcg-cpu.c in the next patches, meaning that KVM needs to fill
the remaining MISA properties on its own.

Do not use riscv_cpu_add_misa_properties(). Let's create a new array
with all available MISA bits we support that can be read by KVM. The
array is zero terminate to allow us to iterate through it without
knowing its size.

Then, inside kvm_riscv_add_cpu_user_properties(), we'll create all KVM
MISA properties as usual and then use this array to add any missing MISA
properties with the riscv_cpu_add_kvm_unavail_prop() helper.

Note that we're creating misa_bits[], and not using the existing
'riscv_single_letter_exts[]', because the latter is tuned for riscv,isa
related functions and it doesn't have all MISA bits we support. Commit
0e2c377023 ("target/riscv: misa to ISA string conversion fix") has the
full context.

While we're at it, move both satp and the multi-letter extension
properties to kvm_riscv_add_cpu_user_properties() as well.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20230925175709.35696-14-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
target/riscv/cpu.c
target/riscv/cpu.h
target/riscv/kvm/kvm-cpu.c