diff mbox series

[05/13] target/arm/cpu: move KVM_HAVE_MCE_INJECTION to kvm-all.c file directly

Message ID 20250318045125.759259-6-pierrick.bouvier@linaro.org (mailing list archive)
State New
Headers show
Series single-binary: start make hw/arm/ common (boot.c) | expand

Commit Message

Pierrick Bouvier March 18, 2025, 4:51 a.m. UTC
This define is used only in accel/kvm/kvm-all.c, so we push directly the
definition there. Add more visibility to kvm_arch_on_sigbus_vcpu() to
allow removing this define from any header.

The only other architecture defining KVM_HAVE_MCE_INJECTION is i386,
which we can cleanup later.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 include/system/kvm.h | 2 --
 target/arm/cpu.h     | 4 ----
 accel/kvm/kvm-all.c  | 4 ++++
 3 files changed, 4 insertions(+), 6 deletions(-)

Comments

Richard Henderson March 18, 2025, 10:19 p.m. UTC | #1
On 3/17/25 21:51, Pierrick Bouvier wrote:
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index f89568bfa39..28de3990699 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -13,6 +13,10 @@
>    *
>    */
>   
> +#ifdef TARGET_AARCH64
> +#define KVM_HAVE_MCE_INJECTION 1
> +#endif
> +
>   #include "qemu/osdep.h"
>   #include <sys/ioctl.h>
>   #include <poll.h>

I think this define should go after all #includes, emphasizing that it only affects this file.

I think the #ifdef should use __aarch64__.  KVM is explicitly only for the host, so 
TARGET_AARCH64 really means the host is also AArch64.

I think you should go ahead and adjust x86_64 either with the same patch or immediately 
afterward.  There are only two users after all.


r~
diff mbox series

Patch

diff --git a/include/system/kvm.h b/include/system/kvm.h
index 716c7dcdf6b..b690dda1370 100644
--- a/include/system/kvm.h
+++ b/include/system/kvm.h
@@ -392,9 +392,7 @@  bool kvm_vcpu_id_is_valid(int vcpu_id);
 /* Returns VCPU ID to be used on KVM_CREATE_VCPU ioctl() */
 unsigned long kvm_arch_vcpu_id(CPUState *cpu);
 
-#ifdef KVM_HAVE_MCE_INJECTION
 void kvm_arch_on_sigbus_vcpu(CPUState *cpu, int code, void *addr);
-#endif
 
 void kvm_arch_init_irq_routing(KVMState *s);
 
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index 7aeb012428c..23c2293f7d1 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -33,10 +33,6 @@ 
 
 #define CPU_INCLUDE "target/arm/cpu.h"
 
-#ifdef TARGET_AARCH64
-#define KVM_HAVE_MCE_INJECTION 1
-#endif
-
 #define EXCP_UDEF            1   /* undefined instruction */
 #define EXCP_SWI             2   /* software interrupt */
 #define EXCP_PREFETCH_ABORT  3
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index f89568bfa39..28de3990699 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -13,6 +13,10 @@ 
  *
  */
 
+#ifdef TARGET_AARCH64
+#define KVM_HAVE_MCE_INJECTION 1
+#endif
+
 #include "qemu/osdep.h"
 #include <sys/ioctl.h>
 #include <poll.h>