Expose the new capability via "query-kvm" QMP command too so we know whether that's turned on on the source VM when we want.
Signed-off-by: Peter Xu <pet...@redhat.com> --- accel/kvm/kvm-all.c | 5 +++++ include/sysemu/kvm.h | 2 ++ qapi/misc.json | 6 +++++- qmp.c | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 062bf8b5b0..c79d6b51e2 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -169,6 +169,11 @@ int kvm_memcrypt_encrypt_data(uint8_t *ptr, uint64_t len) return 1; } +bool kvm_manual_dirty_log_protect_enabled(void) +{ + return kvm_state && kvm_state->manual_dirty_log_protect; +} + /* Must be with slots_lock held */ static KVMSlot *kvm_get_free_slot(KVMMemoryListener *kml) { diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index a6d1cd190f..30757f1425 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -547,4 +547,6 @@ int kvm_set_one_reg(CPUState *cs, uint64_t id, void *source); int kvm_get_one_reg(CPUState *cs, uint64_t id, void *target); struct ppc_radix_page_info *kvm_get_radix_page_info(void); int kvm_get_max_memslots(void); +bool kvm_manual_dirty_log_protect_enabled(void); + #endif diff --git a/qapi/misc.json b/qapi/misc.json index 8b3ca4fdd3..ce7a76755a 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -253,9 +253,13 @@ # # @present: true if KVM acceleration is built into this executable # +# @manual-dirty-log-protect: true if manual dirty log protect is enabled +# # Since: 0.14.0 ## -{ 'struct': 'KvmInfo', 'data': {'enabled': 'bool', 'present': 'bool'} } +{ 'struct': 'KvmInfo', 'data': + {'enabled': 'bool', 'present': 'bool', + 'manual-dirty-log-protect': 'bool' } } ## # @query-kvm: diff --git a/qmp.c b/qmp.c index b92d62cd5f..047bef032e 100644 --- a/qmp.c +++ b/qmp.c @@ -73,6 +73,7 @@ KvmInfo *qmp_query_kvm(Error **errp) info->enabled = kvm_enabled(); info->present = kvm_available(); + info->manual_dirty_log_protect = kvm_manual_dirty_log_protect_enabled(); return info; } -- 2.17.1