From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"David Hildenbrand" <david@redhat.com>,
"Peter Xu" <peterx@redhat.com>
Subject: Re: [PATCH] system: initialize target_page_bits as soon as possible
Date: Sun, 9 Mar 2025 16:31:32 -0700 [thread overview]
Message-ID: <65c8d1b7-17dc-4682-8a09-a165d4161802@linaro.org> (raw)
In-Reply-To: <172cb398-4859-4ed4-9e1b-9f05a88de6f4@linaro.org>
On 3/9/25 16:12, Richard Henderson wrote:
> On 3/9/25 12:37, Pierrick Bouvier wrote:
>> Allow device init functions to use it, which can be convenient in some
>> cases (like hw/hyperv/hyperv.c).
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>> system/physmem.c | 1 -
>> system/vl.c | 3 +++
>> 2 files changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/system/physmem.c b/system/physmem.c
>> index 8df9f30a0bb..c5fb784a9e1 100644
>> --- a/system/physmem.c
>> +++ b/system/physmem.c
>> @@ -3281,7 +3281,6 @@ void cpu_exec_init_all(void)
>> * do this much later, rather than requiring board models to state
>> * up front what their requirements are.
>> */
>> - finalize_target_page_bits();
>> io_mem_init();
>> memory_map_init();
>> }
>> diff --git a/system/vl.c b/system/vl.c
>> index ec93988a03a..c64f8c8e808 100644
>> --- a/system/vl.c
>> +++ b/system/vl.c
>> @@ -2848,6 +2848,9 @@ void qemu_init(int argc, char **argv)
>> bool userconfig = true;
>> FILE *vmstate_dump_file = NULL;
>>
>> + /* Set target page info before creating machine and associated devices */
>> + finalize_target_page_bits();
>
> This is far too early, and therefore incorrect.
>
> You have to wait until after all possible calls to set_preferred_target_page_bits(). The
> only relevant call is in arm_cpu_realizefn, invoked from the MachineClass.init, invoked
> from machine_run_board_init().
>
Thanks.
Moving it later is not possible in the case I was solving (assert in
hv_syndbg_class_init() from hw/hyperv/syndbg.c).
I'll simply move this assert later, but if a device needs to query
target_page_size in its init function, we'll be in trouble. But maybe a
device should not have to use this information anyway.
I'll drop this patch.
>
> r~
prev parent reply other threads:[~2025-03-09 23:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-09 19:37 [PATCH] system: initialize target_page_bits as soon as possible Pierrick Bouvier
2025-03-09 19:39 ` Pierrick Bouvier
2025-03-09 23:12 ` Richard Henderson
2025-03-09 23:31 ` Pierrick Bouvier [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=65c8d1b7-17dc-4682-8a09-a165d4161802@linaro.org \
--to=pierrick.bouvier@linaro.org \
--cc=david@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).