[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: |
Thu, 19 Dec 2024 16:07:52 +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 428d105f78..e50431f124 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 02/18] include: Move struct LoongArchPCHPIC to loongarch_pic_common header file, (continued)
- [PULL 02/18] include: Move struct LoongArchPCHPIC to loongarch_pic_common header file, Bibo Mao, 2024/12/19
- [PULL 09/18] include: Add loongarch_extioi_common header file, Bibo Mao, 2024/12/19
- [PULL 12/18] hw/intc/loongarch_extioi: Rename LoongArchExtIOI with LoongArchExtIOICommonState, Bibo Mao, 2024/12/19
- [PULL 14/18] hw/intc/loongarch_extioi: Add unrealize interface, Bibo Mao, 2024/12/19
- [PULL 11/18] include: Rename LoongArchExtIOI with LoongArchExtIOICommonState, Bibo Mao, 2024/12/19
- [PULL 13/18] hw/intc/loongarch_extioi: Add common realize interface, Bibo Mao, 2024/12/19
- [PULL 10/18] include: Move struct LoongArchExtIOI to header file loongarch_extioi_common, Bibo Mao, 2024/12/19
- [PULL 15/18] hw/intc/loongarch_extioi: Add common file loongarch_extioi_common, Bibo Mao, 2024/12/19
- Re: [PULL 00/18] loongarch-to-apply queue, Stefan Hajnoczi, 2024/12/20