[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/10] hw/intc/loongarch_extioi: Add pre_save interface
From: |
Bibo Mao |
Subject: |
[PATCH 09/10] hw/intc/loongarch_extioi: Add pre_save interface |
Date: |
Fri, 20 Sep 2024 17:05:06 +0800 |
Add vmstate pre_save interface, which can be used extioi kvm driver
in future.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
hw/intc/loongarch_extioi_common.c | 13 +++++++++++++
include/hw/intc/loongarch_extioi_common.h | 1 +
2 files changed, 14 insertions(+)
diff --git a/hw/intc/loongarch_extioi_common.c
b/hw/intc/loongarch_extioi_common.c
index af15ec3531..b3cbba81e1 100644
--- a/hw/intc/loongarch_extioi_common.c
+++ b/hw/intc/loongarch_extioi_common.c
@@ -20,6 +20,18 @@ static void loongarch_extioi_common_realize(DeviceState
*dev, Error **errp)
}
}
+static int loongarch_extioi_common_pre_save(void *opaque)
+{
+ LoongArchExtIOICommonState *s = (LoongArchExtIOICommonState *)opaque;
+ LoongArchExtIOICommonClass *lecc = LOONGARCH_EXTIOI_COMMON_GET_CLASS(s);
+
+ if (lecc->pre_save) {
+ return lecc->pre_save(s);
+ }
+
+ return 0;
+}
+
static int loongarch_extioi_common_post_load(void *opaque, int version_id)
{
LoongArchExtIOICommonState *s = (LoongArchExtIOICommonState *)opaque;
@@ -46,6 +58,7 @@ static const VMStateDescription vmstate_loongarch_extioi = {
.name = "loongarch.extioi",
.version_id = 3,
.minimum_version_id = 3,
+ .pre_save = loongarch_extioi_common_pre_save,
.post_load = loongarch_extioi_common_post_load,
.fields = (const VMStateField[]) {
VMSTATE_UINT32_ARRAY(bounce, LoongArchExtIOICommonState,
diff --git a/include/hw/intc/loongarch_extioi_common.h
b/include/hw/intc/loongarch_extioi_common.h
index 91947c81db..c926efaca3 100644
--- a/include/hw/intc/loongarch_extioi_common.h
+++ b/include/hw/intc/loongarch_extioi_common.h
@@ -93,6 +93,7 @@ struct LoongArchExtIOICommonClass {
DeviceRealize parent_realize;
DeviceUnrealize parent_unrealize;
+ int (*pre_save)(void *s);
int (*post_load)(void *s, int version_id);
};
#endif /* LOONGARCH_EXTIOI_H */
--
2.39.3
- [PATCH 00/10] hw/intc/loongarch_extioi: Split into extioi common and extioi, Bibo Mao, 2024/09/20
- [PATCH 06/10] hw/intc/loongarch_extioi: Add unrealize interface, Bibo Mao, 2024/09/20
- [PATCH 02/10] include: Move struct LoongArchExtIOI to header file loongarch_extioi_common, Bibo Mao, 2024/09/20
- [PATCH 04/10] hw/intc/loongarch_extioi: Rename LoongArchExtIOI with LoongArchExtIOICommonState, Bibo Mao, 2024/09/20
- [PATCH 03/10] include: Rename LoongArchExtIOI with LoongArchExtIOICommonState, Bibo Mao, 2024/09/20
- [PATCH 05/10] hw/intc/loongarch_extioi: Add common realize interface, Bibo Mao, 2024/09/20
- [PATCH 08/10] hw/intc/loongarch_extioi: Inherit from loongarch_extioi_common, Bibo Mao, 2024/09/20
- [PATCH 09/10] hw/intc/loongarch_extioi: Add pre_save interface,
Bibo Mao <=
- [PATCH 07/10] hw/intc/loongarch_extioi: Add common file loongarch_extioi_common, Bibo Mao, 2024/09/20
- [PATCH 01/10] include: Add loongarch_extioi_common header file, Bibo Mao, 2024/09/20
- [PATCH 10/10] hw/intc/loongarch_extioi: Code cleanup about loongarch_extioi, Bibo Mao, 2024/09/20