qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Pierrick Bouvier <pierrick.bouvier@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:12:15 -0700	[thread overview]
Message-ID: <172cb398-4859-4ed4-9e1b-9f05a88de6f4@linaro.org> (raw)
In-Reply-To: <20250309193712.1405766-1-pierrick.bouvier@linaro.org>

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().


r~


  parent reply	other threads:[~2025-03-09 23:12 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 [this message]
2025-03-09 23:31   ` Pierrick Bouvier

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=172cb398-4859-4ed4-9e1b-9f05a88de6f4@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=david@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.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).