diff mbox series

[4/6] target/mips: Pass env to cpu_mips_clock_init()

Message ID 20250121161817.33654-5-philmd@linaro.org
State New
Headers show
Series target/mips: Convert legacy qemu_allocate_irqs() to qemu_init_irq() | expand

Commit Message

Philippe Mathieu-Daudé Jan. 21, 2025, 4:18 p.m. UTC
Simplify cpu_mips_clock_init() by having it directly take
a CPU env, move its declaration from "cpu.h" to "internal.h",
as it shouldn't be accessible from hw/.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/mips/cpu.h              | 1 -
 target/mips/internal.h         | 1 +
 target/mips/cpu.c              | 2 +-
 target/mips/system/cp0_timer.c | 4 +---
 4 files changed, 3 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/target/mips/cpu.h b/target/mips/cpu.h
index f6877ece8b4..e5767ea9cf3 100644
--- a/target/mips/cpu.h
+++ b/target/mips/cpu.h
@@ -1361,7 +1361,6 @@  uint64_t cpu_mips_phys_to_kseg1(void *opaque, uint64_t addr);
 /* HW declaration specific to the MIPS target */
 void cpu_mips_soft_irq(CPUMIPSState *env, int irq, int level);
 void cpu_mips_irq_init_cpu(MIPSCPU *cpu);
-void cpu_mips_clock_init(MIPSCPU *cpu);
 
 #endif /* !CONFIG_USER_ONLY */
 
diff --git a/target/mips/internal.h b/target/mips/internal.h
index 28eb28936ba..69452aae5bc 100644
--- a/target/mips/internal.h
+++ b/target/mips/internal.h
@@ -214,6 +214,7 @@  void cpu_mips_store_count(CPUMIPSState *env, uint32_t value);
 void cpu_mips_store_compare(CPUMIPSState *env, uint32_t value);
 void cpu_mips_start_count(CPUMIPSState *env);
 void cpu_mips_stop_count(CPUMIPSState *env);
+void cpu_mips_clock_init(CPUMIPSState *env);
 
 static inline void mips_env_set_pc(CPUMIPSState *env, target_ulong value)
 {
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
index 95df8985bc6..99f442a4b98 100644
--- a/target/mips/cpu.c
+++ b/target/mips/cpu.c
@@ -479,7 +479,7 @@  static void mips_cpu_realizefn(DeviceState *dev, Error **errp)
     /* Init internal devices */
 #ifndef CONFIG_USER_ONLY
     cpu_mips_irq_init_cpu(cpu);
-    cpu_mips_clock_init(cpu);
+    cpu_mips_clock_init(env);
 #endif
     if (!clock_get(cpu->clock)) {
 #ifndef CONFIG_USER_ONLY
diff --git a/target/mips/system/cp0_timer.c b/target/mips/system/cp0_timer.c
index ca16945cee1..07641cab521 100644
--- a/target/mips/system/cp0_timer.c
+++ b/target/mips/system/cp0_timer.c
@@ -133,10 +133,8 @@  static void mips_timer_cb(void *opaque)
     cpu_mips_timer_expire(env);
 }
 
-void cpu_mips_clock_init(MIPSCPU *cpu)
+void cpu_mips_clock_init(CPUMIPSState *env)
 {
-    CPUMIPSState *env = &cpu->env;
-
     /*
      * If we're in KVM mode, don't create the periodic timer, that is handled in
      * kernel.