All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
To: qemu-devel@nongnu.org
Cc: qemu-riscv@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	qemu-s390x@nongnu.org,
	"Richard Henderson" <richard.henderson@linaro.org>,
	qemu-ppc@nongnu.org,
	"Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
	qemu-arm@nongnu.org,
	"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Song Gao" <17746591750@163.com>,
	"Bibo Mao" <maobibo@loongson.cn>,
	"Xianglai Li" <lixianglai@loongson.cn>
Subject: [PATCH v2 06/15] target/loongarch: Constify CPULoongArchState for various cpu_*() getters
Date: Thu, 20 Aug 2026 22:13:46 +0200	[thread overview]
Message-ID: <20260820201356.29775-7-philmd@oss.qualcomm.com> (raw)
In-Reply-To: <20260820201356.29775-1-philmd@oss.qualcomm.com>

Add the const qualifier to CPULoongArchStatCPUMIPSStatee when
the argument is accessed without modification.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 target/loongarch/cpu.h       | 6 +++---
 target/loongarch/internals.h | 2 +-
 target/loongarch/cpu.c       | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h
index ad30c73167e..494744788b8 100644
--- a/target/loongarch/cpu.h
+++ b/target/loongarch/cpu.h
@@ -485,7 +485,7 @@ struct LoongArchCPUClass {
 #define MMU_USER_IDX     MMU_PLV_USER
 #define MMU_DA_IDX       4
 
-static inline CPUSysState *env_sys(CPULoongArchState *env)
+static inline CPUSysState *env_sys(const CPULoongArchState *env)
 {
     return env->sys_state;
 }
@@ -495,12 +495,12 @@ static inline void set_sys_state(CPULoongArchState *env, CPUSysState *sys)
     env->sys_state = sys;
 }
 
-static inline bool is_la64(CPULoongArchState *env)
+static inline bool is_la64(const CPULoongArchState *env)
 {
     return FIELD_EX32(env->cpucfg[1], CPUCFG1, ARCH) == CPUCFG1_ARCH_LA64;
 }
 
-static inline bool is_va32(CPULoongArchState *env)
+static inline bool is_va32(const CPULoongArchState *env)
 {
     /* VA32 if !LA64 or VA32L[1-3] */
     bool va32 = !is_la64(env);
diff --git a/target/loongarch/internals.h b/target/loongarch/internals.h
index 50f0fe2e9be..d6f31161e85 100644
--- a/target/loongarch/internals.h
+++ b/target/loongarch/internals.h
@@ -38,7 +38,7 @@ uint64_t cpu_loongarch_get_constant_timer_counter(LoongArchCPU *cpu);
 uint64_t cpu_loongarch_get_constant_timer_ticks(LoongArchCPU *cpu);
 void cpu_loongarch_store_constant_timer_config(LoongArchCPU *cpu,
                                                uint64_t value);
-bool cpu_loongarch_hw_interrupts_pending(CPULoongArchState *env);
+bool cpu_loongarch_hw_interrupts_pending(const CPULoongArchState *env);
 #endif /* !CONFIG_USER_ONLY */
 
 uint64_t read_fcc(CPULoongArchState *env);
diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
index 2e938d7880f..b638ac25040 100644
--- a/target/loongarch/cpu.c
+++ b/target/loongarch/cpu.c
@@ -82,7 +82,7 @@ void loongarch_cpu_set_irq(void *opaque, int irq, int level)
 }
 
 /* Check if there is pending and not masked out interrupt */
-bool cpu_loongarch_hw_interrupts_pending(CPULoongArchState *env)
+bool cpu_loongarch_hw_interrupts_pending(const CPULoongArchState *env)
 {
     uint32_t pending;
     uint32_t status;
-- 
2.53.0



  parent reply	other threads:[~2026-08-20 20:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-20 20:13 [PATCH v2 00/15] cpus: Constify @cpu in SysemuCPUOps::has_work() handler Philippe Mathieu-Daudé
2026-08-20 20:13 ` [PATCH v2 01/15] target/tricore: Document architectural interrupts as not implemented Philippe Mathieu-Daudé
2026-08-20 20:13 ` [PATCH v2 02/15] system/cpus: Constify various CPUState arguments Philippe Mathieu-Daudé
2026-08-20 20:13 ` [PATCH v2 03/15] target/avr: Constify CPUAVRState for some cpu_*() getters Philippe Mathieu-Daudé
2026-08-20 20:13 ` [PATCH v2 04/15] target/hexagon: Constify CPUHexagonState in hexagon_thread_is_enabled() Philippe Mathieu-Daudé
2026-08-20 20:13 ` [PATCH v2 05/15] target/i386: Constify CPU*State for cpu_*_interrupt() getters Philippe Mathieu-Daudé
2026-08-20 20:13 ` Philippe Mathieu-Daudé [this message]
2026-08-20 20:13 ` [PATCH v2 07/15] target/mips: Constify CPUMIPSState for various cpu_*() getters Philippe Mathieu-Daudé
2026-08-20 20:13 ` [PATCH v2 08/15] target/s390x: Constify S390CPU for cpu_has_*() getters Philippe Mathieu-Daudé
2026-08-20 20:13 ` [PATCH v2 09/15] target/riscv: Constify @iprio argument in riscv_cpu_pending_to_irq() Philippe Mathieu-Daudé
2026-08-20 20:13 ` [PATCH v2 10/15] target/riscv: Constify CPURISCVState for various cpu_*() getters Philippe Mathieu-Daudé
2026-08-20 20:13 ` [PATCH v2 11/15] target/sparc: Constify CPUSPARCState " Philippe Mathieu-Daudé
2026-08-20 20:13 ` [PATCH v2 12/15] linux-user: Uncast void pointer argument as Object in target_cpu_free() Philippe Mathieu-Daudé
2026-08-20 23:21   ` Richard Henderson
2026-08-20 20:13 ` [PATCH v2 13/15] cpus: Add const-qualified CPU environment accessors Philippe Mathieu-Daudé
2026-08-20 23:17   ` Richard Henderson
2026-08-20 20:13 ` [PATCH v2 14/15] linux-user: Replace env_cpu_const() by generic env_cpu() equivalent Philippe Mathieu-Daudé
2026-08-20 23:17   ` Richard Henderson
2026-08-20 20:13 ` [PATCH v2 15/15] cpus: Constify @cpu in SysemuCPUOps::has_work() handler Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260820201356.29775-7-philmd@oss.qualcomm.com \
    --to=philmd@oss.qualcomm.com \
    --cc=17746591750@163.com \
    --cc=lixianglai@loongson.cn \
    --cc=maobibo@loongson.cn \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=pierrick.bouvier@oss.qualcomm.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.