[PATCH 2/5] target/loongarch: Set function loongarch_cpu_has_work() as public

Bibo Mao posted 5 patches 6 days, 7 hours ago
Maintainers: Song Gao <gaosong@loongson.cn>
[PATCH 2/5] target/loongarch: Set function loongarch_cpu_has_work() as public
Posted by Bibo Mao 6 days, 7 hours ago
Function loongarch_cpu_has_work() is defined as static, it is used
by files target/loongarch/cpu.c and target/loongarch/tcg/tcg_cpu.c,
set it as public and declare it in header file target/loongarch/cpu.h

The same with function cpu_loongarch_hw_interrupts_pending().

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
 target/loongarch/cpu.c | 4 ++--
 target/loongarch/cpu.h | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
index 20ef221fb2..6eb8c3214a 100644
--- a/target/loongarch/cpu.c
+++ b/target/loongarch/cpu.c
@@ -141,7 +141,7 @@ void loongarch_cpu_set_irq(void *opaque, int irq, int level)
 }
 
 /* Check if there is pending and not masked out interrupt */
-static inline bool cpu_loongarch_hw_interrupts_pending(CPULoongArchState *env)
+bool cpu_loongarch_hw_interrupts_pending(CPULoongArchState *env)
 {
     uint32_t pending;
     uint32_t status;
@@ -154,7 +154,7 @@ static inline bool cpu_loongarch_hw_interrupts_pending(CPULoongArchState *env)
 #endif
 
 #ifndef CONFIG_USER_ONLY
-static bool loongarch_cpu_has_work(CPUState *cs)
+bool loongarch_cpu_has_work(CPUState *cs)
 {
     bool has_work = false;
 
diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h
index c8b96f74dc..5475b6e44f 100644
--- a/target/loongarch/cpu.h
+++ b/target/loongarch/cpu.h
@@ -478,6 +478,9 @@ static inline void set_pc(CPULoongArchState *env, uint64_t value)
     }
 }
 
+bool loongarch_cpu_has_work(CPUState *cs);
+bool cpu_loongarch_hw_interrupts_pending(CPULoongArchState *env);
+
 /*
  * LoongArch CPUs hardware flags.
  */
-- 
2.39.3
Re: [PATCH 2/5] target/loongarch: Set function loongarch_cpu_has_work() as public
Posted by Richard Henderson 6 days, 1 hour ago
On 9/22/25 00:33, Bibo Mao wrote:
> --- a/target/loongarch/cpu.h
> +++ b/target/loongarch/cpu.h
> @@ -478,6 +478,9 @@ static inline void set_pc(CPULoongArchState *env, uint64_t value)
>       }
>   }
>   
> +bool loongarch_cpu_has_work(CPUState *cs);
> +bool cpu_loongarch_hw_interrupts_pending(CPULoongArchState *env);
> +
>   /*
>    * LoongArch CPUs hardware flags.
>    */

Better to declare these in internals.h.  Otherwise,

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


r~