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

Pierrick Bouvier posted 19 patches 1 month, 1 week ago
Failed in applying to current master (apply log)
There is a newer version of this series
dump/dump.c                    | 21 +++++++++++++--------
include/hw/core/cpu.h          |  6 ++++++
include/hw/core/dump-cpu-ops.h | 31 +++++++++++++++++++++++++++++++
include/system/dump-arch.h     |  3 ---
stubs/dump.c                   | 27 ---------------------------
stubs/meson.build              |  1 -
target/arm/arch_dump.c         | 26 +++++++++++++-------------
target/arm/cpu.c               |  1 +
target/arm/internals.h         |  1 +
target/i386/arch_dump.c        | 18 +++++++++++++-----
target/i386/cpu-internal.h     |  2 ++
target/i386/cpu.c              |  1 +
target/loongarch/arch_dump.c   | 13 ++++++++++---
target/loongarch/cpu.c         |  1 +
target/loongarch/internals.h   |  2 ++
target/ppc/arch_dump.c         | 22 ++++++++++++----------
target/ppc/cpu.h               |  6 +++---
target/ppc/cpu_init.c          |  1 +
target/ppc/internal.h          |  4 ++++
target/riscv/arch_dump.c       | 24 +++++++++++++-----------
target/riscv/cpu.c             |  1 +
target/riscv/internals.h       |  1 +
target/s390x/arch_dump.c       | 13 ++++++++++---
target/s390x/cpu-system.c      |  1 +
target/s390x/s390x-internal.h  |  2 ++
25 files changed, 142 insertions(+), 87 deletions(-)
create mode 100644 include/hw/core/dump-cpu-ops.h
delete mode 100644 stubs/dump.c
[PATCH 00/19] multi-target: remove dump functions duplication
Posted by Pierrick Bouvier 1 month, 1 week 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/cpu: declare dump ops
  target/arm: implement get_dump_info dump op
  target/i386: implement get_dump_info dump op
  target/ppc/cpu: constify cpu parameter for
    ppc_interrupts_little_endian
  target/ppc: implement get_dump_info dump op
  target/riscv: implement get_dump_info dump op
  target/s390x: implement get_dump_info dump op
  target/loongarch: implement get_dump_info dump op
  dump: use get_dump_info cpu dump op
  dump: remove cpu_get_dump_info
  hw/core/cpu: add get_note_size to dump ops
  target/arm: implement get_note_size dump op
  target/i386: implement get_note_size dump op
  target/ppc: implement get_note_size dump op
  target/riscv: implement get_note_size dump op
  target/s390x: implement get_note_size dump op
  target/loongarch: implement get_note_size dump op
  dump: use new dump ops for note size
  dump: remove cpu_get_note_size

 dump/dump.c                    | 21 +++++++++++++--------
 include/hw/core/cpu.h          |  6 ++++++
 include/hw/core/dump-cpu-ops.h | 31 +++++++++++++++++++++++++++++++
 include/system/dump-arch.h     |  3 ---
 stubs/dump.c                   | 27 ---------------------------
 stubs/meson.build              |  1 -
 target/arm/arch_dump.c         | 26 +++++++++++++-------------
 target/arm/cpu.c               |  1 +
 target/arm/internals.h         |  1 +
 target/i386/arch_dump.c        | 18 +++++++++++++-----
 target/i386/cpu-internal.h     |  2 ++
 target/i386/cpu.c              |  1 +
 target/loongarch/arch_dump.c   | 13 ++++++++++---
 target/loongarch/cpu.c         |  1 +
 target/loongarch/internals.h   |  2 ++
 target/ppc/arch_dump.c         | 22 ++++++++++++----------
 target/ppc/cpu.h               |  6 +++---
 target/ppc/cpu_init.c          |  1 +
 target/ppc/internal.h          |  4 ++++
 target/riscv/arch_dump.c       | 24 +++++++++++++-----------
 target/riscv/cpu.c             |  1 +
 target/riscv/internals.h       |  1 +
 target/s390x/arch_dump.c       | 13 ++++++++++---
 target/s390x/cpu-system.c      |  1 +
 target/s390x/s390x-internal.h  |  2 ++
 25 files changed, 142 insertions(+), 87 deletions(-)
 create mode 100644 include/hw/core/dump-cpu-ops.h
 delete mode 100644 stubs/dump.c

-- 
2.43.0
Re: [PATCH 00/19] multi-target: remove dump functions duplication
Posted by Anton Johansson via qemu development 1 month, 1 week 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.

I have a very similar series going locally here

  https://gitlab.com/AntonJohansson/qemu/-/commits/b4/arch-dump

where I added get_dump_info()/get_note_size() to SysemuCPUOps given
that we already have write_elf[32|64]_note() there.  Any reason it would
be preferable to have a new struct of function pointers?

Also I saw some uses of first_cpu in the write_elf[32|64]_note()
functions on i386 at least that we should eliminate.

-- 
Anton Johansson
rev.ng Labs Srl.
Re: [PATCH 00/19] multi-target: remove dump functions duplication
Posted by Pierrick Bouvier 1 month, 1 week ago
On 10/15/2026 2:08 AM, Anton Johansson wrote:
> 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.
> 
> I have a very similar series going locally here
> 
>   https://gitlab.com/AntonJohansson/qemu/-/commits/b4/arch-dump
> 
> where I added get_dump_info()/get_note_size() to SysemuCPUOps given
> that we already have write_elf[32|64]_note() there.  Any reason it would
> be preferable to have a new struct of function pointers?
> 
> Also I saw some uses of first_cpu in the write_elf[32|64]_note()
> functions on i386 at least that we should eliminate.
> 

It didn't cross my mind to be honest, but taking a look, yes it seems
like a good place to hold this. It even has monitor related content
already. I'll respin current series with this.

Thanks,
Pierrick
Re: [PATCH 00/19] multi-target: remove dump functions duplication
Posted by Pierrick Bouvier 1 month, 1 week ago
On 10/15/2026 10:51 AM, Pierrick Bouvier wrote:
> On 10/15/2026 2:08 AM, Anton Johansson wrote:
>> 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.
>>
>> I have a very similar series going locally here
>>
>>   https://gitlab.com/AntonJohansson/qemu/-/commits/b4/arch-dump
>>
>> where I added get_dump_info()/get_note_size() to SysemuCPUOps given
>> that we already have write_elf[32|64]_note() there.  Any reason it would
>> be preferable to have a new struct of function pointers?
>>
>> Also I saw some uses of first_cpu in the write_elf[32|64]_note()
>> functions on i386 at least that we should eliminate.
>>
> 
> It didn't cross my mind to be honest, but taking a look, yes it seems
> like a good place to hold this. It even has monitor related content
> already. I'll respin current series with this.
>

Sent v2:
https://lore.kernel.org/qemu-devel/20261015213236.157767-1-pierrick.bouvier@oss.qualcomm.com/T/#t

Regards,
Pierrick