[PATCH v2 00/19] multi-target: remove dump functions duplication

Pierrick Bouvier posted 19 patches 1 week, 1 day ago
There is a newer version of this series
dump/dump.c                      | 21 +++++++++++++--------
include/hw/core/sysemu-cpu-ops.h | 14 ++++++++++++++
include/system/dump-arch.h       |  3 ---
stubs/dump.c                     | 27 ---------------------------
stubs/meson.build                |  1 -
target/arm/arch_dump.c           | 18 ++++++------------
target/arm/cpu.c                 |  2 ++
target/arm/internals.h           |  5 +++++
target/i386/arch_dump.c          | 10 ++++++----
target/i386/cpu-internal.h       |  7 +++++++
target/i386/cpu.c                |  2 ++
target/loongarch/arch_dump.c     |  7 ++++---
target/loongarch/cpu.c           |  2 ++
target/loongarch/internals.h     |  7 +++++++
target/ppc/arch_dump.c           | 14 +++++---------
target/ppc/cpu.h                 |  6 +++---
target/ppc/cpu_init.c            |  2 ++
target/ppc/internal.h            |  8 ++++++++
target/riscv/arch_dump.c         | 18 +++++++-----------
target/riscv/cpu.c               |  2 ++
target/riscv/internals.h         |  5 +++++
target/s390x/arch_dump.c         |  7 ++++---
target/s390x/cpu-system.c        |  2 ++
target/s390x/s390x-internal.h    |  6 ++++++
24 files changed, 112 insertions(+), 84 deletions(-)
delete mode 100644 stubs/dump.c
[PATCH v2 00/19] multi-target: remove dump functions duplication
Posted by Pierrick Bouvier 1 week, 1 day ago
This series removes duplication of cpu_get_note_size and cpu_get_dump_info per
target. For this, we define a new set of Dump operations for a given cpu, and
implement it per target.

Existing implementations were using first_cpu, which is what we continue to do.
When we'll work on heterogeneous later, we can revisit this to either forbid a
dump, or perform a dump for each target active.

Based-on: 20261014210526.104215-1-pierrick.bouvier@oss.qualcomm.com
"[PATCH v3 00/12] multi-target: add hexagon"
This base is only needed due to conflicts with current wip, it's not important
for this series implementation.

Pierrick Bouvier (19):
  hw/core/sysemu-cpu-ops: add get_dump_info
  target/arm: implement get_dump_info sysemu op
  target/i386: implement get_dump_info sysemu op
  target/ppc/cpu: constify cpu parameter for
    ppc_interrupts_little_endian
  target/ppc: implement get_dump_info sysemu op
  target/riscv: implement get_dump_info sysemu op
  target/s390x: implement get_dump_info sysemu op
  target/loongarch: implement get_dump_info sysemu op
  dump: use get_dump_info sysemu op
  dump: remove cpu_get_dump_info
  hw/core/sysemu-cpu-ops: add get_note_size
  target/arm: implement get_note_size sysemu op
  target/i386: implement get_note_size sysemu op
  target/ppc: implement get_note_size sysemu op
  target/riscv: implement get_note_size sysemu op
  target/s390x: implement get_note_size sysemu op
  target/loongarch: implement get_note_size sysemu op
  dump: use get_note_size sysemu op
  dump: remove cpu_get_note_size

 dump/dump.c                      | 21 +++++++++++++--------
 include/hw/core/sysemu-cpu-ops.h | 14 ++++++++++++++
 include/system/dump-arch.h       |  3 ---
 stubs/dump.c                     | 27 ---------------------------
 stubs/meson.build                |  1 -
 target/arm/arch_dump.c           | 18 ++++++------------
 target/arm/cpu.c                 |  2 ++
 target/arm/internals.h           |  5 +++++
 target/i386/arch_dump.c          | 10 ++++++----
 target/i386/cpu-internal.h       |  7 +++++++
 target/i386/cpu.c                |  2 ++
 target/loongarch/arch_dump.c     |  7 ++++---
 target/loongarch/cpu.c           |  2 ++
 target/loongarch/internals.h     |  7 +++++++
 target/ppc/arch_dump.c           | 14 +++++---------
 target/ppc/cpu.h                 |  6 +++---
 target/ppc/cpu_init.c            |  2 ++
 target/ppc/internal.h            |  8 ++++++++
 target/riscv/arch_dump.c         | 18 +++++++-----------
 target/riscv/cpu.c               |  2 ++
 target/riscv/internals.h         |  5 +++++
 target/s390x/arch_dump.c         |  7 ++++---
 target/s390x/cpu-system.c        |  2 ++
 target/s390x/s390x-internal.h    |  6 ++++++
 24 files changed, 112 insertions(+), 84 deletions(-)
 delete mode 100644 stubs/dump.c

