aboutsummaryrefslogtreecommitdiff
path: root/target/riscv/kvm.c
diff options
context:
space:
mode:
authorDaniel Henrique Barboza <dbarboza@ventanamicro.com>2023-09-25 14:56:56 -0300
committerAlistair Francis <alistair.francis@wdc.com>2023-10-12 12:01:10 +1000
commita7e87cd7bfd4580bc745cf12440f4e26329bc747 (patch)
tree194731ea0316987bd4306f1472a594e142cf30ed /target/riscv/kvm.c
parent977bbb04525682fd7a2ed8d28c0590bc2873db06 (diff)
target/riscv: move 'host' CPU declaration to kvm.c
This CPU only exists if we're compiling with KVM so move it to the kvm specific file. Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <20230925175709.35696-7-dbarboza@ventanamicro.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'target/riscv/kvm.c')
-rw-r--r--target/riscv/kvm.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/target/riscv/kvm.c b/target/riscv/kvm.c
index 1e4e4456b3..31d2ede4b6 100644
--- a/target/riscv/kvm.c
+++ b/target/riscv/kvm.c
@@ -1271,3 +1271,24 @@ void kvm_riscv_aia_create(MachineState *machine, uint64_t group_shift,
kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();
}
+
+static void riscv_host_cpu_init(Object *obj)
+{
+ CPURISCVState *env = &RISCV_CPU(obj)->env;
+
+#if defined(TARGET_RISCV32)
+ env->misa_mxl_max = env->misa_mxl = MXL_RV32;
+#elif defined(TARGET_RISCV64)
+ env->misa_mxl_max = env->misa_mxl = MXL_RV64;
+#endif
+}
+
+static const TypeInfo riscv_kvm_cpu_type_infos[] = {
+ {
+ .name = TYPE_RISCV_CPU_HOST,
+ .parent = TYPE_RISCV_CPU,
+ .instance_init = riscv_host_cpu_init,
+ }
+};
+
+DEFINE_TYPES(riscv_kvm_cpu_type_infos)