From nobody Sun Sep 28 17:09:56 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=1758011851; cv=none; d=zohomail.com; s=zohoarc; b=RoTJRfIPith/XNZyk+n74gICPZctoopl6PfIOTPe3eu5uXEkscbsXxFfZ5v7KKRZ5U9B2ynWuU8alfjtlL5FN7uSsALreP7XvxwmUsH1JV1D75kqGY7A4EFUrQx3ZPuab/Lbf1lLvMzNxn+UfRtyL2j27DppGFTMbc2lHzsDNWA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758011851; 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=UC925ETHj5lx+f0ed+RTtiAwKmGRX5uiRtxmy/WkUNY=; b=NlOf0F26+l171Frlp2WycTblS8xjkfEysmWtFC0DuP/FRHzhIX/xhz4ovPEoUeMVY88eLVkSZT5Fj3oEhPV4edz29us7kBf2sEIrvodU9J+4DuCnlHh072RUTeLoW2Z74lpP6PDTs5SqtDALrNjmCDXKTjQ+07Wv51wXEEAvrd0= 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 1758011851547354.52269204192794; Tue, 16 Sep 2025 01:37:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uyR9D-0006wi-66; Tue, 16 Sep 2025 04:34:47 -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 1uyR97-0006gp-Lk; Tue, 16 Sep 2025 04:34:41 -0400 Received: from mgamail.intel.com ([198.175.65.10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uyR91-0005zs-Vh; Tue, 16 Sep 2025 04:34:40 -0400 Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2025 01:34:24 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.39]) by orviesa007.jf.intel.com with ESMTP; 16 Sep 2025 01:34:22 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1758011676; x=1789547676; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=p9Y4FxxNCJO8k3rMn0WRG6+uJf08DdF+53l2IzwHTQo=; b=M8u8OdvVA+nJvyRsD79iFeNE1S5B8JtHMA3iWuykN7NPdM9XyU5fP9tN 6fi68lJq4/0pVZ0eILfzmsfgfbXoqc1BltQVw/NAQmQ2DWsjFtp8EO9iO oyAHZJFy1Fn87kTM5jF+DAHlFYfGOuYUA8kngJfD7u0qJeP51mXIhrxDR 5V+Or0RuadBNJufPf6wIgWUrRd8y3ZvhZOyfe07sF254mkRAveBkkc8i5 sFhlK+tfF2rrM6m7K2g2jMTv2Qy7jOuC4RSK0nFM125KUonj8sgKxCN3F WDD8PNHHCD4k/A5fKIpWsGw4Nu/haPQOpymmWqaPbBNGYbzqb/gdeo3FJ w==; X-CSE-ConnectionGUID: tuKjyQamSTe1HoaQo5EYZA== X-CSE-MsgGUID: bqyu53swR2a2NnygreaKEw== X-IronPort-AV: E=McAfee;i="6800,10657,11554"; a="77725189" X-IronPort-AV: E=Sophos;i="6.18,268,1751266800"; d="scan'208";a="77725189" X-CSE-ConnectionGUID: +C3BFFERSXmXLsW/u29JpQ== X-CSE-MsgGUID: R0kZ0Lb5QayhxG8CHs1r9Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,268,1751266800"; d="scan'208";a="174691098" From: Zhao Liu To: Paolo Bonzini , Manos Pitsidianakis Cc: qemu-devel@nongnu.org, qemu-rust@nongnu.org, Zhao Liu Subject: [PATCH 08/12] rust/qdev: Support property info for more common types Date: Tue, 16 Sep 2025 16:55:53 +0800 Message-Id: <20250916085557.2008344-9-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250916085557.2008344-1-zhao1.liu@intel.com> References: <20250916085557.2008344-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=198.175.65.10; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.035, 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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1758011853291116600 Content-Type: text/plain; charset="utf-8" Add a helper macro to implement QDevProp trait for u8/u16/u32/usize/i32 /i64. Signed-off-by: Zhao Liu Reviewed-by: Manos Pitsidianakis --- rust/hw/core/src/qdev.rs | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/rust/hw/core/src/qdev.rs b/rust/hw/core/src/qdev.rs index d887046d8de1..b57dc05ebb0e 100644 --- a/rust/hw/core/src/qdev.rs +++ b/rust/hw/core/src/qdev.rs @@ -134,20 +134,24 @@ pub unsafe trait QDevProp { const BASE_INFO: *const bindings::PropertyInfo; } =20 -/// Use [`bindings::qdev_prop_bool`] for `bool`. -unsafe impl QDevProp for bool { - const BASE_INFO: *const bindings::PropertyInfo =3D addr_of!(bindings::= qdev_prop_bool); -} - -/// Use [`bindings::qdev_prop_uint64`] for `u64`. -unsafe impl QDevProp for u64 { - const BASE_INFO: *const bindings::PropertyInfo =3D addr_of!(bindings::= qdev_prop_uint64); +macro_rules! impl_qdev_prop { + ($type:ty,$info:ident) =3D> { + unsafe impl $crate::qdev::QDevProp for $type { + const BASE_INFO: *const $crate::bindings::PropertyInfo =3D + addr_of!($crate::bindings::$info); + } + }; } =20 -/// Use [`bindings::qdev_prop_chr`] for [`chardev::CharBackend`]. -unsafe impl QDevProp for chardev::CharBackend { - const BASE_INFO: *const bindings::PropertyInfo =3D addr_of!(bindings::= qdev_prop_chr); -} +impl_qdev_prop!(bool, qdev_prop_bool); +impl_qdev_prop!(u8, qdev_prop_uint8); +impl_qdev_prop!(u16, qdev_prop_uint16); +impl_qdev_prop!(u32, qdev_prop_uint32); +impl_qdev_prop!(u64, qdev_prop_uint64); +impl_qdev_prop!(usize, qdev_prop_usize); +impl_qdev_prop!(i32, qdev_prop_int32); +impl_qdev_prop!(i64, qdev_prop_int64); +impl_qdev_prop!(chardev::CharBackend, qdev_prop_chr); =20 /// Trait to define device properties. /// --=20 2.34.1