-- 
2.43.0
Re: [PATCH v2 00/19] multi-target: remove dump functions duplication
Posted by Pierrick Bouvier 1 week, 1 day ago
On 10/15/2026 2:32 PM, Pierrick Bouvier wrote:
> This series removes duplication of cpu_get_note_size and cpu_get_dump_info per
> target. For this, we define a new set of Dump operations for a given cpu, and
> implement it per target.
> 
> Existing implementations were using first_cpu, which is what we continue to do.
> When we'll work on heterogeneous later, we can revisit this to either forbid a
> dump, or perform a dump for each target active.
> 
> Based-on: 20261014210526.104215-1-pierrick.bouvier@oss.qualcomm.com
> "[PATCH v3 00/12] multi-target: add hexagon"
> This base is only needed due to conflicts with current wip, it's not important
> for this series implementation.
>

I forgot to include v2 description:

v2
--

- Add new ops to existing SysEmuOps instead of a new DumpOps.

Regards,
Pierrick
Re: [PATCH v2 00/19] multi-target: remove dump functions duplication
Posted by marcandre.lureau@redhat.com 1 week, 1 day ago
> This series removes duplication of cpu_get_note_size and cpu_get_dump_info per
> target. For this, we define a new set of Dump operations for a given cpu, and
> implement it per target.
> 
> Existing implementations were using first_cpu, which is what we continue to do.
> When we'll work on heterogeneous later, we can revisit this to either forbid a
> dump, or perform a dump for each target active.
> 

lgtm in general, I just left minor notes/question

-- 
Marc-André Lureau <marcandre.lureau@redhat.com>


Re: [PATCH v2 00/19] multi-target: remove dump functions duplication
Posted by Philippe Mathieu-Daudé 1 week, 1 day ago
On 15/10/26 23:32, Pierrick Bouvier wrote:
> This series removes duplication of cpu_get_note_size and cpu_get_dump_info per
> target. For this, we define a new set of Dump operations for a given cpu, and
> implement it per target.
> 
> Existing implementations were using first_cpu, which is what we continue to do.
> When we'll work on heterogeneous later, we can revisit this to either forbid a
> dump, or perform a dump for each target active.

Make sense but this must be documented, in the code, and commits 
description.

Maybe we can self-document adding '#define qemu_heterogeneous() false'
in a core header and asserting !qemu_heterogeneous() in the dump API?
Re: [PATCH v2 00/19] multi-target: remove dump functions duplication
Posted by Pierrick Bouvier 1 week, 1 day ago
On 10/15/26 10:59 PM, Philippe Mathieu-Daudé wrote:
> On 15/10/26 23:32, Pierrick Bouvier wrote:
>> This series removes duplication of cpu_get_note_size and cpu_get_dump_info per
>> target. For this, we define a new set of Dump operations for a given cpu, and
>> implement it per target.
>>
>> Existing implementations were using first_cpu, which is what we continue to do.
>> When we'll work on heterogeneous later, we can revisit this to either forbid a
>> dump, or perform a dump for each target active.
> 
> Make sense but this must be documented, in the code, and commits
> description.
> 
> Maybe we can self-document adding '#define qemu_heterogeneous() false'
> in a core header and asserting !qemu_heterogeneous() in the dump API?

I can add a new function target_heterogenenous in target_info, which 
returns false for now. And add this check in the if for those dump 
operations, saying it's not supported in this case.

What do you think?

Regards,
Pierrick

Re: [PATCH v2 00/19] multi-target: remove dump functions duplication
Posted by Philippe Mathieu-Daudé 1 week, 1 day ago
On 16/10/26 08:42, Pierrick Bouvier wrote:
> On 10/15/26 10:59 PM, Philippe Mathieu-Daudé wrote:
>> On 15/10/26 23:32, Pierrick Bouvier wrote:
>>> This series removes duplication of cpu_get_note_size and 
>>> cpu_get_dump_info per
>>> target. For this, we define a new set of Dump operations for a given 
>>> cpu, and
>>> implement it per target.
>>>
>>> Existing implementations were using first_cpu, which is what we 
>>> continue to do.
>>> When we'll work on heterogeneous later, we can revisit this to either 
>>> forbid a
>>> dump, or perform a dump for each target active.
>>
>> Make sense but this must be documented, in the code, and commits
>> description.
>>
>> Maybe we can self-document adding '#define qemu_heterogeneous() false'
>> in a core header and asserting !qemu_heterogeneous() in the dump API?
> 
> I can add a new function target_heterogenenous in target_info, which 
> returns false for now. And add this check in the if for those dump 
> operations, saying it's not supported in this case.
> 
> What do you think?

