[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 08/33] accel/hax: Introduce CONFIG_HAX_IS_POSSIBLE
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 08/33] accel/hax: Introduce CONFIG_HAX_IS_POSSIBLE |
Date: |
Sun, 6 Mar 2022 13:59:35 +0100 |
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
Mirror "sysemu/kvm.h" #ifdef'ry to define CONFIG_HAX_IS_POSSIBLE,
expose hax_allowed to hax_enabled() macro.
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220207075426.81934-9-f4bug@amsat.org>
---
include/sysemu/hax.h | 18 ++++++++++++------
accel/stubs/hax-stub.c | 2 ++
target/i386/hax/hax-all.c | 7 +------
3 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/include/sysemu/hax.h b/include/sysemu/hax.h
index 247f0661d12..bf8f99a8246 100644
--- a/include/sysemu/hax.h
+++ b/include/sysemu/hax.h
@@ -25,17 +25,23 @@
int hax_sync_vcpus(void);
#ifdef NEED_CPU_H
+# ifdef CONFIG_HAX
+# define CONFIG_HAX_IS_POSSIBLE
+# endif
+#else /* !NEED_CPU_H */
+# define CONFIG_HAX_IS_POSSIBLE
+#endif
-#ifdef CONFIG_HAX
+#ifdef CONFIG_HAX_IS_POSSIBLE
-int hax_enabled(void);
+extern bool hax_allowed;
-#else /* CONFIG_HAX */
+#define hax_enabled() (hax_allowed)
-#define hax_enabled() (0)
+#else /* !CONFIG_HAX_IS_POSSIBLE */
-#endif /* CONFIG_HAX */
+#define hax_enabled() (0)
-#endif /* NEED_CPU_H */
+#endif /* CONFIG_HAX_IS_POSSIBLE */
#endif /* QEMU_HAX_H */
diff --git a/accel/stubs/hax-stub.c b/accel/stubs/hax-stub.c
index 49077f88e3c..2fe31aaa9ab 100644
--- a/accel/stubs/hax-stub.c
+++ b/accel/stubs/hax-stub.c
@@ -16,6 +16,8 @@
#include "qemu/osdep.h"
#include "sysemu/hax.h"
+bool hax_allowed;
+
int hax_sync_vcpus(void)
{
return 0;
diff --git a/target/i386/hax/hax-all.c b/target/i386/hax/hax-all.c
index bf65ed6fa92..ccdcb6afabc 100644
--- a/target/i386/hax/hax-all.c
+++ b/target/i386/hax/hax-all.c
@@ -49,18 +49,13 @@ const uint32_t hax_cur_version = 0x4; /* API v4: unmapping
and MMIO moves */
/* Minimum HAX kernel version */
const uint32_t hax_min_version = 0x4; /* API v4: supports unmapping */
-static bool hax_allowed;
+bool hax_allowed;
struct hax_state hax_global;
static void hax_vcpu_sync_state(CPUArchState *env, int modified);
static int hax_arch_get_registers(CPUArchState *env);
-int hax_enabled(void)
-{
- return hax_allowed;
-}
-
int valid_hax_tunnel_size(uint16_t size)
{
return size >= sizeof(struct hax_tunnel);
--
2.35.1
- [PULL 00/33] Abstract ArchCPU, Philippe Mathieu-Daudé, 2022/03/06
- [PULL 01/33] accel: Restrict sysemu stubs to system emulation, Philippe Mathieu-Daudé, 2022/03/06
- [PULL 02/33] accel/meson: Only build hw virtualization with system emulation, Philippe Mathieu-Daudé, 2022/03/06
- [PULL 03/33] exec: Declare vaddr as a generic target-agnostic type, Philippe Mathieu-Daudé, 2022/03/06
- [PULL 04/33] exec: Make cpu_memory_rw_debug() target agnostic, Philippe Mathieu-Daudé, 2022/03/06
- [PULL 05/33] sysemu/memory_mapping: Become target-agnostic, Philippe Mathieu-Daudé, 2022/03/06
- [PULL 06/33] sysemu/kvm: Make kvm_on_sigbus() / kvm_on_sigbus_vcpu() target agnostic, Philippe Mathieu-Daudé, 2022/03/06
- [PULL 07/33] accel/kvm: Simplify user-mode #ifdef'ry, Philippe Mathieu-Daudé, 2022/03/06
- [PULL 08/33] accel/hax: Introduce CONFIG_HAX_IS_POSSIBLE,
Philippe Mathieu-Daudé <=
- [PULL 09/33] softmmu/cpus: Code movement, Philippe Mathieu-Daudé, 2022/03/06
- [PULL 10/33] accel: Introduce AccelOpsClass::cpu_thread_is_idle(), Philippe Mathieu-Daudé, 2022/03/06
- [PULL 11/33] accel: Introduce AccelOpsClass::cpus_are_resettable(), Philippe Mathieu-Daudé, 2022/03/06
- [PULL 12/33] softmmu/globals: Remove unused 'hw/i386/*' headers, Philippe Mathieu-Daudé, 2022/03/06
- [PULL 13/33] softmmu/physmem: Remove unnecessary include, Philippe Mathieu-Daudé, 2022/03/06
- [PULL 14/33] softmmu/cpu-timers: Remove unused 'exec/exec-all.h' header, Philippe Mathieu-Daudé, 2022/03/06
- [PULL 15/33] misc: Remove unnecessary "sysemu/cpu-timers.h" include, Philippe Mathieu-Daudé, 2022/03/06
- [PULL 16/33] misc: Add missing "sysemu/cpu-timers.h" include, Philippe Mathieu-Daudé, 2022/03/06
- [PULL 17/33] exec/gdbstub: Make gdb_exit() / gdb_set_stop_cpu() target agnostic, Philippe Mathieu-Daudé, 2022/03/06
- [PULL 18/33] exec/cpu: Make address_space_init/reloading_memory_map target agnostic, Philippe Mathieu-Daudé, 2022/03/06