[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 12/22] target/mips: Create clock *after* accelerator vCPU is real
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 12/22] target/mips: Create clock *after* accelerator vCPU is realized |
Date: |
Mon, 18 Sep 2023 18:02:45 +0200 |
Architecture specific hardware doesn't have a particular dependency
on the accelerator vCPU (created with cpu_exec_realizefn), and can
be initialized *after* the vCPU is realized. Doing so allows further
generic API simplification (in few commits).
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/mips/cpu.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
index 0aea69aaf9..7c81e6c356 100644
--- a/target/mips/cpu.c
+++ b/target/mips/cpu.c
@@ -464,20 +464,6 @@ static void mips_cpu_realizefn(DeviceState *dev, Error
**errp)
MIPSCPUClass *mcc = MIPS_CPU_GET_CLASS(dev);
Error *local_err = NULL;
- if (!clock_get(cpu->clock)) {
-#ifndef CONFIG_USER_ONLY
- if (!qtest_enabled()) {
- g_autofree char *cpu_freq_str = freq_to_str(CPU_FREQ_HZ_DEFAULT);
-
- warn_report("CPU input clock is not connected to any output clock,
"
- "using default frequency of %s.", cpu_freq_str);
- }
-#endif
- /* Initialize the frequency in case the clock remains unconnected. */
- clock_set_hz(cpu->clock, CPU_FREQ_HZ_DEFAULT);
- }
- mips_cp0_period_set(cpu);
-
cpu_exec_realizefn(cs, &local_err);
if (local_err != NULL) {
error_propagate(errp, local_err);
@@ -492,6 +478,20 @@ static void mips_cpu_realizefn(DeviceState *dev, Error
**errp)
fpu_init(env, env->cpu_model);
mvp_init(env);
+ if (!clock_get(cpu->clock)) {
+#ifndef CONFIG_USER_ONLY
+ if (!qtest_enabled()) {
+ g_autofree char *cpu_freq_str = freq_to_str(CPU_FREQ_HZ_DEFAULT);
+
+ warn_report("CPU input clock is not connected to any output clock,
"
+ "using default frequency of %s.", cpu_freq_str);
+ }
+#endif
+ /* Initialize the frequency in case the clock remains unconnected. */
+ clock_set_hz(cpu->clock, CPU_FREQ_HZ_DEFAULT);
+ }
+ mips_cp0_period_set(cpu);
+
mcc->parent_realize(dev, errp);
cpu_reset(cs);
}
--
2.41.0
- [PATCH 02/22] hw/intc/apic: Pass CPU using QOM link property, (continued)
- [PATCH 02/22] hw/intc/apic: Pass CPU using QOM link property, Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 03/22] target/i386/kvm: Correct comment in kvm_cpu_realize(), Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 07/22] exec/cpu: Introduce the CPU address space destruction function, Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 05/22] exec/cpu: Call qemu_init_vcpu() once in cpu_common_realize(), Philippe Mathieu-Daudé, 2023/09/18
- [RFC PATCH 04/22] exec/cpu: Never call cpu_reset() before cpu_realize(), Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 06/22] exec/cpu: Call cpu_remove_sync() once in cpu_common_unrealize(), Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 08/22] exec/cpu: RFC Destroy vCPU address spaces in cpu_common_unrealize(), Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 09/22] target/arm: Create timers *after* accelerator vCPU is realized, Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 10/22] target/hppa: Create timer *after* accelerator vCPU is realized, Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 11/22] target/nios2: Create IRQs *after* accelerator vCPU is realized, Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 12/22] target/mips: Create clock *after* accelerator vCPU is realized,
Philippe Mathieu-Daudé <=
- [PATCH 14/22] target/sparc: Init CPU environment *after* accelerator vCPU is realized, Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 15/22] exec/cpu: Introduce CPUClass::verify_accel_features(), Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 16/22] target/arm: Extract verify_accel_features() from cpu_realize(), Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 13/22] target/xtensa: Create IRQs *after* accelerator vCPU is realized, Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 17/22] target/i386: Extract verify_accel_features() from cpu_realize(), Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 18/22] target/s390x: Call s390_cpu_realize_sysemu from s390_realize_cpu_model, Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 19/22] target/s390x: Have s390_realize_cpu_model() return a boolean, Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 20/22] target/s390x: Use s390_realize_cpu_model() as verify_accel_features(), Philippe Mathieu-Daudé, 2023/09/18
- [PATCH 21/22] exec/cpu: Have cpu_exec_realize() return a boolean, Philippe Mathieu-Daudé, 2023/09/18