[PATCH for-8.0 00/19] Convert most CPU classes to 3-phase reset

Peter Maydell posted 19 patches 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20221124115023.2437291-1-peter.maydell@linaro.org
Maintainers: Peter Maydell <peter.maydell@linaro.org>, Michael Rolnik <mrolnik@gmail.com>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Taylor Simpson <tsimpson@quicinc.com>, Song Gao <gaosong@loongson.cn>, Xiaojuan Yang <yangxiaojuan@loongson.cn>, Laurent Vivier <laurent@vivier.eu>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Aurelien Jarno <aurelien@aurel32.net>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, Chris Wulff <crwulff@gmail.com>, Marek Vasut <marex@denx.de>, Stafford Horne <shorne@gmail.com>, Daniel Henrique Barboza <danielhb413@gmail.com>, "Cédric Le Goater" <clg@kaod.org>, David Gibson <david@gibson.dropbear.id.au>, Greg Kurz <groug@kaod.org>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Bin Meng <bin.meng@windriver.com>, Yoshinori Sato <ysato@users.sourceforge.jp>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>, Bastian Koppelmann <kbastian@mail.uni-paderborn.de>, Max Filippov <jcmvbkbc@gmail.com>
target/arm/cpu-qom.h        |  4 ++--
target/avr/cpu-qom.h        |  4 ++--
target/cris/cpu-qom.h       |  4 ++--
target/hexagon/cpu.h        |  2 +-
target/i386/cpu-qom.h       |  4 ++--
target/loongarch/cpu.h      |  4 ++--
target/m68k/cpu-qom.h       |  4 ++--
target/microblaze/cpu-qom.h |  4 ++--
target/mips/cpu-qom.h       |  4 ++--
target/nios2/cpu.h          |  4 ++--
target/openrisc/cpu.h       |  4 ++--
target/ppc/cpu-qom.h        |  4 ++--
target/riscv/cpu.h          |  4 ++--
target/rx/cpu-qom.h         |  4 ++--
target/sh4/cpu-qom.h        |  4 ++--
target/sparc/cpu-qom.h      |  4 ++--
target/tricore/cpu-qom.h    |  2 +-
target/xtensa/cpu-qom.h     |  4 ++--
hw/core/cpu-common.c        |  7 ++++---
target/arm/cpu.c            | 13 +++++++++----
target/avr/cpu.c            | 13 +++++++++----
target/cris/cpu.c           | 12 ++++++++----
target/hexagon/cpu.c        | 12 ++++++++----
target/i386/cpu.c           | 12 ++++++++----
target/loongarch/cpu.c      | 12 ++++++++----
target/m68k/cpu.c           | 12 ++++++++----
target/microblaze/cpu.c     | 12 ++++++++----
target/mips/cpu.c           | 12 ++++++++----
target/nios2/cpu.c          | 12 ++++++++----
target/openrisc/cpu.c       | 12 ++++++++----
target/ppc/cpu_init.c       | 12 ++++++++----
target/riscv/cpu.c          | 12 ++++++++----
target/rx/cpu.c             | 13 ++++++++-----
target/sh4/cpu.c            | 12 ++++++++----
target/sparc/cpu.c          | 12 ++++++++----
target/tricore/cpu.c        | 12 ++++++++----
target/xtensa/cpu.c         | 12 ++++++++----
37 files changed, 184 insertions(+), 110 deletions(-)
[PATCH for-8.0 00/19] Convert most CPU classes to 3-phase reset
Posted by Peter Maydell 2 weeks ago
This patchset converts the TYPE_CPU base class and most subclasses
to use 3-phase reset. (The exception is s390, which is doing
something a bit odd with its reset, so the conversion there isn't
going to be simple like these others. So I'll do that one
separately.)

The rationale here is that we should be able to get rid of
all the remaining uses of device_class_set_parent_reset()
and remove/simplify some of the transitional code that's
currently bridging between "legacy" reset and 3-phase reset.

NB: even with this series, it's not possible to usefully do
anything requiring 3-phase reset of a CPU yet, because all
CPU objects get ad-hoc reset by some code somewhere doing
a cpu_reset() call on them, which will just do all 3 phases
in order. I would like to try to address that eventually,
but it's not trivial.

thanks
-- PMM

