qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PULL 21/63] kvm: use configs/ definition to conditionalize debug support
Date: Tue, 23 Apr 2024 17:09:09 +0200	[thread overview]
Message-ID: <20240423150951.41600-22-pbonzini@redhat.com> (raw)
In-Reply-To: <20240423150951.41600-1-pbonzini@redhat.com>

If an architecture adds support for KVM_CAP_SET_GUEST_DEBUG but QEMU does not
have the necessary code, QEMU will fail to build after updating kernel headers.
Avoid this by using a #define in config-target.h instead of KVM_CAP_SET_GUEST_DEBUG.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configs/targets/aarch64-softmmu.mak |  1 +
 configs/targets/i386-softmmu.mak    |  1 +
 configs/targets/ppc-softmmu.mak     |  1 +
 configs/targets/ppc64-softmmu.mak   |  1 +
 configs/targets/s390x-softmmu.mak   |  1 +
 configs/targets/x86_64-softmmu.mak  |  1 +
 include/sysemu/kvm.h                |  2 +-
 include/sysemu/kvm_int.h            |  2 +-
 accel/kvm/kvm-accel-ops.c           |  4 ++--
 accel/kvm/kvm-all.c                 | 10 +++++-----
 10 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/configs/targets/aarch64-softmmu.mak b/configs/targets/aarch64-softmmu.mak
index b4338e95680..83c22391a69 100644
--- a/configs/targets/aarch64-softmmu.mak
+++ b/configs/targets/aarch64-softmmu.mak
@@ -1,5 +1,6 @@
 TARGET_ARCH=aarch64
 TARGET_BASE_ARCH=arm
 TARGET_SUPPORTS_MTTCG=y
+TARGET_KVM_HAVE_GUEST_DEBUG=y
 TARGET_XML_FILES= gdb-xml/aarch64-core.xml gdb-xml/aarch64-fpu.xml gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml gdb-xml/arm-m-profile-mve.xml gdb-xml/aarch64-pauth.xml
 TARGET_NEED_FDT=y
diff --git a/configs/targets/i386-softmmu.mak b/configs/targets/i386-softmmu.mak
index 6b3c99fc86c..d61b5076134 100644
--- a/configs/targets/i386-softmmu.mak
+++ b/configs/targets/i386-softmmu.mak
@@ -1,4 +1,5 @@
 TARGET_ARCH=i386
 TARGET_SUPPORTS_MTTCG=y
 TARGET_NEED_FDT=y
+TARGET_KVM_HAVE_GUEST_DEBUG=y
 TARGET_XML_FILES= gdb-xml/i386-32bit.xml
diff --git a/configs/targets/ppc-softmmu.mak b/configs/targets/ppc-softmmu.mak
index 774440108f7..f3ea9c98f75 100644
--- a/configs/targets/ppc-softmmu.mak
+++ b/configs/targets/ppc-softmmu.mak
@@ -1,4 +1,5 @@
 TARGET_ARCH=ppc
 TARGET_BIG_ENDIAN=y
+TARGET_KVM_HAVE_GUEST_DEBUG=y
 TARGET_XML_FILES= gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml
 TARGET_NEED_FDT=y
diff --git a/configs/targets/ppc64-softmmu.mak b/configs/targets/ppc64-softmmu.mak
index ddf0c39617f..1db8d8381d0 100644
--- a/configs/targets/ppc64-softmmu.mak
+++ b/configs/targets/ppc64-softmmu.mak
@@ -2,5 +2,6 @@ TARGET_ARCH=ppc64
 TARGET_BASE_ARCH=ppc
 TARGET_BIG_ENDIAN=y
 TARGET_SUPPORTS_MTTCG=y
+TARGET_KVM_HAVE_GUEST_DEBUG=y
 TARGET_XML_FILES= gdb-xml/power64-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml gdb-xml/power-vsx.xml
 TARGET_NEED_FDT=y
diff --git a/configs/targets/s390x-softmmu.mak b/configs/targets/s390x-softmmu.mak
index 70d2f9f0ba0..b22218aacc8 100644
--- a/configs/targets/s390x-softmmu.mak
+++ b/configs/targets/s390x-softmmu.mak
@@ -1,4 +1,5 @@
 TARGET_ARCH=s390x
 TARGET_BIG_ENDIAN=y
 TARGET_SUPPORTS_MTTCG=y
+TARGET_KVM_HAVE_GUEST_DEBUG=y
 TARGET_XML_FILES= gdb-xml/s390x-core64.xml gdb-xml/s390-acr.xml gdb-xml/s390-fpr.xml gdb-xml/s390-vx.xml gdb-xml/s390-cr.xml gdb-xml/s390-virt.xml gdb-xml/s390-virt-kvm.xml gdb-xml/s390-gs.xml
