From nobody Tue Feb 10 15:45:56 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1598520353; cv=none; d=zohomail.com; s=zohoarc; b=ax8avTFdK+Ssom1QJlCCAWGdOwbB0x7XZudXh9aORieiyGa1Wy1pd6tgUcK7WR7EgKBIni1ZmyuSaYYg0hMV1pOmYsb0oTlvdD3LnMBDci5J2UpFh1DyRTA+yzRB9mCmZ3eZ00ZR+lIW2MA7jEeEnPYLchI6qXeIlTnTb00U614= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598520353; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Dz48i5FcJJnN4GBtYkDubwWMpvCGY97WptXG8Na/9oM=; b=EQ/qhA2XL0dxAElBKjl5BmOmKPEExesCk06CnqEz0kPgTdFYGSyt33WPvfxbj/k2XnR1CcjvU/I68NLgp5W1/0bBO/vuWBIVanewWN9nxLVaPPG4I2s2/L7aKnwiO7adaxa5CXx3NcD2hVX5AoeSfJrKQyZMfAsNy086S6OkxJo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1598520353499779.5606596089206; Thu, 27 Aug 2020 02:25:53 -0700 (PDT) Received: from localhost ([::1]:36222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBEAK-00089V-84 for importer@patchew.org; Thu, 27 Aug 2020 05:25:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBE7N-0002ig-Lo; Thu, 27 Aug 2020 05:22:49 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:4659 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBE7L-0003G5-Eb; Thu, 27 Aug 2020 05:22:49 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id B030E6AA5F5D63F4845C; Thu, 27 Aug 2020 17:22:42 +0800 (CST) Received: from huawei.com (10.174.187.31) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Thu, 27 Aug 2020 17:22:36 +0800 From: Yifei Jiang To: , Subject: [PATCH RFC v3 14/14] target/riscv: Support virtual time context synchronization Date: Thu, 27 Aug 2020 17:21:37 +0800 Message-ID: <20200827092137.479-15-jiangyifei@huawei.com> X-Mailer: git-send-email 2.26.2.windows.1 In-Reply-To: <20200827092137.479-1-jiangyifei@huawei.com> References: <20200827092137.479-1-jiangyifei@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.174.187.31] X-CFilter-Loop: Reflected Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=45.249.212.190; envelope-from=jiangyifei@huawei.com; helo=huawei.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/27 02:12:47 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: victor.zhangxiaofeng@huawei.com, sagark@eecs.berkeley.edu, kvm@vger.kernel.org, libvir-list@redhat.com, kbastian@mail.uni-paderborn.de, anup.patel@wdc.com, yinyipeng1@huawei.com, Alistair.Francis@wdc.com, Yifei Jiang , kvm-riscv@lists.infradead.org, palmer@dabbelt.com, dengkai1@huawei.com, wu.wubin@huawei.com, zhang.zhanghailiang@huawei.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Add virtual time context description to vmstate_riscv_cpu. After cpu being loaded, virtual time context is updated to KVM. Signed-off-by: Yifei Jiang Signed-off-by: Yipeng Yin --- target/riscv/cpu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index b698f4adbb..c6b207d201 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -496,11 +496,19 @@ static void riscv_cpu_init(Object *obj) cpu_set_cpustate_pointers(cpu); } =20 +static int cpu_post_load(void *opaque, int version_id) +{ + RISCVCPU *cpu =3D opaque; + cpu->env.kvm_timer_dirty =3D true; + return 0; +} + #ifndef CONFIG_USER_ONLY static const VMStateDescription vmstate_riscv_cpu =3D { .name =3D "cpu", .version_id =3D 1, .minimum_version_id =3D 1, + .post_load =3D cpu_post_load, .fields =3D (VMStateField[]) { VMSTATE_UINTTL_ARRAY(env.gpr, RISCVCPU, 32), VMSTATE_UINT64_ARRAY(env.fpr, RISCVCPU, 32), @@ -514,6 +522,9 @@ static const VMStateDescription vmstate_riscv_cpu =3D { VMSTATE_UINTTL(env.sbadaddr, RISCVCPU), VMSTATE_UINTTL(env.mip, RISCVCPU), VMSTATE_UINTTL(env.satp, RISCVCPU), + VMSTATE_UINT64(env.kvm_timer_time, RISCVCPU), + VMSTATE_UINT64(env.kvm_timer_compare, RISCVCPU), + VMSTATE_UINT64(env.kvm_timer_state, RISCVCPU), VMSTATE_END_OF_LIST() } }; --=20 2.19.1