[PATCH RFC 1/2] accel/kvm: Introduce kvm_dirty_log_manual_enabled

yong.huang@smartx.com posted 2 patches 1 month ago
[PATCH RFC 1/2] accel/kvm: Introduce kvm_dirty_log_manual_enabled
Posted by yong.huang@smartx.com 1 month ago
From: Hyman Huang <yong.huang@smartx.com>

Introudce kvm_dirty_log_manual_enabled to indicate if dirty
logging manually was enabled in KVM.

The kvm_dirty_log_manual_enabled will be used in the next commit.

Signed-off-by: Hyman Huang <yong.huang@smartx.com>
---
 accel/kvm/kvm-all.c  | 2 ++
 include/sysemu/kvm.h | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 801cff16a5..a0f3e6e493 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -93,6 +93,7 @@ bool kvm_allowed;
 bool kvm_readonly_mem_allowed;
 bool kvm_vm_attributes_allowed;
 bool kvm_msi_use_devid;
+bool kvm_dirty_log_manual;
 static bool kvm_has_guest_debug;
 static int kvm_sstep_flags;
 static bool kvm_immediate_exit;
@@ -2537,6 +2538,7 @@ static int kvm_setup_dirty_ring(KVMState *s)
                             dirty_log_manual_caps);
                 s->manual_dirty_log_protect = 0;
             }
+            kvm_dirty_log_manual = true;
         }
     }
 
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index c3a60b2890..f38f2818e1 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -42,6 +42,7 @@ extern bool kvm_gsi_routing_allowed;
 extern bool kvm_gsi_direct_mapping;
 extern bool kvm_readonly_mem_allowed;
 extern bool kvm_msi_use_devid;
+extern bool kvm_dirty_log_manual;
 
 #define kvm_enabled()           (kvm_allowed)
 /**
@@ -143,6 +144,12 @@ extern bool kvm_msi_use_devid;
  */
 #define kvm_msi_devid_required() (kvm_msi_use_devid)
 
+/**
+ * kvm_dirty_log_manual_enabled:
+ * Returns: true if dirty logging manually was enabled.
+ */
+#define kvm_dirty_log_manual_enabled() (kvm_dirty_log_manual)
+
 #else
 
 #define kvm_enabled()           (0)
@@ -157,6 +164,7 @@ extern bool kvm_msi_use_devid;
 #define kvm_gsi_direct_mapping() (false)
 #define kvm_readonly_mem_enabled() (false)
 #define kvm_msi_devid_required() (false)
+#define kvm_dirty_log_manual_enabled() (false)
 
 #endif  /* CONFIG_KVM_IS_POSSIBLE */
 
-- 
2.27.0