Yes please it is cheap and that'd make us safer IMHO.

Re: [PATCH v2 00/19] multi-target: remove dump functions duplication
Posted by Pierrick Bouvier 1 week ago
On 10/16/2026 3:59 AM, Philippe Mathieu-Daudé wrote:
> On 16/10/26 08:42, Pierrick Bouvier wrote:
>> On 10/15/26 10:59 PM, Philippe Mathieu-Daudé wrote:
>>> On 15/10/26 23:32, Pierrick Bouvier wrote:
>>>> This series removes duplication of cpu_get_note_size and
>>>> cpu_get_dump_info per
>>>> target. For this, we define a new set of Dump operations for a given
>>>> cpu, and
>>>> implement it per target.
>>>>
>>>> Existing implementations were using first_cpu, which is what we
>>>> continue to do.
>>>> When we'll work on heterogeneous later, we can revisit this to
>>>> either forbid a
>>>> dump, or perform a dump for each target active.
>>>
>>> Make sense but this must be documented, in the code, and commits
>>> description.
>>>
>>> Maybe we can self-document adding '#define qemu_heterogeneous() false'
>>> in a core header and asserting !qemu_heterogeneous() in the dump API?
>>
>> I can add a new function target_heterogenenous in target_info, which
>> returns false for now. And add this check in the if for those dump
>> operations, saying it's not supported in this case.
>>
>> What do you think?
> 
> Yes please it is cheap and that'd make us safer IMHO.

Ok, I'll add this for v3.

Regards,
Pierrick

Re: [PATCH v2 00/19] multi-target: remove dump functions duplication
Posted by Anton Johansson via qemu development 1 week, 1 day ago
On 15/10/26, Pierrick Bouvier wrote:
> This series removes duplication of cpu_get_note_size and cpu_get_dump_info per
> target. For this, we define a new set of Dump operations for a given cpu, and
> implement it per target.
> 
> Existing implementations were using first_cpu, which is what we continue to do.
> When we'll work on heterogeneous later, we can revisit this to either forbid a
> dump, or perform a dump for each target active.
> 
> Based-on: 20261014210526.104215-1-pierrick.bouvier@oss.qualcomm.com
> "[PATCH v3 00/12] multi-target: add hexagon"
> This base is only needed due to conflicts with current wip, it's not important
> for this series implementation.
> 
> Pierrick Bouvier (19):
>   hw/core/sysemu-cpu-ops: add get_dump_info
>   target/arm: implement get_dump_info sysemu op
>   target/i386: implement get_dump_info sysemu op
>   target/ppc/cpu: constify cpu parameter for
>     ppc_interrupts_little_endian
>   target/ppc: implement get_dump_info sysemu op
>   target/riscv: implement get_dump_info sysemu op
>   target/s390x: implement get_dump_info sysemu op
>   target/loongarch: implement get_dump_info sysemu op
>   dump: use get_dump_info sysemu op
>   dump: remove cpu_get_dump_info
>   hw/core/sysemu-cpu-ops: add get_note_size
>   target/arm: implement get_note_size sysemu op
>   target/i386: implement get_note_size sysemu op
>   target/ppc: implement get_note_size sysemu op
>   target/riscv: implement get_note_size sysemu op
>   target/s390x: implement get_note_size sysemu op
>   target/loongarch: implement get_note_size sysemu op
>   dump: use get_note_size sysemu op
>   dump: remove cpu_get_note_size
> 
>  dump/dump.c                      | 21 +++++++++++++--------
>  include/hw/core/sysemu-cpu-ops.h | 14 ++++++++++++++
>  include/system/dump-arch.h       |  3 ---
>  stubs/dump.c                     | 27 ---------------------------
>  stubs/meson.build                |  1 -
>  target/arm/arch_dump.c           | 18 ++++++------------
>  target/arm/cpu.c                 |  2 ++
>  target/arm/internals.h           |  5 +++++
>  target/i386/arch_dump.c          | 10 ++++++----
>  target/i386/cpu-internal.h       |  7 +++++++
>  target/i386/cpu.c                |  2 ++
>  target/loongarch/arch_dump.c     |  7 ++++---
>  target/loongarch/cpu.c           |  2 ++
>  target/loongarch/internals.h     |  7 +++++++
>  target/ppc/arch_dump.c           | 14 +++++---------
>  target/ppc/cpu.h                 |  6 +++---
>  target/ppc/cpu_init.c            |  2 ++
>  target/ppc/internal.h            |  8 ++++++++
>  target/riscv/arch_dump.c         | 18 +++++++-----------
>  target/riscv/cpu.c               |  2 ++
>  target/riscv/internals.h         |  5 +++++
>  target/s390x/arch_dump.c         |  7 ++++---
>  target/s390x/cpu-system.c        |  2 ++
>  target/s390x/s390x-internal.h    |  6 ++++++
>  24 files changed, 112 insertions(+), 84 deletions(-)
>  delete mode 100644 stubs/dump.c
> 
> -- 
> 2.43.0
> 

