From 0af34b1daccb08649a5a3c5d2d3843e5efc89ec9 Mon Sep 17 00:00:00 2001 From: Philippe Mathieu-Daudé Date: Wed, 2 Apr 2025 13:17:28 +0200 Subject: system/hvf: Avoid including 'cpu.h' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "system/hvf.h" doesn't need to include a full "cpu.h", only "exec/vaddr.h" and "qemu/queue.h" are required. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Pierrick Bouvier Message-Id: <20250403235821.9909-27-philmd@linaro.org> --- include/system/hvf.h | 3 ++- include/system/hvf_int.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'include/system') diff --git a/include/system/hvf.h b/include/system/hvf.h index 730f927f03..d50049e1a1 100644 --- a/include/system/hvf.h +++ b/include/system/hvf.h @@ -14,10 +14,11 @@ #define HVF_H #include "qemu/accel.h" +#include "qemu/queue.h" +#include "exec/vaddr.h" #include "qom/object.h" #ifdef COMPILING_PER_TARGET -#include "cpu.h" #ifdef CONFIG_HVF extern bool hvf_allowed; diff --git a/include/system/hvf_int.h b/include/system/hvf_int.h index 42ae18433f..8c8b84012d 100644 --- a/include/system/hvf_int.h +++ b/include/system/hvf_int.h @@ -11,6 +11,8 @@ #ifndef HVF_INT_H #define HVF_INT_H +#include "qemu/queue.h" + #ifdef __aarch64__ #include typedef hv_vcpu_t hvf_vcpuid; -- cgit 1.4.1 From 962f9f18d29ac8d229e391e4756ca586cb07e8b5 Mon Sep 17 00:00:00 2001 From: Philippe Mathieu-Daudé Date: Fri, 4 Apr 2025 00:59:48 +0200 Subject: system/hvf: Expose hvf_enabled() to common code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently hvf_enabled() is restricted to target-specific code. By defining CONFIG_HVF_IS_POSSIBLE we allow its use anywhere. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20250403235821.9909-28-philmd@linaro.org> Reviewed-by: Richard Henderson --- MAINTAINERS | 1 + accel/stubs/hvf-stub.c | 12 ++++++++++++ accel/stubs/meson.build | 1 + include/system/hvf.h | 14 +++++++++----- 4 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 accel/stubs/hvf-stub.c (limited to 'include/system') diff --git a/MAINTAINERS b/MAINTAINERS index 7c2b9e69ad..13f2a52c5e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -525,6 +525,7 @@ R: Phil Dennis-Jordan W: https://wiki.qemu.org/Features/HVF S: Maintained F: accel/hvf/ +F: accel/stubs/hvf-stub.c F: include/system/hvf.h F: include/system/hvf_int.h diff --git a/accel/stubs/hvf-stub.c b/accel/stubs/hvf-stub.c new file mode 100644 index 0000000000..42eadc5ca9 --- /dev/null +++ b/accel/stubs/hvf-stub.c @@ -0,0 +1,12 @@ +/* + * HVF stubs for QEMU + * + * Copyright (c) Linaro + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "system/hvf.h" + +bool hvf_allowed; diff --git a/accel/stubs/meson.build b/accel/stubs/meson.build index 91a2d21925..8ca1a4529e 100644 --- a/accel/stubs/meson.build +++ b/accel/stubs/meson.build @@ -2,5 +2,6 @@ system_stubs_ss = ss.source_set() system_stubs_ss.add(when: 'CONFIG_XEN', if_false: files('xen-stub.c')) system_stubs_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c')) system_stubs_ss.add(when: 'CONFIG_TCG', if_false: files('tcg-stub.c')) +system_stubs_ss.add(when: 'CONFIG_HVF', if_false: files('hvf-stub.c')) specific_ss.add_all(when: ['CONFIG_SYSTEM_ONLY'], if_true: system_stubs_ss) diff --git a/include/system/hvf.h b/include/system/hvf.h index d50049e1a1..7b45a2e198 100644 --- a/include/system/hvf.h +++ b/include/system/hvf.h @@ -19,15 +19,19 @@ #include "qom/object.h" #ifdef COMPILING_PER_TARGET +# ifdef CONFIG_HVF +# define CONFIG_HVF_IS_POSSIBLE +# endif /* !CONFIG_HVF */ +#else +# define CONFIG_HVF_IS_POSSIBLE +#endif /* COMPILING_PER_TARGET */ -#ifdef CONFIG_HVF +#ifdef CONFIG_HVF_IS_POSSIBLE extern bool hvf_allowed; #define hvf_enabled() (hvf_allowed) -#else /* !CONFIG_HVF */ +#else /* !CONFIG_HVF_IS_POSSIBLE */ #define hvf_enabled() 0 -#endif /* !CONFIG_HVF */ - -#endif /* COMPILING_PER_TARGET */ +#endif /* !CONFIG_HVF_IS_POSSIBLE */ #define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf") -- cgit 1.4.1