From: Bibo Mao Date: Thu, 30 Oct 2025 08:17:23 +0000 (+0800) Subject: target/loongarch: Call function loongarch_la464_init_csr() after realized X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=411b9496ca327f333b50a6608bef75fc3f6896aa;p=thirdparty%2Fqemu.git target/loongarch: Call function loongarch_la464_init_csr() after realized When CPU is realized, it will check capability of host and set guest features, such as PMU CSR register number used by VM etc. Here move function call with loongarch_la464_init_csr() after CPU is realized. Signed-off-by: Bibo Mao Reviewed-by: Song Gao --- diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index e01e044239..67ad9c3b79 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -106,11 +106,11 @@ bool loongarch_cpu_has_work(CPUState *cs) } #endif /* !CONFIG_USER_ONLY */ -static void loongarch_la464_init_csr(Object *obj) +static void loongarch_la464_init_csr(DeviceState *dev) { #ifndef CONFIG_USER_ONLY static bool initialized; - LoongArchCPU *cpu = LOONGARCH_CPU(obj); + LoongArchCPU *cpu = LOONGARCH_CPU(dev); CPULoongArchState *env = &cpu->env; int i, num; @@ -369,7 +369,6 @@ static void loongarch_la464_initfn(Object *obj) cpu->msgint = ON_OFF_AUTO_OFF; cpu->ptw = ON_OFF_AUTO_OFF; - loongarch_la464_init_csr(obj); loongarch_cpu_post_init(obj); } @@ -524,6 +523,7 @@ static void loongarch_cpu_realizefn(DeviceState *dev, Error **errp) qemu_init_vcpu(cs); cpu_reset(cs); + loongarch_la464_init_csr(dev); lacc->parent_realize(dev, errp); }