Skip to contentSkip to conversation

target/arm: Compile accelerator-related objects as common code

PATCH In review Philippe Mathieu-Daudé 1 participant 11 messages Apr 2

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover target/arm: Compile accelerator-related objects as common code

First drop TARGET_KVM_HAVE_GUEST_DEBUG (all targets but MIPS support it), then -- after minor changes -- move the ARM specific accelerator units to target_common_system_arch[] source set, allowing to remove arm_system_ss[] for good.

Since v1:
- Include missing "exec/cpu-common.h" & "qemu/queue.h" headers

(I plan to merge via single-binary tree)

Philippe Mathieu-Daudé (9):
accel/kvm: Include missing 'exec/cpu-common.h' header accel/kvm: Include missing 'exec/vaddr.h' and 'qemu/queue.h' headers accel/kvm: Remove TARGET_KVM_HAVE_GUEST_DEBUG
accel/kvm: Expose all non-target specific declarations target/arm: Compile WHPX as common object
target/arm: Remove target_ulong use in hvf_handle_psci_call() target/arm: Compile HVF as common object
target/arm: Remove target_ulong cast in kvm_arm_handle_dabt_nisv() target/arm: Compile KVM as common object

 configs/targets/aarch64-softmmu.mak     |  1 -
 configs/targets/i386-softmmu.mak        |  1 -
 configs/targets/loongarch64-softmmu.mak |  1 -
 configs/targets/ppc-softmmu.mak         |  1 -
 configs/targets/ppc64-softmmu.mak       |  1 -
 configs/targets/riscv64-softmmu.mak     |  1 -
 configs/targets/s390x-softmmu.mak       |  1 -
 configs/targets/x86_64-softmmu.mak      |  1 -
 include/system/kvm.h                    | 14 ++------------
 include/system/kvm_int.h                |  2 --
 accel/kvm/kvm-accel-ops.c               |  4 ----
 accel/kvm/kvm-all.c                     | 14 +++-----------
 target/arm/hvf/hvf.c                    |  2 +-
 target/arm/kvm.c                        |  3 +--
 target/mips/kvm.c                       |  5 +++++
 target/arm/hvf/meson.build              |  2 +-
 target/arm/meson.build                  | 12 +++++++-----
 target/arm/whpx/meson.build             |  6 +++---
 18 files changed, 23 insertions(+), 49 deletions(-)
Signature · 1 line
2.53.0
#1 lore raw

PATCH v2 1/9 accel/kvm: Include missing 'exec/cpu-common.h' header

kvm-all.c uses EXCP_INTERRUPT and EXCP_HLT, defined in the "exec/cpu-common.h" header:

17 #define EXCP_INTERRUPT 0x10000 /* async interruption */
18 #define EXCP_HLT 0x10001 /* hlt instruction reached */

This header is indirectly included via "system/kvm.h" -> "cpu.h". Since we want to remove the latter inclusion, include it here in order to avoid otherwise:

accel/kvm/kvm-all.c: In function 'kvm_handle_internal_error':
accel/kvm/kvm-all.c:3147:20: error: 'EXCP_INTERRUPT' undeclared (first use in this function); did you mean 'SA_INTERRUPT'?

   3147 |             return EXCP_INTERRUPT;
        |                    ^~~~~~~~~~~~~~
  accel/kvm/kvm-all.c: In function 'kvm_cpu_exec':
  accel/kvm/kvm-all.c:3436:16: error: 'EXCP_HLT' undeclared (first use in this function)
   3436 |         return EXCP_HLT;
        |                ^~~~~~~~
  accel/kvm/kvm-all.c:3490:23: error: 'EXCP_INTERRUPT' undeclared (first use in this function); did you mean 'SA_INTERRUPT'?
   3490 |                 ret = EXCP_INTERRUPT;
        |                       ^~~~~~~~~~~~~~
---
 accel/kvm/kvm-all.c | 1 +
 1 file changed, 1 insertion(+)
accel/kvm/kvm-all.c +1 -0
index 774499d34f8..5df3fb90d88 100644
@@ -36,6 +36,7 @@
 #include "system/ramblock.h"
 #include "accel/accel-ops.h"
 #include "qemu/bswap.h"
+#include "exec/cpu-common.h"
 #include "exec/tswap.h"
 #include "exec/target_page.h"
 #include "system/memory.h"
Signature · 1 line
2.53.0
#2 lore raw

PATCH v2 2/9 accel/kvm: Include missing 'exec/vaddr.h' and 'qemu/queue.h' headers

