From: Markus Armbruster <armbru@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
qemu-devel@nongnu.org, "Aurelien Jarno" <aurelien@aurel32.net>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Aleksandar Rikalo" <arikalo@gmail.com>,
"Richard Henderson" <richard.henderson@linaro.org>
Subject: Re: [PATCH] target/mips/cpu: Move initialization of memory region to realize function
Date: Thu, 12 Mar 2026 08:54:41 +0100 [thread overview]
Message-ID: <87tsulzdmm.fsf@pond.sub.org> (raw)
In-Reply-To: <20260311211629.118608-1-thuth@redhat.com> (Thomas Huth's message of "Wed, 11 Mar 2026 22:16:29 +0100")
Thomas Huth <thuth@redhat.com> writes:
> From: Thomas Huth <thuth@redhat.com>
>
> When introspecting the Loongson-3A4000 CPUs from the command line, QEMU
> currently crashes:
>
> $ ./qemu-system-mips64el -device Loongson-3A4000-mips64-cpu,help
> qemu-system-mips64el: ../../devel/qemu/system/physmem.c:1401:
> register_multipage: Assertion `num_pages' failed.
> Aborted (core dumped)
>
> Move the initialization of the memory regions to the realize function
> to fix this problem.
>
> Reported-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
See also my ramblings in reply to the related xtensa patch:
Subject: Re: [PATCH] target/xtensa/cpu: Move initialization of memory region to realize function
Date: Thu, 12 Mar 2026 08:51:43 +0100
Message-ID: <87y0jxzdrk.fsf@pond.sub.org>
> ---
> target/mips/cpu.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/target/mips/cpu.c b/target/mips/cpu.c
> index e424d115018..5f88c077dbf 100644
> --- a/target/mips/cpu.c
> +++ b/target/mips/cpu.c
> @@ -460,6 +460,14 @@ static void mips_cpu_realizefn(DeviceState *dev, Error **errp)
> MIPSCPUClass *mcc = MIPS_CPU_GET_CLASS(dev);
> Error *local_err = NULL;
>
> +#ifndef CONFIG_USER_ONLY
> + if (mcc->cpu_def->lcsr_cpucfg2 & (1 << CPUCFG2_LCSRP)) {
> + memory_region_init_io(&env->iocsr.mr, OBJECT(cpu), NULL,
> + env, "iocsr", UINT64_MAX);
> + address_space_init(&env->iocsr.as, &env->iocsr.mr, "IOCSR");
> + }
> +#endif
> +
> if (!clock_get(cpu->clock)) {
> #ifndef CONFIG_USER_ONLY
> if (!qtest_enabled()) {
> @@ -504,14 +512,6 @@ static void mips_cpu_initfn(Object *obj)
> cpu->count_div = clock_new(OBJECT(obj), "clk-div-count");
> env->count_clock = clock_new(OBJECT(obj), "clk-count");
> env->cpu_model = mcc->cpu_def;
> -#ifndef CONFIG_USER_ONLY
> - if (mcc->cpu_def->lcsr_cpucfg2 & (1 << CPUCFG2_LCSRP)) {
> - memory_region_init_io(&env->iocsr.mr, OBJECT(cpu), NULL,
> - env, "iocsr", UINT64_MAX);
> - address_space_init(&env->iocsr.as,
> - &env->iocsr.mr, "IOCSR");
> - }
> -#endif
> }
>
> static char *mips_cpu_type_name(const char *cpu_model)
Tested-by: Markus Armbruster <armbru@redhat.com>
prev parent reply other threads:[~2026-03-12 7:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-11 21:16 [PATCH] target/mips/cpu: Move initialization of memory region to realize function Thomas Huth
2026-03-12 7:54 ` Markus Armbruster [this message]
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=87tsulzdmm.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=arikalo@gmail.com \
--cc=aurelien@aurel32.net \
--cc=jiaxun.yang@flygoat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
/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.