Now that all targets implement this interface, we can replace the
cpu_get_dump_info() call with the new interface. We still pick the
first_cpu, which will have to be adapted when we introduce heterogeneous
emulation.

Signed-off-by: Pierrick Bouvier <[email protected]>
---
 dump/dump.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/dump/dump.c b/dump/dump.c
index 52be7258a5d..e43e41838fa 100644
--- a/dump/dump.c
+++ b/dump/dump.c
@@ -32,6 +32,7 @@
 #include "migration/blocker.h"
 #include "migration/misc.h"
 #include "hw/core/cpu.h"
+#include "hw/core/sysemu-cpu-ops.h"
 #include "win_dump.h"
 #include "qemu/range.h"
 
@@ -1793,7 +1794,6 @@ static void dump_init(DumpState *s, int fd, bool 
has_format,
     VMCoreInfoState *vmci = vmcoreinfo_find();
     CPUState *cpu;
     int nr_cpus;
-    int ret;
 
     s->has_format = has_format;
     s->format = format;
@@ -1852,12 +1852,16 @@ static void dump_init(DumpState *s, int fd, bool 
has_format,
         goto cleanup;
     }
 
-    /* get dump info: endian, class and architecture.
-     * If the target architecture is not supported, cpu_get_dump_info() will
-     * return -1.
+    /*
+     * get dump info: endian, class and architecture.
+     * If the cpu does not support dumping this information, get_dump_info
+     * returns -1.
      */
-    ret = cpu_get_dump_info(&s->dump_info, &s->guest_phys_blocks);
-    if (ret < 0) {
+    const SysemuCPUOps *sysemu_ops =
+        first_cpu ? CPU_GET_CLASS(first_cpu)->sysemu_ops : NULL;
+    if (!sysemu_ops || !sysemu_ops->get_dump_info ||
+        sysemu_ops->get_dump_info(first_cpu, &s->dump_info,
+                                  &s->guest_phys_blocks) < 0) {
         error_setg(errp,
                    "dumping guest memory is not supported on this target");
         goto cleanup;
-- 
2.43.0


Reply via email to