Revision | 10f1ca27e0fe9930d372591cd5f302e7249aa705 (tree) |
---|---|
Zeit | 2022-01-21 14:52:56 |
Autor | Yifei Jiang <jiangyifei@huaw...> |
Commiter | Alistair Francis |
target/riscv: Add host cpu type
'host' type cpu is set isa to RV32 or RV64 simply, more isa info
will obtain from KVM in kvm_arch_init_vcpu()
Signed-off-by: Yifei Jiang <jiangyifei@huawei.com>
Signed-off-by: Mingwang Li <limingwang@huawei.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Message-id: 20220112081329.1835-10-jiangyifei@huawei.com
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
@@ -235,6 +235,18 @@ static void rv32_imafcu_nommu_cpu_init(Object *obj) | ||
235 | 235 | } |
236 | 236 | #endif |
237 | 237 | |
238 | +#if defined(CONFIG_KVM) | |
239 | +static void riscv_host_cpu_init(Object *obj) | |
240 | +{ | |
241 | + CPURISCVState *env = &RISCV_CPU(obj)->env; | |
242 | +#if defined(TARGET_RISCV32) | |
243 | + set_misa(env, MXL_RV32, 0); | |
244 | +#elif defined(TARGET_RISCV64) | |
245 | + set_misa(env, MXL_RV64, 0); | |
246 | +#endif | |
247 | +} | |
248 | +#endif | |
249 | + | |
238 | 250 | static ObjectClass *riscv_cpu_class_by_name(const char *cpu_model) |
239 | 251 | { |
240 | 252 | ObjectClass *oc; |
@@ -847,6 +859,9 @@ static const TypeInfo riscv_cpu_type_infos[] = { | ||
847 | 859 | .class_init = riscv_cpu_class_init, |
848 | 860 | }, |
849 | 861 | DEFINE_CPU(TYPE_RISCV_CPU_ANY, riscv_any_cpu_init), |
862 | +#if defined(CONFIG_KVM) | |
863 | + DEFINE_CPU(TYPE_RISCV_CPU_HOST, riscv_host_cpu_init), | |
864 | +#endif | |
850 | 865 | #if defined(TARGET_RISCV32) |
851 | 866 | DEFINE_CPU(TYPE_RISCV_CPU_BASE32, rv32_base_cpu_init), |
852 | 867 | DEFINE_CPU(TYPE_RISCV_CPU_IBEX, rv32_ibex_cpu_init), |
@@ -47,6 +47,7 @@ | ||
47 | 47 | #define TYPE_RISCV_CPU_SIFIVE_E51 RISCV_CPU_TYPE_NAME("sifive-e51") |
48 | 48 | #define TYPE_RISCV_CPU_SIFIVE_U34 RISCV_CPU_TYPE_NAME("sifive-u34") |
49 | 49 | #define TYPE_RISCV_CPU_SIFIVE_U54 RISCV_CPU_TYPE_NAME("sifive-u54") |
50 | +#define TYPE_RISCV_CPU_HOST RISCV_CPU_TYPE_NAME("host") | |
50 | 51 | |
51 | 52 | #if defined(TARGET_RISCV32) |
52 | 53 | # define TYPE_RISCV_CPU_BASE TYPE_RISCV_CPU_BASE32 |