In reply to Philippe Mathieu-Daudé

Commit b67be03e3ac ("accel/kvm: Widen pc/saved_insn for kvm_sw_breakpoint") used the vaddr type in the kvm_sw_breakpoint structure but forgot to include the header defining it. It is however indirectly included via "cpu.h", which we want to remove.

The QTAILQ_ENTRY() macro is defined in "qemu/queue.h". Include both headers in order to avoid later when refactoring unrelated headers:

include/system/kvm.h:398:5: error: expected specifier-qualifier-list before ‘QTAILQ_ENTRY’

    398 |     QTAILQ_ENTRY(kvm_sw_breakpoint) entry;
        |     ^~~~~~~~~~~~
  include/system/kvm.h:404:5: error: unknown type name 'vaddr'
    404 |     vaddr pc;
        |     ^~~~~
  include/system/kvm.h:405:5: error: unknown type name 'vaddr'
    405 |     vaddr saved_insn;
        |     ^~~~~
---
 include/system/kvm.h | 2 ++
 1 file changed, 2 insertions(+)
include/system/kvm.h +2 -0
index 5fa33eddda3..b5763a562d7 100644
@@ -17,7 +17,9 @@
 #define QEMU_KVM_H
 
 #include "exec/memattrs.h"
+#include "exec/vaddr.h"
 #include "qemu/accel.h"
+#include "qemu/queue.h"
 #include "qom/object.h"
 
 #ifdef COMPILING_PER_TARGET
Signature · 1 line
2.53.0
#3 lore raw

PATCH v2 3/9 accel/kvm: Remove TARGET_KVM_HAVE_GUEST_DEBUG

In reply to Philippe Mathieu-Daudé

All targets except MIPS have TARGET_KVM_HAVE_GUEST_DEBUG=y. Declare the kvm_update_guest_debug() stub to MIPS and have TARGET_KVM_HAVE_GUEST_DEBUG be the default.

---
 configs/targets/aarch64-softmmu.mak     |  1 -
 configs/targets/i386-softmmu.mak        |  1 -
 configs/targets/loongarch64-softmmu.mak |  1 -
 configs/targets/ppc-softmmu.mak         |  1 -
 configs/targets/ppc64-softmmu.mak       |  1 -
 configs/targets/riscv64-softmmu.mak     |  1 -
 configs/targets/s390x-softmmu.mak       |  1 -
 configs/targets/x86_64-softmmu.mak      |  1 -
 include/system/kvm.h                    |  7 -------
 include/system/kvm_int.h                |  2 --
 accel/kvm/kvm-accel-ops.c               |  4 ----
 accel/kvm/kvm-all.c                     | 13 ++-----------
 target/mips/kvm.c                       |  5 +++++
 13 files changed, 7 insertions(+), 32 deletions(-)
configs/targets/aarch64-softmmu.mak +0 -1
index d34aead41c4..6f60ca6505c 100644
@@ -1,6 +1,5 @@
 TARGET_ARCH=aarch64
 TARGET_BASE_ARCH=arm
-TARGET_KVM_HAVE_GUEST_DEBUG=y
 TARGET_XML_FILES= aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-vfp-sysregs.xml arm-neon.xml arm-m-profile.xml arm-m-profile-mve.xml aarch64-pauth.xml aarch64-sme2.xml
 # needed by boot.c
 TARGET_NEED_FDT=y
configs/targets/i386-softmmu.mak +0 -1
index 38a8f85201f..2eef68dc55e 100644
@@ -1,5 +1,4 @@
 TARGET_ARCH=i386
-TARGET_KVM_HAVE_GUEST_DEBUG=y
 TARGET_KVM_HAVE_RESET_PARKED_VCPU=y
 TARGET_XML_FILES= i386-32bit.xml
 TARGET_LONG_BITS=32
configs/targets/loongarch64-softmmu.mak +0 -1
index 476407f9413..7e0b1ab5d05 100644
@@ -1,6 +1,5 @@
 TARGET_ARCH=loongarch64
 TARGET_BASE_ARCH=loongarch
-TARGET_KVM_HAVE_GUEST_DEBUG=y
 TARGET_XML_FILES= loongarch-base32.xml loongarch-base64.xml loongarch-fpu.xml loongarch-lsx.xml loongarch-lasx.xml
 # all boards require libfdt
 TARGET_NEED_FDT=y
