qemu-riscv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 2/5] migration: Add 64bit variable array data type


From: Atish Patra
Subject: [PATCH v2 2/5] migration: Add 64bit variable array data type
Date: Tue, 26 Apr 2022 16:08:51 -0700

unsigned 64bit variable array data type support is missing.
Add the required code to support it.

Signed-off-by: Atish Patra <atishp@rivosinc.com>
---
 include/migration/vmstate.h | 11 +++++++++++
 migration/vmstate.c         |  2 ++
 2 files changed, 13 insertions(+)

diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index ad24aa193451..d289caea0143 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -147,6 +147,7 @@ enum VMStateFlags {
      * VMStateField.struct_version_id to tell which version of the
      * structure we are referencing to use. */
     VMS_VSTRUCT           = 0x8000,
+    VMS_VARRAY_UINT64     = 0x10000,
 };
 
 typedef enum {
@@ -428,6 +429,16 @@ extern const VMStateInfo vmstate_info_qlist;
     .offset     = vmstate_offset_pointer(_state, _field, _type),     \
 }
 
+#define VMSTATE_VARRAY_UINT64(_field, _state, _field_num, _version, _info, 
_type) {\
+    .name       = (stringify(_field)),                               \
+    .version_id = (_version),                                        \
+    .num_offset = vmstate_offset_value(_state, _field_num, uint32_t),\
+    .info       = &(_info),                                          \
+    .size       = sizeof(_type),                                     \
+    .flags      = VMS_VARRAY_UINT64 | VMS_POINTER,                   \
+    .offset     = vmstate_offset_pointer(_state, _field, _type),     \
+}
+
 #define VMSTATE_VARRAY_UINT16_ALLOC(_field, _state, _field_num, _version, 
_info, _type) {\
     .name       = (stringify(_field)),                               \
     .version_id = (_version),                                        \
diff --git a/migration/vmstate.c b/migration/vmstate.c
index 36ae8b9e1918..3cd5e37ebe2d 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -35,6 +35,8 @@ static int vmstate_n_elems(void *opaque, const VMStateField 
*field)
         n_elems = *(int32_t *)(opaque + field->num_offset);
     } else if (field->flags & VMS_VARRAY_UINT32) {
         n_elems = *(uint32_t *)(opaque + field->num_offset);
+    } else if (field->flags & VMS_VARRAY_UINT64) {
+        n_elems = *(uint64_t *)(opaque + field->num_offset);
     } else if (field->flags & VMS_VARRAY_UINT16) {
         n_elems = *(uint16_t *)(opaque + field->num_offset);
     } else if (field->flags & VMS_VARRAY_UINT8) {
-- 
2.25.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]