[PATCH 00/13] cpus: Constify @cpu in SysemuCPUOps::has_work() handler

Philippe Mathieu-Daudé posted 13 patches 1 day, 10 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260820104730.25462-1-philmd@oss.qualcomm.com
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Philippe Mathieu-Daudé" <philmd@mailo.com>, Zhao Liu <zhao1.liu@intel.com>, Peter Maydell <peter.maydell@linaro.org>, Michael Rolnik <mrolnik@gmail.com>, Brian Cain <brian.cain@oss.qualcomm.com>, Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>, Helge Deller <deller@gmx.de>, Song Gao <17746591750@163.com>, Bibo Mao <maobibo@loongson.cn>, Xianglai Li <lixianglai@loongson.cn>, Laurent Vivier <laurent@vivier.eu>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Aurelien Jarno <aurelien@aurel32.net>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <arikalo@gmail.com>, Stafford Horne <shorne@gmail.com>, Nicholas Piggin <npiggin@gmail.com>, Chinmay Rath <rathc@linux.ibm.com>, Glenn Miles <milesg@linux.ibm.com>, Harsh Prateek Bora <harshpb@linux.ibm.com>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Chao Liu <chao.liu@processmission.com>, Yoshinori Sato <yoshinori.sato@nifty.com>, Ilya Leoshkevich <iii@linux.ibm.com>, David Hildenbrand <david@kernel.org>, Cornelia Huck <cohuck@redhat.com>, Eric Farman <farman@linux.ibm.com>, Matthew Rosato <mjrosato@linux.ibm.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>, Max Filippov <jcmvbkbc@gmail.com>
There is a newer version of this series
include/exec/cpu-common.h        | 11 +++++++++++
include/hw/core/cpu.h            |  6 ++++++
include/hw/core/sysemu-cpu-ops.h |  4 ++--
target/avr/cpu.h                 |  6 +++---
target/hexagon/cpu.h             |  2 +-
target/i386/cpu.h                |  4 ++--
target/loongarch/cpu.h           |  6 +++---
target/loongarch/internals.h     |  4 ++--
target/mips/cpu.h                |  6 +++---
target/mips/internal.h           | 10 +++++-----
target/riscv/cpu.h               | 31 ++++++++++++++++---------------
target/riscv/internals.h         |  2 +-
target/s390x/cpu.h               |  2 +-
target/s390x/s390x-internal.h    | 14 +++++++-------
target/sparc/cpu.h               | 12 ++++++------
target/alpha/cpu.c               |  2 +-
target/arm/cpu.c                 |  4 ++--
target/avr/cpu.c                 |  5 +++--
target/hexagon/cpu.c             |  8 ++++----
target/hppa/cpu.c                |  2 +-
target/i386/cpu.c                |  8 ++++----
target/loongarch/cpu.c           |  6 +++---
target/m68k/cpu.c                |  2 +-
target/microblaze/cpu.c          |  2 +-
target/mips/cpu.c                |  4 ++--
target/or1k/cpu.c                |  2 +-
target/ppc/cpu_init.c            |  2 +-
target/riscv/cpu.c               | 14 +++++++-------
target/rx/cpu.c                  |  2 +-
target/s390x/cpu-system.c        |  2 +-
target/s390x/interrupt.c         | 22 +++++++++++-----------
target/sh4/cpu.c                 |  2 +-
target/sparc/cpu.c               |  4 ++--
target/tricore/cpu.c             |  4 ++--
target/xtensa/cpu.c              |  4 ++--
35 files changed, 120 insertions(+), 101 deletions(-)
[PATCH 00/13] cpus: Constify @cpu in SysemuCPUOps::has_work() handler
Posted by Philippe Mathieu-Daudé 1 day, 10 hours ago
- Patches 1-8 trivially add const qualifier for various
  cpu_is/has() getters
- Patch 9 adds const-qualified variants of cpu_env() and
  env_archcpu(). Not sure if this is a good idea so marked
  as RFC.
- Patches 10-12 complete the cpu_is/has() getters const
  conversion using the new env_archcpu_const() variant
- Patch 13 finally convert the SysemuCPUOps::has_work
  hook and all target implementations.

No functional change; purely const-correctness improvment
to enforce has_work() callees don't mutate CPUState.

Build-tested.

Based-on: <20260819145649.23439-1-philmd@oss.qualcomm.com>
  "Make halt-to-exec transition explicit and remove cpu_exec_halt"

Philippe Mathieu-Daudé (13):
  target/avr: Constify CPUAVRState for some cpu_*() getters
  target/i386: Constify CPU*State for cpu_*_interrupt() getters
  target/loongarch: Constify CPULoongArchState for various cpu_*()
    getters
  target/mips: Constify CPUMIPSState for various cpu_*() getters
  target/s390x: Constify S390CPU for cpu_has_*() getters
  target/riscv: Constify @iprio argument in riscv_cpu_pending_to_irq()
  target/riscv: Constify CPURISCVState for various cpu_*() getters
  target/sparc: Constify CPUSPARCState for various cpu_*() getters
  cpus: Add const-qualified CPU environment accessors
  target/riscv: Constify CPURISCVState for various cpu_*() getters
  target/hexagon: Constify CPUHexagonState in
    hexagon_thread_is_enabled()
  target/mips: Constify CPUMIPSState in mips_vpe_active()
  cpus: Constify @cpu in SysemuCPUOps::has_work() handler

 include/exec/cpu-common.h        | 11 +++++++++++
 include/hw/core/cpu.h            |  6 ++++++
 include/hw/core/sysemu-cpu-ops.h |  4 ++--
 target/avr/cpu.h                 |  6 +++---
 target/hexagon/cpu.h             |  2 +-
 target/i386/cpu.h                |  4 ++--
 target/loongarch/cpu.h           |  6 +++---
 target/loongarch/internals.h     |  4 ++--
 target/mips/cpu.h                |  6 +++---
 target/mips/internal.h           | 10 +++++-----
 target/riscv/cpu.h               | 31 ++++++++++++++++---------------
 target/riscv/internals.h         |  2 +-
 target/s390x/cpu.h               |  2 +-
 target/s390x/s390x-internal.h    | 14 +++++++-------
 target/sparc/cpu.h               | 12 ++++++------
 target/alpha/cpu.c               |  2 +-
 target/arm/cpu.c                 |  4 ++--
 target/avr/cpu.c                 |  5 +++--
 target/hexagon/cpu.c             |  8 ++++----
 target/hppa/cpu.c                |  2 +-
 target/i386/cpu.c                |  8 ++++----
 target/loongarch/cpu.c           |  6 +++---
 target/m68k/cpu.c                |  2 +-
 target/microblaze/cpu.c          |  2 +-
 target/mips/cpu.c                |  4 ++--
 target/or1k/cpu.c                |  2 +-
 target/ppc/cpu_init.c            |  2 +-
 target/riscv/cpu.c               | 14 +++++++-------
 target/rx/cpu.c                  |  2 +-
 target/s390x/cpu-system.c        |  2 +-
 target/s390x/interrupt.c         | 22 +++++++++++-----------
 target/sh4/cpu.c                 |  2 +-
 target/sparc/cpu.c               |  4 ++--
 target/tricore/cpu.c             |  4 ++--
 target/xtensa/cpu.c              |  4 ++--
 35 files changed, 120 insertions(+), 101 deletions(-)

-- 
2.53.0