configs/targets/ppc-softmmu.mak +0 -1
index 867898bd47c..c47887f8992 100644
@@ -1,5 +1,4 @@
 TARGET_ARCH=ppc
 TARGET_BIG_ENDIAN=y
-TARGET_KVM_HAVE_GUEST_DEBUG=y
 TARGET_XML_FILES= power-core.xml power-fpu.xml power-altivec.xml power-spe.xml
 TARGET_LONG_BITS=32
configs/targets/ppc64-softmmu.mak +0 -1
index 10d7a2681e7..8c6dc84b821 100644
@@ -1,7 +1,6 @@
 TARGET_ARCH=ppc64
 TARGET_BASE_ARCH=ppc
 TARGET_BIG_ENDIAN=y
-TARGET_KVM_HAVE_GUEST_DEBUG=y
 TARGET_XML_FILES= power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml
 # all boards require libfdt
 TARGET_NEED_FDT=y
configs/targets/riscv64-softmmu.mak +0 -1
index 5059c550480..e0d2c7032d6 100644
@@ -1,6 +1,5 @@
 TARGET_ARCH=riscv64
 TARGET_BASE_ARCH=riscv
-TARGET_KVM_HAVE_GUEST_DEBUG=y
 TARGET_XML_FILES= riscv-64bit-cpu.xml riscv-32bit-fpu.xml riscv-64bit-fpu.xml riscv-64bit-virtual.xml riscv-32bit-cpu.xml riscv-32bit-virtual.xml
 # needed by boot.c
 TARGET_NEED_FDT=y
configs/targets/s390x-softmmu.mak +0 -1
index e273075f1a9..699e5ced96f 100644
@@ -1,6 +1,5 @@
 TARGET_ARCH=s390x
 TARGET_BIG_ENDIAN=y
-TARGET_KVM_HAVE_GUEST_DEBUG=y
 TARGET_XML_FILES= s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml s390-virt-kvm.xml s390-gs.xml
 TARGET_LONG_BITS=64
 TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API=y
configs/targets/x86_64-softmmu.mak +0 -1
index c7f8746b4f5..491173df466 100644
@@ -1,6 +1,5 @@
 TARGET_ARCH=x86_64
 TARGET_BASE_ARCH=i386
-TARGET_KVM_HAVE_GUEST_DEBUG=y
 TARGET_KVM_HAVE_RESET_PARKED_VCPU=y
 TARGET_XML_FILES= i386-64bit.xml i386-64bit-apx.xml
 TARGET_LONG_BITS=64
include/system/kvm.h +0 -7
index b5763a562d7..9b722ad931a 100644
@@ -237,14 +237,7 @@ void kvm_irqchip_change_notify(void);
  * calling down to kvm_arch_update_guest_debug after the generic
  * fields have been set.
  */
-#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
 int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap);
-#else
-static inline int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap)
-{
-    return -EINVAL;
-}
-#endif
 
 /* internal API */
 
include/system/kvm_int.h +0 -2
index 0876aac938d..9d1d3fd3deb 100644
@@ -113,9 +113,7 @@ struct KVMState
     struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
     bool coalesced_flush_in_progress;
     int vcpu_events;
-#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
     QTAILQ_HEAD(, kvm_sw_breakpoint) kvm_sw_breakpoints;
-#endif
     int max_nested_state_len;
     int kvm_shadow_mem;
     bool kernel_irqchip_allowed;
accel/kvm/kvm-accel-ops.c +0 -4
index 6d9140e549f..d4af6b416c3 100644
@@ -85,12 +85,10 @@ static bool kvm_cpus_are_resettable(void)
     return !kvm_enabled() || !kvm_state->guest_state_protected;
 }
 
-#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
 static int kvm_update_guest_debug_ops(CPUState *cpu)
 {
     return kvm_update_guest_debug(cpu, 0);
 }
