qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>, Max Filippov <jcmvbkbc@gmail.com>
Subject: Re: [PATCH 03/10] target/xtensa: Finalize config in xtensa_register_core()
Date: Mon, 10 Feb 2025 08:25:42 -0800	[thread overview]
Message-ID: <649207a1-6f54-4fa4-a8f0-40ef3a6a2385@linaro.org> (raw)
In-Reply-To: <20250210102604.34284-4-philmd@linaro.org>

On 2/10/25 02:25, Philippe Mathieu-Daudé wrote:
> Only modify XtensaConfig within xtensa_register_core(),
> when the class is registered, not when it is initialized.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> Cc: Max Filippov <jcmvbkbc@gmail.com>
> ---
>   target/xtensa/helper.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c
> index 2978c471c1f..c4735989714 100644
> --- a/target/xtensa/helper.c
> +++ b/target/xtensa/helper.c
> @@ -173,9 +173,8 @@ static void xtensa_core_class_init(ObjectClass *oc, void *data)
>   {
>       CPUClass *cc = CPU_CLASS(oc);
>       XtensaCPUClass *xcc = XTENSA_CPU_CLASS(oc);
> -    XtensaConfig *config = data;
> +    const XtensaConfig *config = data;
>   
> -    xtensa_finalize_config(config);
>       xcc->config = config;
>   
>       /*
> @@ -189,12 +188,15 @@ static void xtensa_core_class_init(ObjectClass *oc, void *data)
>   
>   void xtensa_register_core(XtensaConfigList *node)
>   {
> +    XtensaConfig *config = g_memdup2(node->config, sizeof(config));

Why are you introducing a new copy?
Previously we finalized in place.


r~

>       TypeInfo type = {
>           .parent = TYPE_XTENSA_CPU,
>           .class_init = xtensa_core_class_init,
> -        .class_data = (void *)node->config,
> +        .class_data = config,
>       };
>   
> +    xtensa_finalize_config(config);
> +
>       node->next = xtensa_cores;
>       xtensa_cores = node;
>       type.name = g_strdup_printf(XTENSA_CPU_TYPE_NAME("%s"), node->config->name);



  parent reply	other threads:[~2025-02-10 16:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-10 10:25 [PATCH 00/10] qom: Constify class_data Philippe Mathieu-Daudé
2025-02-10 10:25 ` [PATCH 01/10] target/i386: Constify X86CPUModel uses Philippe Mathieu-Daudé
2025-02-10 10:25 ` [PATCH 02/10] target/sparc: Constify SPARCCPUClass::cpu_def Philippe Mathieu-Daudé
2025-02-10 10:25 ` [PATCH 03/10] target/xtensa: Finalize config in xtensa_register_core() Philippe Mathieu-Daudé
2025-02-10 11:02   ` Max Filippov
2025-02-10 16:25   ` Richard Henderson [this message]
2025-02-10 10:25 ` [PATCH 04/10] target/riscv: Declare RISCVCPUClass::misa_mxl_max as RISCVMXL Philippe Mathieu-Daudé
2025-02-10 10:25 ` [PATCH 05/10] target/riscv: Convert misa_mxl_max using GLib macros Philippe Mathieu-Daudé
2025-02-10 10:26 ` [PATCH 06/10] hw: Declare various const data as 'const' Philippe Mathieu-Daudé
2025-02-10 10:26 ` [PATCH 07/10] hw: Make class data 'const' Philippe Mathieu-Daudé
2025-02-10 10:26 ` [PATCH 08/10] qom: Have class_base_init() take a const data argument Philippe Mathieu-Daudé
2025-02-10 10:26 ` [PATCH 09/10] qom: Have class_init() " Philippe Mathieu-Daudé
2025-02-10 10:26 ` [PATCH 10/10] qom: Constify class_data Philippe Mathieu-Daudé
2025-02-10 12:30 ` [PATCH 00/10] " Paolo Bonzini
2025-02-10 13:29   ` Philippe Mathieu-Daudé

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=649207a1-6f54-4fa4-a8f0-40ef3a6a2385@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=jcmvbkbc@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@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).