mirror of
https://gitlab.com/qemu-project/qemu.git
synced 2026-10-28 11:54:41 +08:00
dump: reimplement cpu_get_note_size using get_note_size sysemu op
Now that all targets implement the get_note_size sysemu op, we can replace the per-target cpu_get_note_size() implementations (and its stub) with a single generic version in hw/core/cpu-system.c, taking the cpu as parameter, like other dump related sysemu ops wrappers. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Link: https://lore.kernel.org/qemu-devel/20261021181244.867840-22-pierrick.bouvier@oss.qualcomm.com Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
This commit is contained in:
1 parent
9cf15a3c0d
commit
4ee9f846c3
12 files changed
+23
-55
No files matched your search
+1
-1
@@ -1873,7 +1873,7 @@ static void dump_init(DumpState *s, int fd, bool has_format,
|
||||
s->dump_info.page_size = qemu_target_page_size();
|
||||
}
|
||||
|
||||
s->note_size = cpu_get_note_size(s->dump_info.d_class,
|
||||
s->note_size = cpu_get_note_size(first_cpu, s->dump_info.d_class,
|
||||
s->dump_info.d_machine, nr_cpus);
|
||||
assert(s->note_size >= 0);
|
||||
|
||||
|
||||
@@ -140,6 +140,15 @@ int cpu_get_dump_info(const CPUState *cpu, ArchDumpInfo *info,
|
||||
return 0;
|
||||
}
|
||||
|
||||
ssize_t cpu_get_note_size(const CPUState *cpu, int class, int machine,
|
||||
int nr_cpus)
|
||||
{
|
||||
if (!cpu->cc->sysemu_ops->get_note_size) {
|
||||
return -1;
|
||||
}
|
||||
return cpu->cc->sysemu_ops->get_note_size(cpu, class, machine, nr_cpus);
|
||||
}
|
||||
|
||||
bool cpu_internal_is_big_endian(CPUState *cpu)
|
||||
{
|
||||
if (cpu->cc->sysemu_ops->internal_is_big_endian) {
|
||||
|
||||
@@ -712,6 +712,19 @@ int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
|
||||
int cpu_get_dump_info(const CPUState *cpu, ArchDumpInfo *info,
|
||||
const GuestPhysBlockList *guest_phys_blocks);
|
||||
|
||||
/**
|
||||
* cpu_get_note_size:
|
||||
* @cpu: The CPU whose memory is to be dumped
|
||||
* @class: ELF class reported by cpu_get_dump_info()
|
||||
* @machine: ELF machine reported by cpu_get_dump_info()
|
||||
* @nr_cpus: Number of CPUs to be dumped
|
||||
*
|
||||
* Returns: size of the ELF notes needed to dump @nr_cpus CPUs,
|
||||
* or -1 if not supported.
|
||||
*/
|
||||
ssize_t cpu_get_note_size(const CPUState *cpu, int class, int machine,
|
||||
int nr_cpus);
|
||||
|
||||
/**
|
||||
* cpu_memory_rw_debug:
|
||||
* @cpu: The CPU whose memory is to be accessed
|
||||
|
||||
@@ -27,6 +27,4 @@ struct ArchDumpInfo {
|
||||
void (*arch_cleanup_fn)(DumpState *s);
|
||||
};
|
||||
|
||||
ssize_t cpu_get_note_size(int class, int machine, int nr_cpus);
|
||||
|
||||
#endif
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* QEMU dump
|
||||
*
|
||||
* Copyright Fujitsu, Corp. 2011, 2012
|
||||
*
|
||||
* Authors:
|
||||
* Wen Congyang <wency@cn.fujitsu.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "system/dump-arch.h"
|
||||
|
||||
ssize_t cpu_get_note_size(int class, int machine, int nr_cpus)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,6 @@ if have_system
|
||||
# adding more of these. If the symbol is used in specific_ss,
|
||||
# in particular, consider defining a preprocessor macro via
|
||||
# Kconfig or configs/targets/.
|
||||
stub_ss.add(files('dump.c'))
|
||||
stub_ss.add(files('cmos.c'))
|
||||
stub_ss.add(files('fw_cfg.c'))
|
||||
if igvm.found()
|
||||
|
||||
@@ -451,8 +451,3 @@ size_t arm_get_note_size(const CPUState *cs, int class, int machine,
|
||||
|
||||
return note_size * nr_cpus;
|
||||
}
|
||||
|
||||
ssize_t cpu_get_note_size(int class, int machine, int nr_cpus)
|
||||
{
|
||||
return arm_get_note_size(first_cpu, class, machine, nr_cpus);
|
||||
}
|
||||
@@ -459,8 +459,3 @@ size_t x86_get_note_size(const CPUState *cs, int class, int machine,
|
||||
|
||||
return (elf_note_size + qemu_note_size) * nr_cpus;
|
||||
}
|
||||
|
||||
ssize_t cpu_get_note_size(int class, int machine, int nr_cpus)
|
||||
{
|
||||
return x86_get_note_size(first_cpu, class, machine, nr_cpus);
|
||||
}
|
||||
@@ -161,8 +161,3 @@ size_t loongarch_get_note_size(const CPUState *cs, int class,
|
||||
|
||||
return note_size * nr_cpus;
|
||||
}
|
||||
|
||||
ssize_t cpu_get_note_size(int class, int machine, int nr_cpus)
|
||||
{
|
||||
return loongarch_get_note_size(first_cpu, class, machine, nr_cpus);
|
||||
}
|
||||
@@ -267,11 +267,6 @@ size_t ppc_get_note_size(const CPUState *cs, int class, int machine,
|
||||
return (elf_note_size) * nr_cpus;
|
||||
}
|
||||
|
||||
ssize_t cpu_get_note_size(int class, int machine, int nr_cpus)
|
||||
{
|
||||
return ppc_get_note_size(first_cpu, class, machine, nr_cpus);
|
||||
}
|
||||
|
||||
static int ppc_write_all_elf_notes(const char *note_name,
|
||||
WriteCoreDumpFunction f,
|
||||
PowerPCCPU *cpu, int id,
|
||||
|
||||
@@ -193,8 +193,3 @@ size_t riscv_get_note_size(const CPUState *cs, int class, int machine,
|
||||
|
||||
return note_size * nr_cpus;
|
||||
}
|
||||
|
||||
ssize_t cpu_get_note_size(int class, int machine, int nr_cpus)
|
||||
{
|
||||
return riscv_get_note_size(first_cpu, class, machine, nr_cpus);
|
||||
}
|
||||
@@ -495,8 +495,3 @@ size_t s390_get_note_size(const CPUState *cs, int class, int machine,
|
||||
|
||||
return (elf_note_size) * nr_cpus;
|
||||
}
|
||||
|
||||
ssize_t cpu_get_note_size(int class, int machine, int nr_cpus)
|
||||
{
|
||||
return s390_get_note_size(first_cpu, class, machine, nr_cpus);
|
||||
}
|
||||
Reference in new issue
Block a user