[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V1 08/26] migration: vmstate_info_void_ptr
From: |
Steve Sistare |
Subject: |
[PATCH V1 08/26] migration: vmstate_info_void_ptr |
Date: |
Mon, 29 Apr 2024 08:55:17 -0700 |
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 <steven.sistare@oracle.com>
---
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;
/** 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 = vmstate_offset_value(_state, _field, _type), \
}
+#define VMSTATE_SINGLE_TEST_NO_CHECK(_field, _state, _test, \
+ _version, _info, _type) { \
+ .name = (stringify(_field)), \
+ .version_id = (_version), \
+ .field_exists = (_test), \
+ .size = sizeof(_type), \
+ .info = &(_info), \
+ .flags = VMS_SINGLE, \
+ .offset = offsetof(_state, _field) \
+}
+
#define VMSTATE_SINGLE_FULL(_field, _state, _test, _version, _info, \
_type, _err_hint) { \
.name = (stringify(_field)), \
@@ -952,6 +964,9 @@ extern const VMStateInfo vmstate_info_qlist;
#define VMSTATE_UINT64(_f, _s) \
VMSTATE_UINT64_V(_f, _s, 0)
+#define VMSTATE_VOID_PTR(_f, _s) \
+ VMSTATE_SINGLE_TEST_NO_CHECK(_f, _s, NULL, 0, vmstate_info_void_ptr, void
*)
+
#ifdef CONFIG_LINUX
#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 = {
.put = put_uint64,
};
+/* 64 bit pointer */
+
+static int get_void_ptr(QEMUFile *f, void *pv, size_t size,
+ const VMStateField *field)
+{
+ void **v = 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 = pv;
+ qemu_put_be64s(f, (uint64_t *)v);
+ return 0;
+}
+
+const VMStateInfo vmstate_info_void_ptr = {
+ .name = "void_ptr",
+ .get = get_void_ptr,
+ .put = put_void_ptr,
+};
+
static int get_nullptr(QEMUFile *f, void *pv, size_t size,
const VMStateField *field)
--
1.8.3.1
- [PATCH V1 07/26] migration: VMStateId, (continued)
- [PATCH V1 07/26] migration: VMStateId, Steve Sistare, 2024/04/29
- [PATCH V1 25/26] migration: fix mismatched GPAs during cpr-exec, Steve Sistare, 2024/04/29
- [PATCH V1 17/26] machine: memfd-alloc option, Steve Sistare, 2024/04/29
- [PATCH V1 19/26] physmem: preserve ram blocks for cpr, Steve Sistare, 2024/04/29
- [PATCH V1 26/26] migration: only-migratable-modes, Steve Sistare, 2024/04/29
- [PATCH V1 15/26] physmem: hoist host memory allocation, Steve Sistare, 2024/04/29
- [PATCH V1 14/26] physmem: hoist guest_memfd creation, Steve Sistare, 2024/04/29
- [PATCH V1 18/26] migration: cpr-exec-args parameter, Steve Sistare, 2024/04/29
- [PATCH V1 20/26] migration: cpr-exec mode, Steve Sistare, 2024/04/29
- [PATCH V1 13/26] physmem: ram_block_create, Steve Sistare, 2024/04/29
- [PATCH V1 08/26] migration: vmstate_info_void_ptr,
Steve Sistare <=
- [PATCH V1 23/26] migration: misc cpr-exec blockers, Steve Sistare, 2024/04/29
- [PATCH V1 16/26] physmem: set ram block idstr earlier, Steve Sistare, 2024/04/29
- [PATCH V1 21/26] migration: migrate_add_blocker_mode, Steve Sistare, 2024/04/29