diff --git a/configs/targets/x86_64-softmmu.mak b/configs/targets/x86_64-softmmu.mak
index 197817c9434..c5f882e5ba1 100644
--- a/configs/targets/x86_64-softmmu.mak
+++ b/configs/targets/x86_64-softmmu.mak
@@ -2,4 +2,5 @@ TARGET_ARCH=x86_64
 TARGET_BASE_ARCH=i386
 TARGET_SUPPORTS_MTTCG=y
 TARGET_NEED_FDT=y
+TARGET_KVM_HAVE_GUEST_DEBUG=y
 TARGET_XML_FILES= gdb-xml/i386-64bit.xml
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index fad9a7e8ff3..2cba899270c 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -224,7 +224,7 @@ void kvm_flush_coalesced_mmio_buffer(void);
  * calling down to kvm_arch_update_guest_debug after the generic
  * fields have been set.
  */
-#ifdef KVM_CAP_SET_GUEST_DEBUG
+#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)
diff --git a/include/sysemu/kvm_int.h b/include/sysemu/kvm_int.h
index 882e37e12c5..94488d2c1a2 100644
--- a/include/sysemu/kvm_int.h
+++ b/include/sysemu/kvm_int.h
@@ -78,7 +78,7 @@ struct KVMState
     struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
     bool coalesced_flush_in_progress;
     int vcpu_events;
-#ifdef KVM_CAP_SET_GUEST_DEBUG
+#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
     QTAILQ_HEAD(, kvm_sw_breakpoint) kvm_sw_breakpoints;
 #endif
     int max_nested_state_len;
diff --git a/accel/kvm/kvm-accel-ops.c b/accel/kvm/kvm-accel-ops.c
index b3c946dc4b4..f5ac643fca3 100644
--- a/accel/kvm/kvm-accel-ops.c
+++ b/accel/kvm/kvm-accel-ops.c
@@ -85,7 +85,7 @@ static bool kvm_cpus_are_resettable(void)
     return !kvm_enabled() || kvm_cpu_check_are_resettable();
 }
 
-#ifdef KVM_CAP_SET_GUEST_DEBUG
+#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
 static int kvm_update_guest_debug_ops(CPUState *cpu)
 {
     return kvm_update_guest_debug(cpu, 0);
@@ -104,7 +104,7 @@ static void kvm_accel_ops_class_init(ObjectClass *oc, void *data)
     ops->synchronize_state = kvm_cpu_synchronize_state;
     ops->synchronize_pre_loadvm = kvm_cpu_synchronize_pre_loadvm;
 
-#ifdef KVM_CAP_SET_GUEST_DEBUG
+#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;
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 931f74256e8..d58916e33ae 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -2360,7 +2360,7 @@ static int kvm_init(MachineState *ms)
     s->sigmask_len = 8;
     accel_blocker_init();
 
-#ifdef KVM_CAP_SET_GUEST_DEBUG
+#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
     QTAILQ_INIT(&s->kvm_sw_breakpoints);
 #endif
     QLIST_INIT(&s->kvm_parked_vcpus);
@@ -2544,7 +2544,7 @@ static int kvm_init(MachineState *ms)
     kvm_vm_attributes_allowed =
         (kvm_check_extension(s, KVM_CAP_VM_ATTRIBUTES) > 0);
 
-#ifdef KVM_CAP_SET_GUEST_DEBUG
+#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
     kvm_has_guest_debug =
         (kvm_check_extension(s, KVM_CAP_SET_GUEST_DEBUG) > 0);
 #endif
@@ -2553,7 +2553,7 @@ static int kvm_init(MachineState *ms)
     if (kvm_has_guest_debug) {
         kvm_sstep_flags = SSTEP_ENABLE;
 
-#if defined KVM_CAP_SET_GUEST_DEBUG2
+#if defined TARGET_KVM_HAVE_GUEST_DEBUG
         int guest_debug_flags =
             kvm_check_extension(s, KVM_CAP_SET_GUEST_DEBUG2);
 
@@ -3157,7 +3157,7 @@ bool kvm_arm_supports_user_irq(void)
     return kvm_check_extension(kvm_state, KVM_CAP_ARM_USER_IRQ);
 }
 
-#ifdef KVM_CAP_SET_GUEST_DEBUG
+#ifdef TARGET_KVM_HAVE_GUEST_DEBUG
 struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUState *cpu, vaddr pc)
 {
     struct kvm_sw_breakpoint *bp;
@@ -3317,7 +3317,7 @@ void kvm_remove_all_breakpoints(CPUState *cpu)
     }
 }
 
