qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Bibo Mao <maobibo@loongson.cn>, Song Gao <gaosong@loongson.cn>
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH 3/5] target/loongarch: Set file tcg_cpu.c separate from cpu.c
Date: Mon, 22 Sep 2025 07:29:46 -0700	[thread overview]
Message-ID: <e30ee507-9e75-44e6-a901-fa9562b1697e@linaro.org> (raw)
In-Reply-To: <20250922073400.1308169-4-maobibo@loongson.cn>

On 9/22/25 00:33, Bibo Mao wrote:
> Remove inline included with file tcg_cpu.c, and set it separate
> with file target/loongarch/cpu.c
> 
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> ---
>   target/loongarch/cpu.c               |  9 ---------
>   target/loongarch/tcg/meson.build     |  1 +
>   target/loongarch/tcg/tcg_cpu.c       | 13 ++++++++++++-
>   target/loongarch/tcg/tcg_loongarch.h |  1 +
>   4 files changed, 14 insertions(+), 10 deletions(-)

I think this should be squashed with patch 1.
The intermediate #include of tcg/tcg_cpu.c was odd.

With that,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~

> 
> diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
> index 6eb8c3214a..b449ede56d 100644
> --- a/target/loongarch/cpu.c
> +++ b/target/loongarch/cpu.c
> @@ -28,11 +28,6 @@
>   #ifdef CONFIG_KVM
>   #include <linux/kvm.h>
>   #endif
> -#ifdef CONFIG_TCG
> -#include "accel/tcg/cpu-ldst.h"
> -#include "accel/tcg/cpu-ops.h"
> -#include "tcg/tcg.h"
> -#endif
>   #include "tcg/tcg_loongarch.h"
>   
>   const char * const regnames[32] = {
> @@ -653,10 +648,6 @@ static void loongarch_cpu_dump_state(CPUState *cs, FILE *f, int flags)
>       }
>   }
>   
> -#ifdef CONFIG_TCG
> -#include "tcg/tcg_cpu.c"
> -#endif /* CONFIG_TCG */
> -
>   #ifndef CONFIG_USER_ONLY
>   #include "hw/core/sysemu-cpu-ops.h"
>   
> diff --git a/target/loongarch/tcg/meson.build b/target/loongarch/tcg/meson.build
> index bdf34f9673..b7adfe46f1 100644
> --- a/target/loongarch/tcg/meson.build
> +++ b/target/loongarch/tcg/meson.build
> @@ -7,6 +7,7 @@ loongarch_ss.add([zlib, gen])
>   loongarch_ss.add(files(
>     'fpu_helper.c',
>     'op_helper.c',
> +  'tcg_cpu.c',
>     'translate.c',
>     'vec_helper.c',
>   ))
> diff --git a/target/loongarch/tcg/tcg_cpu.c b/target/loongarch/tcg/tcg_cpu.c
> index f09a695968..c7f49838e3 100644
> --- a/target/loongarch/tcg/tcg_cpu.c
> +++ b/target/loongarch/tcg/tcg_cpu.c
> @@ -4,6 +4,17 @@
>    *
>    * Copyright (c) 2025 Loongson Technology Corporation Limited
>    */
> +#include "qemu/osdep.h"
> +#include "qemu/accel.h"
> +#include "qemu/error-report.h"
> +#include "qemu/log.h"
> +#include "accel/accel-cpu-target.h"
> +#include "accel/tcg/cpu-ldst.h"
> +#include "accel/tcg/cpu-ops.h"
> +#include "exec/translation-block.h"
> +#include "exec/target_page.h"
> +#include "tcg_loongarch.h"
> +#include "internals.h"
>   
>   #ifndef CONFIG_USER_ONLY
>   static void loongarch_cpu_do_interrupt(CPUState *cs)
> @@ -232,7 +243,7 @@ static int loongarch_cpu_mmu_index(CPUState *cs, bool ifetch)
>       return MMU_DA_IDX;
>   }
>   
> -static const TCGCPUOps loongarch_tcg_ops = {
> +const TCGCPUOps loongarch_tcg_ops = {
>       .guest_default_memory_order = 0,
>       .mttcg_supported = true,
>   
> diff --git a/target/loongarch/tcg/tcg_loongarch.h b/target/loongarch/tcg/tcg_loongarch.h
> index 47702893e3..7fb627f2d6 100644
> --- a/target/loongarch/tcg/tcg_loongarch.h
> +++ b/target/loongarch/tcg/tcg_loongarch.h
> @@ -9,6 +9,7 @@
>   #include "cpu.h"
>   #include "cpu-mmu.h"
>   
> +extern const TCGCPUOps loongarch_tcg_ops;
>   void loongarch_csr_translate_init(void);
>   
>   bool loongarch_cpu_tlb_fill(CPUState *cs, vaddr address, int size,



  reply	other threads:[~2025-09-22 14:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-22  7:33 [PATCH 0/5] target/loongarch: Move TCG specified functions to tcg_cpu.c Bibo Mao
2025-09-22  7:33 ` [PATCH 1/5] " Bibo Mao
2025-09-22  7:33 ` [PATCH 2/5] target/loongarch: Set function loongarch_cpu_has_work() as public Bibo Mao
2025-09-22 14:27   ` Richard Henderson
2025-09-22  7:33 ` [PATCH 3/5] target/loongarch: Set file tcg_cpu.c separate from cpu.c Bibo Mao
2025-09-22 14:29   ` Richard Henderson [this message]
2025-09-23  2:41     ` Bibo Mao
2025-09-22  7:33 ` [PATCH 4/5] target/loongarch: Move function do_raise_exception() to tcg_cpu.c Bibo Mao
2025-09-22 14:32   ` Richard Henderson
2025-09-22  7:34 ` [PATCH 5/5] target/loongarch: Define loongarch_exception_name() as static Bibo Mao
2025-09-22 14:32   ` Richard Henderson

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=e30ee507-9e75-44e6-a901-fa9562b1697e@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=gaosong@loongson.cn \
    --cc=jiaxun.yang@flygoat.com \
    --cc=maobibo@loongson.cn \
    --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).