From nobody Fri Apr 4 05:12:01 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.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; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1742223727; cv=none; d=zohomail.com; s=zohoarc; b=R5drdbni2y0d9NA/q8f/sBjJX5tYWAqGyIzgVPtulJyf+AYP1gWYAA7/hoUtJd23Yr63W3f4J2fMcimOz8bL32XHQ7m5egeVHjNLYxkUxbhhjGUGY4xvs6Leku5GuXbHp6zrGqfTHtd1+Dw7z2i3x1UGsDr6enw6Tbk2S8V5uA0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742223727; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jtw7uagsbqBzcDMOS+/uRxp5WCkGUgyPfAu8yE+OALg=; b=PTeSNF73E1YHXMOJFASklYrvAX8gugw8QPRsWKpiZa90/4g383l6Mkg7v/RlH23AKhAALcqTC3wtQmfzZMakrOIEqOO834b0az5ZJ/t6QTkBqdYmVZecR3fxN89hp+8vmUF6LH/3Ttj15jNacOBcnd6sfEHjnoRH3KA2jr3qGQY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742223727489718.0687323759349; Mon, 17 Mar 2025 08:02:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuBqd-0005Eg-7g; Mon, 17 Mar 2025 10:53:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuBq6-00051x-RD; Mon, 17 Mar 2025 10:53:15 -0400 Received: from mgamail.intel.com ([192.198.163.10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuBq3-00061x-C4; Mon, 17 Mar 2025 10:53:13 -0400 Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2025 07:52:42 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.39]) by orviesa004.jf.intel.com with ESMTP; 17 Mar 2025 07:52:41 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1742223191; x=1773759191; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ww3hkZiQiqJ1KeYMe4dC+I1LJZe0UZlFqW2pOLJh9fY=; b=gHFKA35bBUSa3rVrF+RDG2z2A+URC431fUM5buD5Uao07ujivhWviiW6 PBZrpT5OyCQ7ZyRTchL4qePmb08hOkGlp1K2ka0c3TTxJUwmAlC/xyjg3 xPF3wF4jxiweucOCLZsQQjj7XzCp8mo/QAkLTcdr5Wgq3YOK5XGZ4ChtM J9ehSkDmF0brXGbXf3EskWNfJ35D81KlfjmnVrT4tIyXubEsnTAFMa/Vc HLvz7yBstfhZ2lCQQwbjMlWG0ec5z0M6pactlj8V4srhY3A5Pg/A8yBAc EWqfZ/QmZbNHpMlHNOjiFaXE/5UmrH7+BLZNneDcNppyHce5+u3Zuj8Jx Q==; X-CSE-ConnectionGUID: LhG7ibZZS1CJx7H2BaKfmQ== X-CSE-MsgGUID: bh2T7u58QQSB6/3ew9pA+A== X-IronPort-AV: E=McAfee;i="6700,10204,11376"; a="54694622" X-IronPort-AV: E=Sophos;i="6.14,254,1736841600"; d="scan'208";a="54694622" X-CSE-ConnectionGUID: M3vgR3RnRM6+HtKJ3LCEmQ== X-CSE-MsgGUID: wCOi86+ETnOs5YoT2nrJqQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,254,1736841600"; d="scan'208";a="126988535" From: Zhao Liu To: Paolo Bonzini Cc: qemu-devel@nongnu.org, qemu-rust@nongnu.org, Zhao Liu Subject: [PATCH 11/17] rust/vmstate: Re-implement VMState trait for timer binding Date: Mon, 17 Mar 2025 23:12:30 +0800 Message-Id: <20250317151236.536673-12-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250317151236.536673-1-zhao1.liu@intel.com> References: <20250317151236.536673-1-zhao1.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=192.198.163.10; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.335, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1742223729726019100 Content-Type: text/plain; charset="utf-8" At present, Rust side has a timer binding "timer::Timer", so the vmstate for timer should base on that binding instead of the raw "binding::QEMUTimer". It's possible to apply impl_vmstate_transparent for cell::Opaque and then impl_vmstate_forward for timer::Timer. But binding::QEMUTimer shouldn't be used directly, so that vmstate for such raw timer type is useless. Thus, apply impl_vmstate_scalar for timer::Timer. And since Opaque<> is useful, apply impl_vmstate_transparent for cell::Opaque as well. Signed-off-by: Zhao Liu --- rust/qemu-api/src/vmstate.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/rust/qemu-api/src/vmstate.rs b/rust/qemu-api/src/vmstate.rs index 806d531b0c37..3d4c50ca86f9 100644 --- a/rust/qemu-api/src/vmstate.rs +++ b/rust/qemu-api/src/vmstate.rs @@ -27,12 +27,7 @@ use core::{marker::PhantomData, mem, ptr::NonNull}; =20 pub use crate::bindings::{VMStateDescription, VMStateField}; -use crate::{ - bindings::{self, VMStateFlags}, - prelude::*, - qom::Owned, - zeroable::Zeroable, -}; +use crate::{bindings::VMStateFlags, prelude::*, qom::Owned, zeroable::Zero= able}; =20 /// This macro is used to call a function with a generic argument bound /// to the type of a field. The function must take a @@ -344,6 +339,7 @@ unsafe impl<$base> VMState for $type where $base: VMSta= te $($where)* { impl_vmstate_transparent!(std::pin::Pin where T: VMState); impl_vmstate_transparent!(crate::cell::BqlCell where T: VMState); impl_vmstate_transparent!(crate::cell::BqlRefCell where T: VMState); +impl_vmstate_transparent!(crate::cell::Opaque where T: VMState); =20 #[macro_export] macro_rules! impl_vmstate_bitsized { @@ -390,7 +386,7 @@ unsafe impl VMState for $type { impl_vmstate_scalar!(vmstate_info_uint16, u16, VMS_VARRAY_UINT16); impl_vmstate_scalar!(vmstate_info_uint32, u32, VMS_VARRAY_UINT32); impl_vmstate_scalar!(vmstate_info_uint64, u64); -impl_vmstate_scalar!(vmstate_info_timer, bindings::QEMUTimer); +impl_vmstate_scalar!(vmstate_info_timer, crate::timer::Timer); =20 // Pointer types using the underlying type's VMState plus VMS_POINTER // Note that references are not supported, though references to cells --=20 2.34.1