From nobody Wed Feb 11 02:07:30 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=quarantine dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1714406771; cv=none; d=zohomail.com; s=zohoarc; b=WJRfwA3umVthQqdVyUWKhLme7jvilak4kOgl/iuqE8VP93uXO9M85Ki5VliHCHAMoTfbb+6iqyT7c+dpdLU1C0SxBD8zC1/R/tN68oYSvBJAniOTphGk5+bUGEJxo2AA+jeXgDmEcAwHeTCmyQ4gIb+15VZorwdsXmwj56gUwM8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714406771; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mfUEBur7xmKrlLkLi6qOQJ8fPpHhzHrrtYVn+a6Puyk=; b=F4uD2U65teJ9VyuLCQKtkt7f7t0y4NsTQBbjopIQHeTtpCGttpCmGVdh8Eoyt6/+WfLQnJZUbgPPsF1BPbMetvAB0osojShwZXgBxlGNm44X4INflUmYbHw706/oLw55xHiXVtyjDCWBCNfsaMFL2GMqhWGloMuYOwyvqFvsO24= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1714406771622568.1519524773527; Mon, 29 Apr 2024 09:06:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1TMV-0004oN-4s; Mon, 29 Apr 2024 11:56:15 -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 1s1TMH-0004Y1-Vi for qemu-devel@nongnu.org; Mon, 29 Apr 2024 11:56:01 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s1TMF-0005FB-Ux for qemu-devel@nongnu.org; Mon, 29 Apr 2024 11:56:01 -0400 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43TFmlZq021746; Mon, 29 Apr 2024 15:55:44 GMT Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xrr54axsu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 29 Apr 2024 15:55:43 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 43TFGqtP011343; Mon, 29 Apr 2024 15:55:42 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3xrqt6j66j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 29 Apr 2024 15:55:42 +0000 Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 43TFtaGi034442; Mon, 29 Apr 2024 15:55:42 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3xrqt6j5ys-9; Mon, 29 Apr 2024 15:55:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-11-20; bh=mfUEBur7xmKrlLkLi6qOQJ8fPpHhzHrrtYVn+a6Puyk=; b=i1ifYD+4Amn7wTHZUK7DSc8ql/ht70BhjC1LRoGFGM9qjco5vJOIkXW6ClJZ3SoFDpYK hPQUUqr1dwA/1WS1J+7ur6OF9/hY+uFVPSGEWnU2aS1jh5BAzvpl27saWew6+23UjuXF pawTTRZQudhu2L0Ftr1B5ucK0xzjEAV3LSv2Dm1AsNk+EHXqwqmDTbNJ3PtUKoEegmbE bjob9sODzDM82woWxubH+DKB+Qya5FPtA8VxBT+QnanCHRCJOlH4rZItdpJ5ImyCvvm6 +TFRJTX9ukQGpA1h/VJi49idWxqOqoImL3LiQAAmu7s4+2GoJU8IAZuWKLuIP0egFKMs IA== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , David Hildenbrand , Igor Mammedov , Eduardo Habkost , Marcel Apfelbaum , Philippe Mathieu-Daude , Paolo Bonzini , "Daniel P. Berrange" , Markus Armbruster , Steve Sistare Subject: [PATCH V1 08/26] migration: vmstate_info_void_ptr Date: Mon, 29 Apr 2024 08:55:17 -0700 Message-Id: <1714406135-451286-9-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1714406135-451286-1-git-send-email-steven.sistare@oracle.com> References: <1714406135-451286-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-04-29_14,2024-04-29_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 adultscore=0 mlxscore=0 suspectscore=0 phishscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404290101 X-Proofpoint-ORIG-GUID: DVn4SmJXNGnbMp5mluxbY-_8LL3x95ta X-Proofpoint-GUID: DVn4SmJXNGnbMp5mluxbY-_8LL3x95ta 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=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=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 @oracle.com) X-ZM-MESSAGEID: 1714406771869100003 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Define VMSTATE_VOID_PTR so the value of a pointer (but not its target) can be saved in the migration stream. This will be needed for CPR. Signed-off-by: Steve Sistare Reviewed-by: Fabiano Rosas --- include/migration/vmstate.h | 15 +++++++++++++++ migration/vmstate-types.c | 24 ++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index a39c0e6..bb885d9 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -236,6 +236,7 @@ extern const VMStateInfo vmstate_info_uint8; extern const VMStateInfo vmstate_info_uint16; extern const VMStateInfo vmstate_info_uint32; extern const VMStateInfo vmstate_info_uint64; +extern const VMStateInfo vmstate_info_void_ptr; =20 /** Put this in the stream when migrating a null pointer.*/ #define VMS_NULLPTR_MARKER (0x30U) /* '0' */ @@ -326,6 +327,17 @@ extern const VMStateInfo vmstate_info_qlist; .offset =3D vmstate_offset_value(_state, _field, _type), \ } =20 +#define VMSTATE_SINGLE_TEST_NO_CHECK(_field, _state, _test, \ + _version, _info, _type) { \ + .name =3D (stringify(_field)), \ + .version_id =3D (_version), \ + .field_exists =3D (_test), \ + .size =3D sizeof(_type), \ + .info =3D &(_info), \ + .flags =3D VMS_SINGLE, \ + .offset =3D offsetof(_state, _field) \ +} + #define VMSTATE_SINGLE_FULL(_field, _state, _test, _version, _info, \ _type, _err_hint) { \ .name =3D (stringify(_field)), \ @@ -952,6 +964,9 @@ extern const VMStateInfo vmstate_info_qlist; #define VMSTATE_UINT64(_f, _s) \ VMSTATE_UINT64_V(_f, _s, 0) =20 +#define VMSTATE_VOID_PTR(_f, _s) \ + VMSTATE_SINGLE_TEST_NO_CHECK(_f, _s, NULL, 0, vmstate_info_void_ptr, v= oid *) + #ifdef CONFIG_LINUX =20 #define VMSTATE_U8(_f, _s) \ diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c index e83bfcc..097ecad 100644 --- a/migration/vmstate-types.c +++ b/migration/vmstate-types.c @@ -314,6 +314,30 @@ const VMStateInfo vmstate_info_uint64 =3D { .put =3D put_uint64, }; =20 +/* 64 bit pointer */ + +static int get_void_ptr(QEMUFile *f, void *pv, size_t size, + const VMStateField *field) +{ + void **v =3D pv; + qemu_get_be64s(f, (uint64_t *)v); + return 0; +} + +static int put_void_ptr(QEMUFile *f, void *pv, size_t size, + const VMStateField *field, JSONWriter *vmdesc) +{ + void **v =3D pv; + qemu_put_be64s(f, (uint64_t *)v); + return 0; +} + +const VMStateInfo vmstate_info_void_ptr =3D { + .name =3D "void_ptr", + .get =3D get_void_ptr, + .put =3D put_void_ptr, +}; + static int get_nullptr(QEMUFile *f, void *pv, size_t size, const VMStateField *field) =20 --=20 1.8.3.1