• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision10f1ca27e0fe9930d372591cd5f302e7249aa705 (tree)
Zeit2022-01-21 14:52:56
AutorYifei Jiang <jiangyifei@huaw...>
CommiterAlistair Francis

Log Message

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>

Ändern Zusammenfassung

Diff

--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -235,6 +235,18 @@ static void rv32_imafcu_nommu_cpu_init(Object *obj)
235235 }
236236 #endif
237237
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+
238250 static ObjectClass *riscv_cpu_class_by_name(const char *cpu_model)
239251 {
240252 ObjectClass *oc;
@@ -847,6 +859,9 @@ static const TypeInfo riscv_cpu_type_infos[] = {
847859 .class_init = riscv_cpu_class_init,
848860 },
849861 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
850865 #if defined(TARGET_RISCV32)
851866 DEFINE_CPU(TYPE_RISCV_CPU_BASE32, rv32_base_cpu_init),
852867 DEFINE_CPU(TYPE_RISCV_CPU_IBEX, rv32_ibex_cpu_init),
--- a/target/riscv/cpu.h
+++ b/target/riscv/cpu.h
@@ -47,6 +47,7 @@
4747 #define TYPE_RISCV_CPU_SIFIVE_E51 RISCV_CPU_TYPE_NAME("sifive-e51")
4848 #define TYPE_RISCV_CPU_SIFIVE_U34 RISCV_CPU_TYPE_NAME("sifive-u34")
4949 #define TYPE_RISCV_CPU_SIFIVE_U54 RISCV_CPU_TYPE_NAME("sifive-u54")
50+#define TYPE_RISCV_CPU_HOST RISCV_CPU_TYPE_NAME("host")
5051
5152 #if defined(TARGET_RISCV32)
5253 # define TYPE_RISCV_CPU_BASE TYPE_RISCV_CPU_BASE32