Peter Maydell (19):
  hw/core/cpu-common: Convert TYPE_CPU class to 3-phase reset
  target/arm: Convert to 3-phase reset
  target/avr: Convert to 3-phase reset
  target/cris: Convert to 3-phase reset
  target/hexagon: Convert to 3-phase reset
  target/i386: Convert to 3-phase reset
  target/loongarch: Convert to 3-phase reset
  target/m68k: Convert to 3-phase reset
  target/microblaze: Convert to 3-phase reset
  target/mips: Convert to 3-phase reset
  target/nios2: Convert to 3-phase reset
  target/openrisc: Convert to 3-phase reset
  target/ppc: Convert to 3-phase reset
  target/riscv: Convert to 3-phase reset
  target/rx: Convert to 3-phase reset
  target/sh4: Convert to 3-phase reset
  target/sparc: Convert to 3-phase reset
  target/tricore: Convert to 3-phase reset
  target/xtensa: Convert to 3-phase reset

 target/arm/cpu-qom.h        |  4 ++--
 target/avr/cpu-qom.h        |  4 ++--
 target/cris/cpu-qom.h       |  4 ++--
 target/hexagon/cpu.h        |  2 +-
 target/i386/cpu-qom.h       |  4 ++--
 target/loongarch/cpu.h      |  4 ++--
 target/m68k/cpu-qom.h       |  4 ++--
 target/microblaze/cpu-qom.h |  4 ++--
 target/mips/cpu-qom.h       |  4 ++--
 target/nios2/cpu.h          |  4 ++--
 target/openrisc/cpu.h       |  4 ++--
 target/ppc/cpu-qom.h        |  4 ++--
 target/riscv/cpu.h          |  4 ++--
 target/rx/cpu-qom.h         |  4 ++--
 target/sh4/cpu-qom.h        |  4 ++--
 target/sparc/cpu-qom.h      |  4 ++--
 target/tricore/cpu-qom.h    |  2 +-
 target/xtensa/cpu-qom.h     |  4 ++--
 hw/core/cpu-common.c        |  7 ++++---
 target/arm/cpu.c            | 13 +++++++++----
 target/avr/cpu.c            | 13 +++++++++----
 target/cris/cpu.c           | 12 ++++++++----
 target/hexagon/cpu.c        | 12 ++++++++----
 target/i386/cpu.c           | 12 ++++++++----
 target/loongarch/cpu.c      | 12 ++++++++----
 target/m68k/cpu.c           | 12 ++++++++----
 target/microblaze/cpu.c     | 12 ++++++++----
 target/mips/cpu.c           | 12 ++++++++----
 target/nios2/cpu.c          | 12 ++++++++----
 target/openrisc/cpu.c       | 12 ++++++++----
 target/ppc/cpu_init.c       | 12 ++++++++----
 target/riscv/cpu.c          | 12 ++++++++----
 target/rx/cpu.c             | 13 ++++++++-----
 target/sh4/cpu.c            | 12 ++++++++----
 target/sparc/cpu.c          | 12 ++++++++----
 target/tricore/cpu.c        | 12 ++++++++----
 target/xtensa/cpu.c         | 12 ++++++++----
 37 files changed, 184 insertions(+), 110 deletions(-)

-- 
2.25.1
Re: [PATCH for-8.0 00/19] Convert most CPU classes to 3-phase reset
Posted by Philippe Mathieu-Daudé 2 weeks ago
On 24/11/22 12:50, Peter Maydell wrote:
> This patchset converts the TYPE_CPU base class and most subclasses
> to use 3-phase reset. (The exception is s390, which is doing
> something a bit odd with its reset, so the conversion there isn't
> going to be simple like these others. So I'll do that one
> separately.)
> 
> The rationale here is that we should be able to get rid of
> all the remaining uses of device_class_set_parent_reset()
> and remove/simplify some of the transitional code that's
> currently bridging between "legacy" reset and 3-phase reset.
> 
> NB: even with this series, it's not possible to usefully do
> anything requiring 3-phase reset of a CPU yet, because all
> CPU objects get ad-hoc reset by some code somewhere doing
> a cpu_reset() call on them, which will just do all 3 phases
> in order. I would like to try to address that eventually,
> but it's not trivial.
> 
> thanks
> -- PMM
> 
> Peter Maydell (19):
>    hw/core/cpu-common: Convert TYPE_CPU class to 3-phase reset
>    target/arm: Convert to 3-phase reset
>    target/avr: Convert to 3-phase reset
>    target/cris: Convert to 3-phase reset
>    target/hexagon: Convert to 3-phase reset
>    target/i386: Convert to 3-phase reset
>    target/loongarch: Convert to 3-phase reset
>    target/m68k: Convert to 3-phase reset
>    target/microblaze: Convert to 3-phase reset
>    target/mips: Convert to 3-phase reset
>    target/nios2: Convert to 3-phase reset
>    target/openrisc: Convert to 3-phase reset
>    target/ppc: Convert to 3-phase reset
>    target/riscv: Convert to 3-phase reset
>    target/rx: Convert to 3-phase reset
>    target/sh4: Convert to 3-phase reset
>    target/sparc: Convert to 3-phase reset
>    target/tricore: Convert to 3-phase reset
>    target/xtensa: Convert to 3-phase reset

