qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: cohuck@redhat.com, mst@redhat.com, alex.bennee@linaro.org,
	mlevitsk@redhat.com
Subject: [PATCH 5/5] kvm: add support for KVM_GUESTDBG_BLOCKIRQ
Date: Thu, 11 Nov 2021 12:06:04 +0100	[thread overview]
Message-ID: <20211111110604.207376-6-pbonzini@redhat.com> (raw)
In-Reply-To: <20211111110604.207376-1-pbonzini@redhat.com>

From: Maxim Levitsky <mlevitsk@redhat.com>

Use the KVM_GUESTDBG_BLOCKIRQ debug flag if supported. 

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
[Extracted from Maxim's patch into a separate commit. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 accel/kvm/kvm-all.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 2f5597572a..0e66ebb497 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -61,6 +61,10 @@
 #endif
 #define PAGE_SIZE qemu_real_host_page_size
 
+#ifndef KVM_GUESTDBG_BLOCKIRQ
+#define KVM_GUESTDBG_BLOCKIRQ 0
+#endif
+
 //#define DEBUG_KVM
 
 #ifdef DEBUG_KVM
@@ -2574,6 +2578,15 @@ static int kvm_init(MachineState *ms)
     kvm_sstep_flags = 0;
     if (kvm_has_guest_debug) {
         kvm_sstep_flags = SSTEP_ENABLE;
+
+#if defined KVM_CAP_SET_GUEST_DEBUG2
+        int guest_debug_flags =
+            kvm_check_extension(s, KVM_CAP_SET_GUEST_DEBUG2);
+
+        if (guest_debug_flags & KVM_GUESTDBG_BLOCKIRQ) {
+            kvm_sstep_flags |= SSTEP_NOIRQ;
+        }
+#endif
     }
 
     kvm_state = s;
@@ -3205,6 +3218,10 @@ int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap)
 
     if (cpu->singlestep_enabled) {
         data.dbg.control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_SINGLESTEP;
+
+        if (cpu->singlestep_enabled & SSTEP_NOIRQ) {
+            data.dbg.control |= KVM_GUESTDBG_BLOCKIRQ;
+        }
     }
     kvm_arch_update_guest_debug(cpu, &data.dbg);
 
-- 
2.33.1



  parent reply	other threads:[~2021-11-11 11:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11 11:05 [PATCH 0/5] Update linux-headers + NOIRQ support for KVM gdbstub Paolo Bonzini
2021-11-11 11:06 ` [PATCH 1/5] virtio-gpu: do not byteswap padding Paolo Bonzini
2021-11-11 11:28   ` Cornelia Huck
2021-11-11 11:32   ` Philippe Mathieu-Daudé
2021-11-11 16:58   ` Michael S. Tsirkin
2021-11-11 17:06   ` Alex Bennée
2021-11-11 11:06 ` [PATCH 2/5] linux-headers: update to 5.16-rc1 Paolo Bonzini
2021-11-11 11:29   ` Cornelia Huck
2021-11-11 17:07   ` Alex Bennée
2021-11-11 11:06 ` [PATCH 3/5] gdbstub: reject unsupported flags in handle_set_qemu_sstep Paolo Bonzini
2021-11-11 11:38   ` Philippe Mathieu-Daudé
2021-11-11 17:16     ` Paolo Bonzini
2021-11-11 17:08   ` Alex Bennée
2021-11-11 19:29     ` Paolo Bonzini
2021-11-11 11:06 ` [PATCH 4/5] gdbstub, kvm: let KVM report supported singlestep flags Paolo Bonzini
2021-11-11 17:14   ` Alex Bennée
2021-11-11 11:06 ` Paolo Bonzini [this message]
2021-11-11 16:31   ` [PATCH 5/5] kvm: add support for KVM_GUESTDBG_BLOCKIRQ Philippe Mathieu-Daudé
2021-11-11 17:17   ` Alex Bennée

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=20211111110604.207376-6-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=cohuck@redhat.com \
    --cc=mlevitsk@redhat.com \
    --cc=mst@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).