[libvirt] [PATCH 3/4] qemu: Generate command line for notify VM exit feature

Lin Ma lma at suse.com
Sun Jun 11 13:43:33 UTC 2023


From: Lin Ma <lma at suse.de>

Signed-off-by: Lin Ma <lma at suse.de>
---
 src/qemu/qemu_command.c                  | 20 +++++++++++++++++---
 tests/qemuxml2argvdata/kvm-features.args |  2 +-
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index b82ec4508c..cd9b77497e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7066,9 +7066,23 @@ qemuBuildAccelCommandLine(virCommand *cmd,
          * not that either kvm or tcg can be specified by libvirt
          * so do not worry about the conflict of specifying both
          * */
-        if (def->features[VIR_DOMAIN_FEATURE_KVM] == VIR_TRISTATE_SWITCH_ON &&
-            def->kvm_features->features[VIR_DOMAIN_KVM_DIRTY_RING] == VIR_TRISTATE_SWITCH_ON) {
-            virBufferAsprintf(&buf, ",dirty-ring-size=%d", def->kvm_features->dirty_ring_size);
+        if (def->features[VIR_DOMAIN_FEATURE_KVM] == VIR_TRISTATE_SWITCH_ON) {
+            if (def->kvm_features->features[VIR_DOMAIN_KVM_DIRTY_RING] ==
+                VIR_TRISTATE_SWITCH_ON) {
+                virBufferAsprintf(&buf, ",dirty-ring-size=%d",
+                                  def->kvm_features->dirty_ring_size);
+            }
+
+            if (def->kvm_features->features[VIR_DOMAIN_KVM_NOTIFY_VMEXIT] ==
+                VIR_TRISTATE_SWITCH_ON) {
+                virBufferAsprintf(&buf, ",notify-vmexit=%s",
+                                  def->kvm_features->notify_vmexit.mode);
+                if (def->kvm_features->notify_vmexit.notify_window &&
+                    STRNEQ(def->kvm_features->notify_vmexit.mode, "disable")) {
+                    virBufferAsprintf(&buf, ",notify-window=%u",
+                                      def->kvm_features->notify_vmexit.notify_window);
+                }
+            }
         }
         break;
 
diff --git a/tests/qemuxml2argvdata/kvm-features.args b/tests/qemuxml2argvdata/kvm-features.args
index 985d406ad7..51d5a6aae2 100644
--- a/tests/qemuxml2argvdata/kvm-features.args
+++ b/tests/qemuxml2argvdata/kvm-features.args
@@ -11,7 +11,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
 -S \
 -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes \
 -machine pc,usb=off,dump-guest-core=off \
--accel kvm,dirty-ring-size=4096 \
+-accel kvm,dirty-ring-size=4096,notify-vmexit=run,notify-window=16384 \
 -cpu host,kvm=off,kvm-hint-dedicated=on,kvm-poll-control=on \
 -m 214 \
 -overcommit mem-lock=off \
-- 
2.40.1



More information about the libvir-list mailing list