-#endif
 
 static void kvm_accel_ops_class_init(ObjectClass *oc, const void *data)
 {
@@ -105,13 +103,11 @@ static void kvm_accel_ops_class_init(ObjectClass *oc, const void *data)
     ops->synchronize_pre_loadvm = kvm_cpu_synchronize_pre_loadvm;
     ops->handle_interrupt = generic_handle_interrupt;
 
-#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
     ops->update_guest_debug = kvm_update_guest_debug_ops;
     ops->supports_guest_debug = kvm_supports_guest_debug;
     ops->insert_breakpoint = kvm_insert_breakpoint;
     ops->remove_breakpoint = kvm_remove_breakpoint;
     ops->remove_all_breakpoints = kvm_remove_all_breakpoints;
-#endif
 }
 
 static const TypeInfo kvm_accel_ops_type = {
accel/kvm/kvm-all.c +2 -11
index 5df3fb90d88..91724b54cdf 100644
@@ -2920,9 +2920,7 @@ static int kvm_init(AccelState *as, MachineState *ms)
     s->sigmask_len = 8;
     accel_blocker_init();
 
-#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
     QTAILQ_INIT(&s->kvm_sw_breakpoints);
-#endif
     QLIST_INIT(&s->kvm_parked_vcpus);
     s->fd = qemu_open_old(s->device ?: "/dev/kvm", O_RDWR);
     if (s->fd == -1) {
@@ -3033,23 +3031,19 @@ static int kvm_init(AccelState *as, MachineState *ms)
     kvm_vm_attributes_allowed =
         (kvm_check_extension(s, KVM_CAP_VM_ATTRIBUTES) > 0);
 
-#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
     kvm_has_guest_debug =
         (kvm_check_extension(s, KVM_CAP_SET_GUEST_DEBUG) > 0);
-#endif
 
     kvm_sstep_flags = 0;
     if (kvm_has_guest_debug) {
-        kvm_sstep_flags = SSTEP_ENABLE;
-
-#if defined TARGET_KVM_HAVE_GUEST_DEBUG
         int guest_debug_flags =
             kvm_check_extension(s, KVM_CAP_SET_GUEST_DEBUG2);
 
+        kvm_sstep_flags = SSTEP_ENABLE;
+
         if (guest_debug_flags & KVM_GUESTDBG_BLOCKIRQ) {
             kvm_sstep_flags |= SSTEP_NOIRQ;
         }
-#endif
     }
 
     kvm_state = s;
@@ -3782,7 +3776,6 @@ bool kvm_arm_supports_user_irq(void)
     return kvm_check_extension(kvm_state, KVM_CAP_ARM_USER_IRQ);
 }
 
-#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
 struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUState *cpu, vaddr pc)
 {
     struct kvm_sw_breakpoint *bp;
@@ -3942,8 +3935,6 @@ void kvm_remove_all_breakpoints(CPUState *cpu)
     }
 }
 
-#endif /* !TARGET_KVM_HAVE_GUEST_DEBUG */
-
 static int kvm_set_signal_mask(CPUState *cpu, const sigset_t *sigset)
 {
     KVMState *s = kvm_state;
target/mips/kvm.c +5 -0
index a85e162409c..49bff68b137 100644
@@ -1262,6 +1262,11 @@ int kvm_arch_msi_data_to_gsi(uint32_t data)
     abort();
 }
 
