Some architectures (s390x) need to cleanup after a failed dump to be
able to continue to run the vm. Add a cleanup function pointer and
call it if it's set.
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
dump/dump.c | 5 +++++
include/sysemu/dump-arch.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/dump/dump.c b/dump/dump.c
index 1d38274925..5c4e405ad2 100644
--- a/dump/dump.c
+++ b/dump/dump.c
@@ -96,6 +96,10 @@ uint64_t cpu_to_dump64(DumpState *s, uint64_t val)
static int dump_cleanup(DumpState *s)
{
+ if (s->dump_info.arch_cleanup_fn) {
+ s->dump_info.arch_cleanup_fn(s);
+ }
+
guest_phys_blocks_free(&s->guest_phys_blocks);
memory_mapping_list_free(&s->list);
close(s->fd);
@@ -1709,6 +1713,7 @@ static void dump_state_prepare(DumpState *s)
s->dump_info.arch_sections_add_fn = NULL;
s->dump_info.arch_sections_write_hdr_fn = NULL;
s->dump_info.arch_sections_write_fn = NULL;
+ s->dump_info.arch_cleanup_fn = NULL;
}
bool qemu_system_dump_in_progress(void)
diff --git a/include/sysemu/dump-arch.h b/include/sysemu/dump-arch.h
index 59bbc9be38..743916e46c 100644
--- a/include/sysemu/dump-arch.h
+++ b/include/sysemu/dump-arch.h
@@ -24,6 +24,7 @@ typedef struct ArchDumpInfo {
void (*arch_sections_add_fn)(DumpState *s);
uint64_t (*arch_sections_write_hdr_fn)(DumpState *s, uint8_t *buff);
int (*arch_sections_write_fn)(DumpState *s, uint8_t *buff);
+ void (*arch_cleanup_fn)(DumpState *s);
} ArchDumpInfo;
struct GuestPhysBlockList; /* memory_mapping.h */
--
2.34.1