diff options
author | Bibo Mao <maobibo@loongson.cn> | 2024-11-08 15:42:05 +0800 |
---|---|---|
committer | Bibo Mao <maobibo@loongson.cn> | 2024-12-19 15:23:30 +0800 |
commit | ff09444a88af9f5d55b9e315aa16d3ace1f25211 (patch) | |
tree | 5abe13bf4fe12844555f1b479ced99e7610b91e3 | |
parent | 272c467a48815e77db89b69dcd251b9f5b22203e (diff) | |
download | qemu-ff09444a88af9f5d55b9e315aa16d3ace1f25211.zip qemu-ff09444a88af9f5d55b9e315aa16d3ace1f25211.tar.gz qemu-ff09444a88af9f5d55b9e315aa16d3ace1f25211.tar.bz2 |
hw/intc/loongarch_extioi: Add pre_save interface
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>
-rw-r--r-- | hw/intc/loongarch_extioi_common.c | 13 | ||||
-rw-r--r-- | include/hw/intc/loongarch_extioi_common.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/hw/intc/loongarch_extioi_common.c b/hw/intc/loongarch_extioi_common.c index 428d105..e50431f 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 d45caa4..f6bc778 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 */ |