+int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap)
+{
+    return -EINVAL;
+}
+
 int kvm_arch_get_default_type(MachineState *machine)
 {
 #if defined(KVM_CAP_MIPS_VZ)
Signature · 1 line
2.53.0
#4 lore raw

PATCH v2 4/9 accel/kvm: Expose all non-target specific declarations

In reply to Philippe Mathieu-Daudé

None of the declarations guarded within the COMPILING_PER_TARGET checks use target-specific declaration. "cpu.h" is not required since some time (maybe commit 4fb54de823e "meson: build target libraries with common dependencies"). Remove the restrictions.

---
 include/system/kvm.h | 5 -----
 1 file changed, 5 deletions(-)
include/system/kvm.h +0 -5
index 9b722ad931a..c33fb160b5b 100644
@@ -225,9 +225,6 @@ void kvm_irqchip_add_change_notifier(Notifier *n);
 void kvm_irqchip_remove_change_notifier(Notifier *n);
 void kvm_irqchip_change_notify(void);
 
-#ifdef COMPILING_PER_TARGET
-#include "cpu.h"
-
 /**
  * kvm_update_guest_debug(): ensure KVM debug structures updated
  * @cs: the CPUState for this cpu
@@ -450,8 +447,6 @@ void kvm_set_sigmask_len(KVMState *s, unsigned int sigmask_len);
 int kvm_physical_memory_addr_from_host(KVMState *s, void *ram_addr,
                                        hwaddr *phys_addr);
 
-#endif /* COMPILING_PER_TARGET */
-
 bool kvm_arch_supports_vmfd_change(void);
 int kvm_arch_on_vmfd_change(MachineState *ms, KVMState *s);
 
Signature · 1 line
2.53.0
#5 lore raw

Re: [PATCH-for-11.1 v2 4/9] accel/kvm: Expose all non-target specific declarations

Quoted 15 lines · Philippe Mathieu-Daudé

None of the declarations guarded within the COMPILING_PER_TARGET checks use target-specific declaration. "cpu.h" is not required since some time (maybe commit 4fb54de823e "meson: build target libraries with common dependencies"). Remove the restrictions.

---
  include/system/kvm.h | 5 -----
  1 file changed, 5 deletions(-)
include/system/kvm.h +0 -0
index 9b722ad931a..c33fb160b5b 100644

include/system/kvm.h void kvm_irqchip_add_change_notifier(Notifier *n); · line 229

Quoted 5 lines
include/system/kvm.h +0 -2
@@ -225,9 +225,6 @@ void kvm_irqchip_add_change_notifier(Notifier *n);
  void kvm_irqchip_remove_change_notifier(Notifier *n);
  void kvm_irqchip_change_notify(void);
 
-#ifdef COMPILING_PER_TARGET
-#include "cpu.h"

Prerequisites still missing, sorry.

Quoted 12 lines
include/system/kvm.h +0 -2
  /**
   * kvm_update_guest_debug(): ensure KVM debug structures updated
   * @cs: the CPUState for this cpu
@@ -450,8 +447,6 @@ void kvm_set_sigmask_len(KVMState *s, unsigned int sigmask_len);
  int kvm_physical_memory_addr_from_host(KVMState *s, void *ram_addr,
                                         hwaddr *phys_addr);
 
-#endif /* COMPILING_PER_TARGET */
-
  bool kvm_arch_supports_vmfd_change(void);
  int kvm_arch_on_vmfd_change(MachineState *ms, KVMState *s);
 
#6 lore raw

PATCH v2 5/9 target/arm: Compile WHPX as common object

In reply to Philippe Mathieu-Daudé

whpx-all.c doesn't use target-specific code, move it from arm_system_ss[] to arm_common_system_ss[] to compile it once.

---
 target/arm/whpx/meson.build | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
target/arm/whpx/meson.build +3 -3
index 3df632c9d30..db31e928012 100644
@@ -1,5 +1,5 @@
-arm_system_ss.add(when: 'CONFIG_WHPX', if_true: files(
+arm_common_system_ss.add(when: 'CONFIG_WHPX', if_true: files(
   'whpx-all.c',
+), if_false: files(
+  'whpx-stub.c'
 ))
-
-arm_common_system_ss.add(when: 'CONFIG_WHPX', if_false: files('whpx-stub.c'))
Signature · 1 line
2.53.0
#7 lore raw

PATCH v2 6/9 target/arm: Remove target_ulong use in hvf_handle_psci_call()

In reply to Philippe Mathieu-Daudé

Similarly to commit 3580aa03547 ("target/arm/tcg/psci.c: make compilation unit common") which replaced the target_ulong use in arm_handle_psci_call(), replace the one in hvf_handle_psci_call.

---
 target/arm/hvf/hvf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/arm/hvf/hvf.c +1 -1
index 5fc8f6bbbd9..678afe5c8e1 100644
@@ -1418,7 +1418,7 @@ static bool hvf_handle_psci_call(CPUState *cpu, int *excp_ret)
     bool target_aarch64 = true;
     CPUState *target_cpu_state;
     ARMCPU *target_cpu;
-    target_ulong entry;
+    uint64_t entry;
     int target_el = 1;
     int32_t ret = 0;
 
Signature · 1 line
2.53.0
#8 lore raw

PATCH v2 7/9 target/arm: Compile HVF as common object

In reply to Philippe Mathieu-Daudé

Neither of hvf.c nor hyp_gdbstub.c use target-specific code. Move them from arm_system_ss[] to arm_common_system_ss[] to compile them once.

---
 target/arm/hvf/meson.build | 2 +-
 target/arm/meson.build     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
target/arm/hvf/meson.build +1 -1
index afc509a470e..ccb0d338af6 100644
@@ -1,3 +1,3 @@
-arm_system_ss.add(when: [hvf, 'CONFIG_HVF'], if_true: files(
+arm_common_system_ss.add(when: [hvf, 'CONFIG_HVF'], if_true: files(
   'hvf.c',
 ))
target/arm/meson.build +1 -1
index 6e0e504a403..f14debc6a2f 100644
@@ -20,7 +20,6 @@ arm_common_system_ss.add(files(
   'arm-qmp-cmds.c',
 ))
 arm_system_ss.add(when: 'CONFIG_KVM', if_true: files('hyp_gdbstub.c', 'kvm.c'))
-arm_system_ss.add(when: 'CONFIG_HVF', if_true: files('hyp_gdbstub.c'))
 
 arm_user_ss.add(files('cpu.c'))
 arm_user_ss.add(when: 'TARGET_AARCH64', if_false: files(
@@ -41,6 +40,7 @@ arm_common_system_ss.add(files('cpu.c'))
 arm_common_system_ss.add(when: 'TARGET_AARCH64', if_false: files(
   'cpu32-stubs.c'))
 arm_common_system_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c'))
+arm_common_system_ss.add(when: 'CONFIG_HVF', if_true: files('hyp_gdbstub.c'))
 arm_common_system_ss.add(when: 'CONFIG_ARM_COMPATIBLE_SEMIHOSTING',
 		                 if_true: files('common-semi-target.c'))
 arm_common_system_ss.add(files(
Signature · 1 line
2.53.0
#9 lore raw

PATCH v2 8/9 target/arm: Remove target_ulong cast in kvm_arm_handle_dabt_nisv()

In reply to Philippe Mathieu-Daudé

kvm_arm_handle_dabt_nisv() uses a uint64_t type for its @fault_ipa argument since its introduction in commit 694bcaa81f4 ("target/arm:
kvm: Handle DABT with no valid ISS"). Use the proper format and remove the pointless cast.

---
 target/arm/kvm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
target/arm/kvm.c +1 -2
index d4a68874b88..c09dc4cb3dc 100644
@@ -1453,8 +1453,7 @@ static int kvm_arm_handle_dabt_nisv(ARMCPU *cpu, uint64_t esr_iss,
         }
     } else {
         error_report("Data abort exception triggered by guest memory access "
-                     "at physical address: 0x"  TARGET_FMT_lx,
-                     (target_ulong)fault_ipa);
+                     "at physical address: 0x%08"  PRIx64, fault_ipa);
         error_printf("KVM unable to emulate faulting instruction.\n");
     }
     return -1;
Signature · 1 line
2.53.0
#10 lore raw

PATCH v2 9/9 target/arm: Compile KVM as common object

In reply to Philippe Mathieu-Daudé

Neither of kvm.c nor hyp_gdbstub.c use target-specific code. Move them from arm_system_ss[] to arm_common_system_ss[] to compile them once. The arm_system_ss[] source set ends up unused, remove it.

---
 target/arm/meson.build | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
target/arm/meson.build +6 -4
index f14debc6a2f..1b5d346d474 100644
@@ -1,7 +1,6 @@
 arm_ss = ss.source_set()
 arm_common_ss = ss.source_set()
 arm_common_system_ss = ss.source_set()
-arm_system_ss = ss.source_set()
 arm_user_ss = ss.source_set()
 
 arm_common_system_ss.add(files('gdbstub.c'))
@@ -19,7 +18,6 @@ arm_common_ss.add(files(
 arm_common_system_ss.add(files(
   'arm-qmp-cmds.c',
 ))
-arm_system_ss.add(when: 'CONFIG_KVM', if_true: files('hyp_gdbstub.c', 'kvm.c'))
 
 arm_user_ss.add(files('cpu.c'))
 arm_user_ss.add(when: 'TARGET_AARCH64', if_false: files(
@@ -39,7 +37,12 @@ arm_user_ss.add(when: 'CONFIG_ARM_COMPATIBLE_SEMIHOSTING',
 arm_common_system_ss.add(files('cpu.c'))
 arm_common_system_ss.add(when: 'TARGET_AARCH64', if_false: files(
   'cpu32-stubs.c'))
-arm_common_system_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c'))
+arm_common_system_ss.add(when: 'CONFIG_KVM', if_true: files(
+  'kvm.c',
+  'hyp_gdbstub.c',
+), if_false: files(
+  'kvm-stub.c',
+))
 arm_common_system_ss.add(when: 'CONFIG_HVF', if_true: files('hyp_gdbstub.c'))
 arm_common_system_ss.add(when: 'CONFIG_ARM_COMPATIBLE_SEMIHOSTING',
 		                 if_true: files('common-semi-target.c'))
@@ -67,7 +70,6 @@ else
 endif
 
 target_arch += {'arm': arm_ss}
-target_system_arch += {'arm': arm_system_ss}
 target_user_arch += {'arm': arm_user_ss}
 target_common_arch += {'arm': arm_common_ss}
 target_common_system_arch += {'arm': arm_common_system_ss}
Signature · 1 line
2.53.0