[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/18] hw/intc/loongarch_extioi: Add pre_save interface
From: |
Bibo Mao |
Subject: |
[PULL 17/18] hw/intc/loongarch_extioi: Add pre_save interface |
Date: |
Mon, 16 Dec 2024 10:06:03 +0800 |
Add vmstate pre_save interface, which can be used extioi kvm driver
in future.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Song Gao <gaosong@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 d45caa45f2..f6bc778a85 100644
--- a/include/hw/intc/loongarch_extioi_common.h
+++ b/include/hw/intc/loongarch_extioi_common.h
@@ -92,6 +92,7 @@ struct LoongArchExtIOICommonClass {
SysBusDeviceClass parent_class;
DeviceRealize parent_realize;
+ int (*pre_save)(void *s);
int (*post_load)(void *s, int version_id);
};
#endif /* LOONGARCH_EXTIOI_H */
--
2.43.5
- [PULL 06/18] hw/intc/loongarch_pch: Inherit from loongarch_pic_common, (continued)
- [PULL 06/18] hw/intc/loongarch_pch: Inherit from loongarch_pic_common, Bibo Mao, 2024/12/15
- [PULL 10/18] include: Move struct LoongArchExtIOI to header file loongarch_extioi_common, Bibo Mao, 2024/12/15
- [PULL 09/18] include: Add loongarch_extioi_common header file, Bibo Mao, 2024/12/15
- [PULL 11/18] include: Rename LoongArchExtIOI with LoongArchExtIOICommonState, Bibo Mao, 2024/12/15
- [PULL 14/18] hw/intc/loongarch_extioi: Add unrealize interface, Bibo Mao, 2024/12/15
- [PULL 12/18] hw/intc/loongarch_extioi: Rename LoongArchExtIOI with LoongArchExtIOICommonState, Bibo Mao, 2024/12/15
- [PULL 13/18] hw/intc/loongarch_extioi: Add common realize interface, Bibo Mao, 2024/12/15
- [PULL 15/18] hw/intc/loongarch_extioi: Add common file loongarch_extioi_common, Bibo Mao, 2024/12/15
- Re: [PULL 00/18] loongarch-to-apply queue, Stefan Hajnoczi, 2024/12/16
- [PULL 00/18] loongarch-to-apply queue, Bibo Mao, 2024/12/19
- [PULL 07/18] hw/intc/loongarch_pch: Add pre_save and post_load interfaces, Bibo Mao, 2024/12/19
- [PULL 01/18] include: Add loongarch_pic_common header file, Bibo Mao, 2024/12/19
- [PULL 05/18] hw/intc/loongarch_pch: Move some functions to file loongarch_pic_common, Bibo Mao, 2024/12/19
- [PULL 06/18] hw/intc/loongarch_pch: Inherit from loongarch_pic_common, Bibo Mao, 2024/12/19
- [PULL 08/18] hw/intc/loongarch_pch: Code cleanup about loongarch_pch_pic, Bibo Mao, 2024/12/19
- [PULL 04/18] hw/intc/loongarch_pch: Rename LoongArchPCHPIC with LoongArchPICCommonState, Bibo Mao, 2024/12/19
- [PULL 03/18] hw/intc/loongarch_pch: Merge instance_init() into realize(), Bibo Mao, 2024/12/19