• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

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

Commit MetaInfo

Révision1eb9a5da31abb0a7b613756f5bb7c887b7ef60ea (tree)
l'heure2022-01-21 14:52:56
AuteurYifei Jiang <jiangyifei@huaw...>
CommiterAlistair Francis

Message de Log

target/riscv: Support virtual time context synchronization

Add virtual time context description to vmstate_kvmtimer. After cpu being
loaded, virtual time context is updated to KVM.

Signed-off-by: Yifei Jiang <jiangyifei@huawei.com>
Signed-off-by: Mingwang Li <limingwang@huawei.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220112081329.1835-13-jiangyifei@huawei.com
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

Change Summary

Modification

--- a/target/riscv/machine.c
+++ b/target/riscv/machine.c
@@ -185,6 +185,35 @@ static const VMStateDescription vmstate_rv128 = {
185185 }
186186 };
187187
188+static bool kvmtimer_needed(void *opaque)
189+{
190+ return kvm_enabled();
191+}
192+
193+static int cpu_post_load(void *opaque, int version_id)
194+{
195+ RISCVCPU *cpu = opaque;
196+ CPURISCVState *env = &cpu->env;
197+
198+ env->kvm_timer_dirty = true;
199+ return 0;
200+}
201+
202+static const VMStateDescription vmstate_kvmtimer = {
203+ .name = "cpu/kvmtimer",
204+ .version_id = 1,
205+ .minimum_version_id = 1,
206+ .needed = kvmtimer_needed,
207+ .post_load = cpu_post_load,
208+ .fields = (VMStateField[]) {
209+ VMSTATE_UINT64(env.kvm_timer_time, RISCVCPU),
210+ VMSTATE_UINT64(env.kvm_timer_compare, RISCVCPU),
211+ VMSTATE_UINT64(env.kvm_timer_state, RISCVCPU),
212+
213+ VMSTATE_END_OF_LIST()
214+ }
215+};
216+
188217 const VMStateDescription vmstate_riscv_cpu = {
189218 .name = "cpu",
190219 .version_id = 3,
@@ -240,6 +269,7 @@ const VMStateDescription vmstate_riscv_cpu = {
240269 &vmstate_vector,
241270 &vmstate_pointermasking,
242271 &vmstate_rv128,
272+ &vmstate_kvmtimer,
243273 NULL
244274 }
245275 };