-#endif /* !KVM_CAP_SET_GUEST_DEBUG */
+#endif /* !TARGET_KVM_HAVE_GUEST_DEBUG */
 
 static int kvm_set_signal_mask(CPUState *cpu, const sigset_t *sigset)
 {
-- 
2.44.0




  parent reply	other threads:[~2024-04-23 15:18 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23 15:08 [PULL 00/63] First batch of i386 and build system patch for QEMU 9.1 Paolo Bonzini
2024-04-23 15:08 ` [PULL 01/63] meson: do not link pixman automatically into all targets Paolo Bonzini
2024-04-23 15:08 ` [PULL 02/63] tests: only build plugins if TCG is enabled Paolo Bonzini
2024-04-23 15:08 ` [PULL 03/63] ebpf: Restrict to system emulation Paolo Bonzini
2024-04-23 15:08 ` [PULL 04/63] tests/unit: match some unit tests to corresponding feature switches Paolo Bonzini
2024-04-23 15:08 ` [PULL 05/63] yank: only build if needed Paolo Bonzini
2024-04-23 15:08 ` [PULL 06/63] util/qemu-config: Extract QMP commands to qemu-config-qmp.c Paolo Bonzini
2024-04-23 15:08 ` [PULL 07/63] hw/core: Move system emulation files to system_ss Paolo Bonzini
2024-04-23 15:08 ` [PULL 08/63] hw: Include minimal source set in user emulation build Paolo Bonzini
2024-04-23 15:08 ` [PULL 09/63] stubs: remove obsolete stubs Paolo Bonzini
2024-04-23 15:08 ` [PULL 10/63] hw/usb: move stubs out of stubs/ Paolo Bonzini
2024-04-23 15:08 ` [PULL 11/63] hw/virtio: " Paolo Bonzini
2024-08-03  2:29   ` Michael Tokarev
2024-09-05 16:27     ` Paolo Bonzini
2024-09-06  7:08       ` Michael Tokarev
2024-09-06  7:30         ` Paolo Bonzini
2024-04-23 15:09 ` [PULL 12/63] semihosting: " Paolo Bonzini
2024-04-23 15:09 ` [PULL 13/63] ramfb: " Paolo Bonzini
2024-04-23 15:09 ` [PULL 14/63] memory-device: " Paolo Bonzini
2024-04-23 15:09 ` [PULL 15/63] colo: " Paolo Bonzini
2024-04-23 15:09 ` [PULL 16/63] stubs: split record/replay stubs further Paolo Bonzini
2024-04-23 15:09 ` [PULL 17/63] stubs: include stubs only if needed Paolo Bonzini
2024-06-04 10:07   ` Daniel P. Berrangé
2024-06-05 14:46     ` Zhao Liu
2024-04-23 15:09 ` [PULL 18/63] stubs: move monitor_fdsets_cleanup with other fdset stubs Paolo Bonzini
2024-04-23 15:09 ` [PULL 19/63] vga: optimize computation of dirty memory region Paolo Bonzini
2024-04-23 15:09 ` [PULL 20/63] vga: move dirty memory region code together Paolo Bonzini
2024-04-23 15:09 ` Paolo Bonzini [this message]
2024-04-23 15:09 ` [PULL 22/63] hw: Add compat machines for 9.1 Paolo Bonzini
2024-04-23 15:09 ` [PULL 23/63] target/i386: add guest-phys-bits cpu property Paolo Bonzini
2024-04-23 15:09 ` [PULL 24/63] kvm: add support for guest physical bits Paolo Bonzini
2024-04-23 15:09 ` [PULL 25/63] i386/kvm: Move architectural CPUID leaf generation to separate helper Paolo Bonzini
2024-04-23 15:29   ` Xiaoyao Li
2024-04-23 15:09 ` [PULL 26/63] target/i386: Introduce Icelake-Server-v7 to enable TSX Paolo Bonzini
2024-04-23 15:09 ` [PULL 27/63] target/i386: Add new CPU model SierraForest Paolo Bonzini
2024-04-23 15:09 ` [PULL 28/63] target/i386: Export RFDS bit to guests Paolo Bonzini
2024-04-23 15:09 ` [PULL 29/63] pci-host/q35: Move PAM initialization above SMRAM initialization Paolo Bonzini
2025-08-12 14:20   ` Michael Tokarev
2025-08-12 14:40     ` Michael Tokarev
2024-04-23 15:09 ` [PULL 30/63] q35: Introduce smm_ranges property for q35-pci-host Paolo Bonzini
2025-08-12 14:45   ` Philippe Mathieu-Daudé
2025-08-12 15:27   ` Michael Tokarev
2025-09-17 14:23     ` Michael Tokarev
2025-09-18  9:20       ` Gerd Hoffmann
2025-09-18  9:27         ` Michael Tokarev
2025-09-18 10:25           ` Gerd Hoffmann
2024-04-23 15:09 ` [PULL 31/63] hw/i386/acpi: Set PCAT_COMPAT bit only when pic is not disabled Paolo Bonzini
2024-04-23 15:09 ` [PULL 32/63] confidential guest support: Add kvm_init() and kvm_reset() in class Paolo Bonzini
2024-04-23 15:09 ` [PULL 33/63] i386/sev: Switch to use confidential_guest_kvm_init() Paolo Bonzini
2024-04-23 15:09 ` [PULL 34/63] ppc/pef: switch to use confidential_guest_kvm_init/reset() Paolo Bonzini
2024-04-23 15:09 ` [PULL 35/63] s390: Switch to use confidential_guest_kvm_init() Paolo Bonzini
2024-04-23 15:09 ` [PULL 36/63] scripts/update-linux-headers: Add setup_data.h to import list Paolo Bonzini
2024-04-23 15:09 ` [PULL 37/63] scripts/update-linux-headers: Add bits.h to file imports Paolo Bonzini
2024-04-23 15:09 ` [PULL 38/63] linux-headers: update to current kvm/next Paolo Bonzini
2024-04-23 15:09 ` [PULL 39/63] runstate: skip initial CPU reset if reset is not actually possible Paolo Bonzini
2024-04-23 15:09 ` [PULL 40/63] KVM: track whether guest state is encrypted Paolo Bonzini
2024-04-23 15:09 ` [PULL 41/63] KVM: remove kvm_arch_cpu_check_are_resettable Paolo Bonzini
2024-04-23 15:09 ` [PULL 42/63] target/i386: introduce x86-confidential-guest Paolo Bonzini
2024-04-23 15:09 ` [PULL 43/63] target/i386: Implement mc->kvm_type() to get VM type Paolo Bonzini
2024-04-24  8:36   ` Xiaoyao Li
2024-04-23 15:09 ` [PULL 44/63] target/i386: SEV: use KVM_SEV_INIT2 if possible Paolo Bonzini
2024-04-23 15:09 ` [PULL 45/63] i386/sev: Add 'legacy-vm-type' parameter for SEV guest objects Paolo Bonzini
2024-04-23 15:09 ` [PULL 46/63] hw/i386/sev: Use legacy SEV VM types for older machine types Paolo Bonzini
2024-04-23 15:09 ` [PULL 47/63] trace/kvm: Split address space and slot id in trace_kvm_set_user_memory() Paolo Bonzini
2024-04-23 15:09 ` [PULL 48/63] kvm: Introduce support for memory_attributes Paolo Bonzini
2024-04-23 15:09 ` [PULL 49/63] RAMBlock: Add support of KVM private guest memfd Paolo Bonzini
2024-04-23 15:09 ` [PULL 50/63] kvm: Enable KVM_SET_USER_MEMORY_REGION2 for memslot Paolo Bonzini
2024-04-23 15:09 ` [PULL 51/63] kvm/memory: Make memory type private by default if it has guest memfd backend Paolo Bonzini
2024-04-23 15:09 ` [PULL 52/63] HostMem: Add mechanism to opt in kvm guest memfd via MachineState Paolo Bonzini
2024-04-23 15:09 ` [PULL 53/63] RAMBlock: make guest_memfd require uncoordinated discard Paolo Bonzini
2024-04-23 15:09 ` [PULL 54/63] physmem: Introduce ram_block_discard_guest_memfd_range() Paolo Bonzini
2024-04-23 15:09 ` [PULL 55/63] kvm: handle KVM_EXIT_MEMORY_FAULT Paolo Bonzini
2024-04-26 13:40   ` Peter Maydell
2024-04-30 19:06     ` Paolo Bonzini
2024-04-23 15:09 ` [PULL 56/63] kvm/tdx: Don't complain when converting vMMIO region to shared Paolo Bonzini
2024-04-23 15:09 ` [PULL 57/63] kvm/tdx: Ignore memory conversion to shared of unassigned region Paolo Bonzini
2024-04-23 15:09 ` [PULL 58/63] target/i386/host-cpu: Consolidate the use of warn_report_once() Paolo Bonzini
2024-04-23 15:09 ` [PULL 59/63] target/i386/cpu: " Paolo Bonzini
2024-04-23 15:09 ` [PULL 60/63] target/i386/cpu: Merge the warning and error messages for AMD HT check Paolo Bonzini
2024-04-23 15:09 ` [PULL 61/63] accel/tcg/icount-common: Consolidate the use of warn_report_once() Paolo Bonzini
2024-04-23 15:09 ` [PULL 62/63] pythondeps.toml: warn about updates needed to docs/requirements.txt Paolo Bonzini
2024-04-23 15:09 ` [PULL 63/63] target/i386/translate.c: always write 32-bits for SGDT and SIDT Paolo Bonzini
2024-04-24  4:26 ` [PULL 00/63] First batch of i386 and build system patch for QEMU 9.1 Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240423150951.41600-22-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).