Series:
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>


Re: [PATCH for-8.0 00/19] Convert most CPU classes to 3-phase reset
Posted by Philippe Mathieu-Daudé 1 week, 1 day ago
On 24/11/22 14:46, Philippe Mathieu-Daudé wrote:
> On 24/11/22 12:50, Peter Maydell wrote:
>> This patchset converts the TYPE_CPU base class and most subclasses
>> to use 3-phase reset. (The exception is s390, which is doing
>> something a bit odd with its reset, so the conversion there isn't
>> going to be simple like these others. So I'll do that one
>> separately.)
Note, we can then remove scripts/coccinelle/cpu-reset.cocci.

Re: [PATCH for-8.0 00/19] Convert most CPU classes to 3-phase reset
Posted by Peter Maydell 1 week, 1 day ago
On Wed, 30 Nov 2022 at 10:51, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> On 24/11/22 14:46, Philippe Mathieu-Daudé wrote:
> > On 24/11/22 12:50, Peter Maydell wrote:
> >> This patchset converts the TYPE_CPU base class and most subclasses
> >> to use 3-phase reset. (The exception is s390, which is doing
> >> something a bit odd with its reset, so the conversion there isn't
> >> going to be simple like these others. So I'll do that one
> >> separately.)
> Note, we can then remove scripts/coccinelle/cpu-reset.cocci.

What's our usual practice for out-of-date conversion coccinelle
scripts? That particular script was "we'll never need this again"
pretty much from the moment it was checked in, because we did
the conversion of all the targets in one go. But it's still
useful in some sense as a "this is an example of how to do
this kind of change with a coccinelle script"...

thanks
-- PMM
Re: [PATCH for-8.0 00/19] Convert most CPU classes to 3-phase reset
Posted by Philippe Mathieu-Daudé 1 week, 1 day ago
On 30/11/22 13:38, Peter Maydell wrote:
> On Wed, 30 Nov 2022 at 10:51, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>
>> On 24/11/22 14:46, Philippe Mathieu-Daudé wrote:
>>> On 24/11/22 12:50, Peter Maydell wrote:
>>>> This patchset converts the TYPE_CPU base class and most subclasses
>>>> to use 3-phase reset. (The exception is s390, which is doing
>>>> something a bit odd with its reset, so the conversion there isn't
>>>> going to be simple like these others. So I'll do that one
>>>> separately.)
>> Note, we can then remove scripts/coccinelle/cpu-reset.cocci.
> 
> What's our usual practice for out-of-date conversion coccinelle
> scripts? That particular script was "we'll never need this again"
> pretty much from the moment it was checked in, because we did
> the conversion of all the targets in one go. But it's still
> useful in some sense as a "this is an example of how to do
> this kind of change with a coccinelle script"...

The pattern I observed last years is:

  (a) If one-shot transformation, log the script in the commit
      description,

  (b) If the script can be used again in the future, commit it
      in scripts/coccinelle/,

  (c) Complex scripts are committed in scripts/coccinelle/ as
      example/reference.

I am fine keeping scripts/coccinelle/cpu-reset.cocci as an
example (c).

Regards,

Phil.

Re: [PATCH for-8.0 00/19] Convert most CPU classes to 3-phase reset
Posted by Richard Henderson 1 week, 5 days ago
On 11/24/22 03:50, Peter Maydell wrote:
> Peter Maydell (19):
>    hw/core/cpu-common: Convert TYPE_CPU class to 3-phase reset
>    target/arm: Convert to 3-phase reset
>    target/avr: Convert to 3-phase reset
>    target/cris: Convert to 3-phase reset
>    target/hexagon: Convert to 3-phase reset
>    target/i386: Convert to 3-phase reset
>    target/loongarch: Convert to 3-phase reset
>    target/m68k: Convert to 3-phase reset
>    target/microblaze: Convert to 3-phase reset
>    target/mips: Convert to 3-phase reset
>    target/nios2: Convert to 3-phase reset
>    target/openrisc: Convert to 3-phase reset
>    target/ppc: Convert to 3-phase reset
>    target/riscv: Convert to 3-phase reset
>    target/rx: Convert to 3-phase reset
>    target/sh4: Convert to 3-phase reset
>    target/sparc: Convert to 3-phase reset
>    target/tricore: Convert to 3-phase reset
>    target/xtensa: Convert to 3-phase reset

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~