accel: Try to build without target-specific knowledge
Subsystems (2)
cover accel: Try to build without target-specific knowledge
Code in accel/ aims to be target-agnostic. Not all accelerators are ready for that, but start by enforcing a few easy ones.
Philippe Mathieu-Daudé (5):
accel/kvm: Include missing 'exec/cpu-common.h' header accel/mshv: Forward-declare mshv_root_hvcall structure accel/mshv: Build without target-specific knowledge accel/hvf: Build without target-specific knowledge accel/xen: Build without target-specific knowledge
include/system/mshv_int.h | 5 ++--- accel/kvm/kvm-accel-ops.c | 1 + accel/mshv/mshv-all.c | 2 +- accel/hvf/meson.build | 5 +---- accel/mshv/meson.build | 5 +---- accel/xen/meson.build | 2 +- 6 files changed, 7 insertions(+), 13 deletions(-)
Signature · 1 line
2.52.0
PATCH 1/5 accel/kvm: Include missing 'exec/cpu-common.h' header
kvm-accel-ops.c uses EXCP_DEBUG, itself defined in "exec/cpu-common.h". Include it explicitly, otherwise we get when modifying unrelated headers:
../accel/kvm/kvm-accel-ops.c: In function ‘kvm_vcpu_thread_fn’:
../accel/kvm/kvm-accel-ops.c:54:22: error: ‘EXCP_DEBUG’ undeclared (first use in this function)
54 | if (r == EXCP_DEBUG) {
| ^~~~~~~~~~--- accel/kvm/kvm-accel-ops.c | 1 + 1 file changed, 1 insertion(+)
accel/kvm/kvm-accel-ops.c +1 -0
@@ -16,6 +16,7 @@#include "qemu/osdep.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" +#include "exec/cpu-common.h" #include "accel/accel-cpu-ops.h" #include "system/kvm.h" #include "system/kvm_int.h"
Signature · 1 line
2.52.0
Re: [PATCH 1/5] accel/kvm: Include missing 'exec/cpu-common.h' header
Quoted 5 lines · Philippe Mathieu-Daudé
kvm-accel-ops.cusesEXCP_DEBUG, itself defined in "exec/cpu-common.h". Include it explicitly, otherwise we get when modifying unrelated headers:
../accel/kvm/kvm-accel-ops.c: In function ‘kvm_vcpu_thread_fn’:
Quoted 9 lines
../accel/kvm/kvm-accel-ops.c:54:22: error: ‘EXCP_DEBUG’ undeclared (first use in this function) 54 | if (r == EXCP_DEBUG) { | ^~~~~~~~~~Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- accel/kvm/kvm-accel-ops.c | 1 + 1 file changed, 1 insertion(+)
PATCH 2/5 accel/mshv: Forward-declare mshv_root_hvcall structure
In reply to Philippe Mathieu-DaudéForward-declare the target-specific mshv_root_hvcall structure in order to keep 'system/mshv_int.h' target-agnostic.
--- include/system/mshv_int.h | 5 ++--- accel/mshv/mshv-all.c | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-)
include/system/mshv_int.h +2 -3
@@ -96,9 +96,8 @@ void mshv_arch_amend_proc_features( union hv_partition_synthetic_processor_features *features);int mshv_arch_post_init_vm (int vm_fd); -#if definedCOMPILING_PER_TARGET && definedCONFIG_MSHV_IS_POSSIBLE -int mshv_hvcall (int fd,const struct mshv_root_hvcall *args); -#endif +typedef struct mshv_root_hvcall mshv_root_hvcall ; +int mshv_hvcall (int fd,const mshv_root_hvcall *args);/* memory */ typedef struct MshvMemoryRegion {
accel/mshv/mshv-all.c +1 -1
@@ -381,7 +381,7 @@ static void register_mshv_memory_listener(MshvState *s, MshvMemoryListener *mml, } } -int mshv_hvcall (int fd,const struct mshv_root_hvcall *args) +int mshv_hvcall (int fd,const mshv_root_hvcall *args) {int ret =0 ;
Signature · 1 line
2.52.0
Re: [PATCH 2/5] accel/mshv: Forward-declare mshv_root_hvcall structure
Quoted 9 lines · Philippe Mathieu-Daudé
Forward-declare the target-specific
mshv_root_hvcallstructure in order to keep 'system/mshv_int.h' target-agnostic.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/system/mshv_int.h | 5 ++--- accel/mshv/mshv-all.c | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-)
PATCH 3/5 accel/mshv: Build without target-specific knowledge
In reply to Philippe Mathieu-DaudéCode in accel/ aims to be target-agnostic. Enforce that by moving the MSHV file units to system_ss[], which is target-agnostic.
--- accel/mshv/meson.build | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
accel/mshv/meson.build +1 -4
@@ -1,9 +1,6 @@ -mshv_ss = ss.source_set() -mshv_ss.add(if_true: files( +system_ss.add(when: 'CONFIG_MSHV', if_true: files( 'irq.c', 'mem.c', 'msr.c', 'mshv-all.c' )) - -specific_ss.add_all(when: 'CONFIG_MSHV', if_true: mshv_ss)
Signature · 1 line
2.52.0
Re: [PATCH 3/5] accel/mshv: Build without target-specific knowledge
Quoted 9 lines · Philippe Mathieu-Daudé
Code in accel/ aims to be target-agnostic. Enforce that by moving the MSHV file units to system_ss[], which is target-agnostic.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- accel/mshv/meson.build | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
PATCH 4/5 accel/hvf: Build without target-specific knowledge
In reply to Philippe Mathieu-DaudéCode in accel/ aims to be target-agnostic. Enforce that by moving the MSHV file units to system_ss[], which is target-agnostic.
--- accel/hvf/meson.build | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
accel/hvf/meson.build +1 -4
@@ -1,7 +1,4 @@ -hvf_ss = ss.source_set() -hvf_ss.add(files( +system_ss.add(when: 'CONFIG_HVF', if_true: files( 'hvf-all.c', 'hvf-accel-ops.c', )) - -specific_ss.add_all(when: 'CONFIG_HVF', if_true: hvf_ss)
Signature · 1 line
2.52.0
Re: [PATCH 4/5] accel/hvf: Build without target-specific knowledge
Quoted 2 lines · Philippe Mathieu-Daudé
Code in accel/ aims to be target-agnostic. Enforce that by moving the MSHV file units to system_ss[], which is
s/MSHV/HVF/
Quoted 20 lines
target-agnostic.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- accel/hvf/meson.build | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)accel/hvf/meson.build +1
-4@@ -1,7 +1,4 @@ -hvf_ss = ss.source_set() -hvf_ss.add(files( +system_ss.add(when: 'CONFIG_HVF', if_true: files( 'hvf-all.c', 'hvf-accel-ops.c', )) - -specific_ss.add_all(when: 'CONFIG_HVF', if_true: hvf_ss)
Re: [PATCH 4/5] accel/hvf: Build without target-specific knowledge
In reply to Philippe Mathieu-DaudéQuoted 9 lines · Philippe Mathieu-Daudé
Code in accel/ aims to be target-agnostic. Enforce that by moving the MSHV file units to system_ss[], which is target-agnostic.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- accel/hvf/meson.build | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
PATCH 5/5 accel/xen: Build without target-specific knowledge
In reply to Philippe Mathieu-DaudéCode in accel/ aims to be target-agnostic. Enforce that by moving the MSHV file units to system_ss[], which is target-agnostic.
--- accel/xen/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
accel/xen/meson.build +1 -1
@@ -1 +1 @@ -specific_ss.add(when: 'CONFIG_XEN', if_true: files('xen-all.c')) +system_ss.add(when: 'CONFIG_XEN', if_true: files('xen-all.c'))
Signature · 1 line
2.52.0
Re: [PATCH 5/5] accel/xen: Build without target-specific knowledge
Quoted 2 lines · Philippe Mathieu-Daudé
Code in accel/ aims to be target-agnostic. Enforce that by moving the MSHV file units to system_ss[], which is
You mean Xen ^ here ?
Quoted 3 lines
target-agnostic.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
In anycase, it seems to works fine for me:
Thanks,
--
Anthony Perard | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
Re: [PATCH 5/5] accel/xen: Build without target-specific knowledge
In reply to Philippe Mathieu-DaudéQuoted 9 lines · Philippe Mathieu-Daudé
Code in accel/ aims to be target-agnostic. Enforce that by moving the MSHV file units to system_ss[], which is target-agnostic.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- accel/xen/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 9 lines · Philippe Mathieu-Daudé
Code in accel/ aims to be target-agnostic. Not all accelerators are ready for that, but start by enforcing a few easy ones.
Philippe Mathieu-Daudé (5):
accel/kvm: Include missing 'exec/cpu-common.h' header accel/mshv: Forward-declaremshv_root_hvcallstructure accel/mshv: Build without target-specific knowledge accel/hvf: Build without target-specific knowledge accel/xen: Build without target-specific knowledge
r~
Quoted 6 lines · Philippe Mathieu-Daudé
Philippe Mathieu-Daudé (5):
accel/kvm: Include missing 'exec/cpu-common.h' header accel/mshv: Forward-declaremshv_root_hvcallstructure accel/mshv: Build without target-specific knowledge accel/hvf: Build without target-specific knowledge accel/xen: Build without target-specific knowledge
Series queued, thanks.