Skip to contentSkip to conversation

target/loongarch/kvm: Include missing exec/cpu-defs.h header

PATCH Superseded Qiang Ma 4 participants 5 messages May 12 – May 13

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Qiang Ma

author
#0 lore raw

PATCH 1/1 target/loongarch/kvm: Include missing exec/cpu-defs.h header

After commit 71cab1a42d2 removed the indirect include of exec/cpu-defs.h from target/loongarch/cpu.h, the TARGET_FMT_lx macro is no longer visible in kvm.c, causing build failures:

error: expected ')' before TARGET_FMT_lx

Add the missing #include exec/cpu-defs.h to restore the TARGET_FMT_lx definition.

---
 target/loongarch/kvm/kvm.c | 1 +
 1 file changed, 1 insertion(+)
target/loongarch/kvm/kvm.c +1 -0
index 9d844c4905..7989aec7c7 100644
@@ -6,6 +6,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "exec/cpu-defs.h"
 #include <sys/ioctl.h>
 #include <linux/kvm.h>
 #include "asm-loongarch/kvm_para.h"
Signature · 1 line
2.51.0
#1 lore raw

+Philippe,and bibo.

Quoted 19 lines · Qiang Ma

After commit 71cab1a42d2 removed the indirect include of exec/cpu-defs.h from target/loongarch/cpu.h, the TARGET_FMT_lx macro is no longer visible in kvm.c, causing build failures:

error: expected ')' before TARGET_FMT_lx

Add the missing #include exec/cpu-defs.h to restore the TARGET_FMT_lx definition.

---
  target/loongarch/kvm/kvm.c | 1 +
  1 file changed, 1 insertion(+)
target/loongarch/kvm/kvm.c +0 -0
index 9d844c4905..7989aec7c7 100644

target/loongarch/kvm/kvm.c line 9

Quoted 4 lines
target/loongarch/kvm/kvm.c +1 -0
@@ -6,6 +6,7 @@
   */
 
  #include "qemu/osdep.h"
+#include "exec/cpu-defs.h"

Simply add exec/target_long.h.

Thanks.
Song Gao

Quoted 3 lines
target/loongarch/kvm/kvm.c +0 -0
  #include <sys/ioctl.h>
  #include <linux/kvm.h>
  #include "asm-loongarch/kvm_para.h"
author
#2 lore raw
Quoted 16 lines · gaosong

+Philippe,and bibo.

Quoted 14 lines · Qiang Ma

After commit 71cab1a42d2 removed the indirect include of exec/cpu-defs.h from target/loongarch/cpu.h, the TARGET_FMT_lx macro is no longer visible in kvm.c, causing build failures:

   error: expected ')' before TARGET_FMT_lx

Add the missing #include exec/cpu-defs.h to restore the TARGET_FMT_lx definition.

---
  target/loongarch/kvm/kvm.c | 1 +

  1 file changed, 1 insertion(+)
Quoted 9 lines

target/loongarch/kvm/kvm.c line 8

Quoted 8 lines
target/loongarch/kvm/kvm.c +1 -0
index 9d844c4905..7989aec7c7 100644
@@ -6,6 +6,7 @@
    */
     #include "qemu/osdep.h"
+#include "exec/cpu-defs.h"

Simply add exec/target_long.h.

OK, Add #include "exec/target_long.h" in v2.

Quoted 8 lines

Thanks.
Song Gao

Quoted 3 lines
target/loongarch/kvm/kvm.c +0 -0
   #include <sys/ioctl.h>
   #include <linux/kvm.h>
   #include "asm-loongarch/kvm_para.h"
#3 lore raw
In reply to gaosong

Hi,

Quoted 16 lines · gaosong

+Philippe,and bibo.

Quoted 14 lines · Qiang Ma

After commit 71cab1a42d2 removed the indirect include of exec/cpu-defs.h from target/loongarch/cpu.h, the TARGET_FMT_lx macro is no longer visible in kvm.c, causing build failures:

   error: expected ')' before TARGET_FMT_lx

Add the missing #include exec/cpu-defs.h to restore the TARGET_FMT_lx definition.

---
  target/loongarch/kvm/kvm.c | 1 +

  1 file changed, 1 insertion(+)
Quoted 9 lines

target/loongarch/kvm/kvm.c line 8

Quoted 8 lines
target/loongarch/kvm/kvm.c +1 -0
index 9d844c4905..7989aec7c7 100644
@@ -6,6 +6,7 @@
    */
   #include "qemu/osdep.h"
+#include "exec/cpu-defs.h"

Simply add exec/target_long.h.

Correct.

Looking at the last build-loongarch64 job output,
https://gitlab.com/qemu-project/qemu/-/jobs/14336151206,
I see KVM is not build-covered:

configuring with: '../configure' '--enable-werror' '--disable-docs' '--enable-fdt=system' '--disable-debug-info' '--target-list=loongarch64-linux-user loongarch64-softmmu' '--disable-tools' '--enable-debug' [...]
Targets and accelerators
KVM support : NO

Why is that, what is missing?

Also I strongly suggest adding a cross-loongarch64-kvm-only job in .gitlab-ci.d/crossbuilds.yml.

Quoted 3 lines

Thanks.
Song Gao

#4 lore raw
Quoted 35 lines · Philippe Mathieu-Daudé

Hi,

Quoted 16 lines · gaosong

+Philippe,and bibo.

Quoted 14 lines · Qiang Ma

After commit 71cab1a42d2 removed the indirect include of exec/cpu-defs.h from target/loongarch/cpu.h, the TARGET_FMT_lx macro is no longer visible in kvm.c, causing build failures:

   error: expected ')' before TARGET_FMT_lx

Add the missing #include exec/cpu-defs.h to restore the TARGET_FMT_lx definition.

---
  target/loongarch/kvm/kvm.c | 1 +

  1 file changed, 1 insertion(+)
Quoted 9 lines

target/loongarch/kvm/kvm.c line 8

Quoted 8 lines
target/loongarch/kvm/kvm.c +1 -0
index 9d844c4905..7989aec7c7 100644
@@ -6,6 +6,7 @@
    */
   #include "qemu/osdep.h"
+#include "exec/cpu-defs.h"

Simply add exec/target_long.h.

Correct.

Looking at the last build-loongarch64 job output,
https://gitlab.com/qemu-project/qemu/-/jobs/14336151206,
I see KVM is not build-covered:

Quoted 6 lines

configuring with:  '../configure' '--enable-werror' '--disable-docs' '-- enable-fdt=system' '--disable-debug-info' '--target-list=loongarch64-linux- user loongarch64-softmmu' '--disable-tools' '--enable-debug' [...]
  Targets and accelerators
    KVM support                     : NO

Why is that, what is missing?

KVM only works if you build binaries where host architecture matches the target architecture. In that job, binaries are built for x86 hosts, so no KVM support here.

Quoted 2 lines

Also I strongly suggest adding a cross-loongarch64-kvm-only job in .gitlab-ci.d/crossbuilds.yml.

Right, you'd need this for getting compile-coverage of the KVM code.

Thomas