Series:

Reviewed-by: Anton Johansson <anjo@rev.ng>
Re: [PATCH v2 00/19] multi-target: remove dump functions duplication
Posted by Pierrick Bouvier 1 week ago
On 10/15/2026 2:32 PM, Pierrick Bouvier wrote:
> This series removes duplication of cpu_get_note_size and cpu_get_dump_info per
> target. For this, we define a new set of Dump operations for a given cpu, and
> implement it per target.
> 
> Existing implementations were using first_cpu, which is what we continue to do.
> When we'll work on heterogeneous later, we can revisit this to either forbid a
> dump, or perform a dump for each target active.
> 
> Based-on: 20261014210526.104215-1-pierrick.bouvier@oss.qualcomm.com
> "[PATCH v3 00/12] multi-target: add hexagon"
> This base is only needed due to conflicts with current wip, it's not important
> for this series implementation.
> 
> Pierrick Bouvier (19):
>   hw/core/sysemu-cpu-ops: add get_dump_info
>   target/arm: implement get_dump_info sysemu op
>   target/i386: implement get_dump_info sysemu op
>   target/ppc/cpu: constify cpu parameter for
>     ppc_interrupts_little_endian
>   target/ppc: implement get_dump_info sysemu op
>   target/riscv: implement get_dump_info sysemu op
>   target/s390x: implement get_dump_info sysemu op
>   target/loongarch: implement get_dump_info sysemu op
>   dump: use get_dump_info sysemu op
>   dump: remove cpu_get_dump_info
>   hw/core/sysemu-cpu-ops: add get_note_size
>   target/arm: implement get_note_size sysemu op
>   target/i386: implement get_note_size sysemu op
>   target/ppc: implement get_note_size sysemu op
>   target/riscv: implement get_note_size sysemu op
>   target/s390x: implement get_note_size sysemu op
>   target/loongarch: implement get_note_size sysemu op
>   dump: use get_note_size sysemu op
>   dump: remove cpu_get_note_size
> 
>  dump/dump.c                      | 21 +++++++++++++--------
>  include/hw/core/sysemu-cpu-ops.h | 14 ++++++++++++++
>  include/system/dump-arch.h       |  3 ---
>  stubs/dump.c                     | 27 ---------------------------
>  stubs/meson.build                |  1 -
>  target/arm/arch_dump.c           | 18 ++++++------------
>  target/arm/cpu.c                 |  2 ++
>  target/arm/internals.h           |  5 +++++
>  target/i386/arch_dump.c          | 10 ++++++----
>  target/i386/cpu-internal.h       |  7 +++++++
>  target/i386/cpu.c                |  2 ++
>  target/loongarch/arch_dump.c     |  7 ++++---
>  target/loongarch/cpu.c           |  2 ++
>  target/loongarch/internals.h     |  7 +++++++
>  target/ppc/arch_dump.c           | 14 +++++---------
>  target/ppc/cpu.h                 |  6 +++---
>  target/ppc/cpu_init.c            |  2 ++
>  target/ppc/internal.h            |  8 ++++++++
>  target/riscv/arch_dump.c         | 18 +++++++-----------
>  target/riscv/cpu.c               |  2 ++
>  target/riscv/internals.h         |  5 +++++
>  target/s390x/arch_dump.c         |  7 ++++---
>  target/s390x/cpu-system.c        |  2 ++
>  target/s390x/s390x-internal.h    |  6 ++++++
>  24 files changed, 112 insertions(+), 84 deletions(-)
>  delete mode 100644 stubs/dump.c
> 

Sent v3, with all changes requested:
https://lore.kernel.org/qemu-devel/20261016181410.191743-1-pierrick.bouvier@oss.qualcomm.com/T/#t

Regards,
Pierrick