diff mbox series

[v3,9/9] target/loongarch: Add loongarch kvm into meson build

Message ID 20231228084051.3235354-10-zhaotianrui@loongson.cn (mailing list archive)
State New, archived
Headers show
Series Add loongarch kvm accel support | expand

Commit Message

zhaotianrui Dec. 28, 2023, 8:40 a.m. UTC
Add kvm.c into meson.build to compile it when kvm
is configed. Meanwhile in meson.build, we set the
kvm_targets to loongarch64-softmmu when the cpu is
loongarch. And fix the compiling error when config
is enable-kvm,disable-tcg.

Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
Signed-off-by: xianglai li <lixianglai@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 meson.build                  | 2 ++
 target/loongarch/meson.build | 9 +++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

Comments

gaosong Jan. 2, 2024, 3:57 a.m. UTC | #1
Hi,  TianRui

在 2023/12/28 下午4:40, Tianrui Zhao 写道:
> Add kvm.c into meson.build to compile it when kvm
> is configed. Meanwhile in meson.build, we set the
> kvm_targets to loongarch64-softmmu when the cpu is
> loongarch. And fix the compiling error when config
> is enable-kvm,disable-tcg.
>
> Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
> Signed-off-by: xianglai li <lixianglai@loongson.cn>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   meson.build                  | 2 ++
>   target/loongarch/meson.build | 9 +++++----
>   2 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/meson.build b/meson.build
> index 445f2b7c2b..0c62b4156d 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -114,6 +114,8 @@ elif cpu in ['riscv32']
>     kvm_targets = ['riscv32-softmmu']
>   elif cpu in ['riscv64']
>     kvm_targets = ['riscv64-softmmu']
> +elif cpu in ['loongarch64']
> +  kvm_targets = ['loongarch64-softmmu']
>   else
>     kvm_targets = []
>   endif
> diff --git a/target/loongarch/meson.build b/target/loongarch/meson.build
> index 18e8191e2b..4a59356d0f 100644
> --- a/target/loongarch/meson.build
> +++ b/target/loongarch/meson.build
> @@ -10,8 +10,10 @@ loongarch_tcg_ss.add(files(
>     'fpu_helper.c',
>     'op_helper.c',
>     'translate.c',
> -  'gdbstub.c',
>     'vec_helper.c',
> +  'tlb_helper.c',
> +  'iocsr_helper.c',
> +  'csr_helper.c',
>   ))
>   loongarch_tcg_ss.add(zlib)
this is  broken 'loongarch64-linux-user' build.

I had moved tcg code to target/loongarch/tcg.  see [1]
you just need rebase it.

[1]: 
https://lore.kernel.org/all/20240102020200.3462097-2-gaosong@loongson.cn/

>   
> @@ -19,14 +21,13 @@ loongarch_system_ss = ss.source_set()
>   loongarch_system_ss.add(files(
>     'loongarch-qmp-cmds.c',
>     'machine.c',
> -  'tlb_helper.c',
>     'constant_timer.c',
> -  'csr_helper.c',
> -  'iocsr_helper.c',
> +  'gdbstub.c',
>   ))
'gdbstub.c'  should move to  loongarch_ss,   because linus-user also 
need it.

I had send a patch [1]  to fix it .  see [2]

[2]: 
https://lore.kernel.org/all/20240102020200.3462097-1-gaosong@loongson.cn/

Thanks.
Song Gao

>   common_ss.add(when: 'CONFIG_LOONGARCH_DIS', if_true: [files('disas.c'), gen])
>   
> +loongarch_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'))
>   loongarch_ss.add_all(when: 'CONFIG_TCG', if_true: [loongarch_tcg_ss])
>   
>   target_arch += {'loongarch': loongarch_ss}
diff mbox series

Patch

diff --git a/meson.build b/meson.build
index 445f2b7c2b..0c62b4156d 100644
--- a/meson.build
+++ b/meson.build
@@ -114,6 +114,8 @@  elif cpu in ['riscv32']
   kvm_targets = ['riscv32-softmmu']
 elif cpu in ['riscv64']
   kvm_targets = ['riscv64-softmmu']
+elif cpu in ['loongarch64']
+  kvm_targets = ['loongarch64-softmmu']
 else
   kvm_targets = []
 endif
diff --git a/target/loongarch/meson.build b/target/loongarch/meson.build
index 18e8191e2b..4a59356d0f 100644
--- a/target/loongarch/meson.build
+++ b/target/loongarch/meson.build
@@ -10,8 +10,10 @@  loongarch_tcg_ss.add(files(
   'fpu_helper.c',
   'op_helper.c',
   'translate.c',
-  'gdbstub.c',
   'vec_helper.c',
+  'tlb_helper.c',
+  'iocsr_helper.c',
+  'csr_helper.c',
 ))
 loongarch_tcg_ss.add(zlib)
 
@@ -19,14 +21,13 @@  loongarch_system_ss = ss.source_set()
 loongarch_system_ss.add(files(
   'loongarch-qmp-cmds.c',
   'machine.c',
-  'tlb_helper.c',
   'constant_timer.c',
-  'csr_helper.c',
-  'iocsr_helper.c',
+  'gdbstub.c',
 ))
 
 common_ss.add(when: 'CONFIG_LOONGARCH_DIS', if_true: [files('disas.c'), gen])
 
+loongarch_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'))
 loongarch_ss.add_all(when: 'CONFIG_TCG', if_true: [loongarch_tcg_ss])
 
 target_arch += {'loongarch': loongarch_ss}