KVM: selftests: dirty-log: Use KVM_CAP_DIRTY_LOG_RING_ACQ_REL if available
[platform/kernel/linux-starfive.git] / tools / testing / selftests / kvm / lib / kvm_util.c
index 9889fe0..411a4c0 100644 (file)
@@ -82,7 +82,10 @@ unsigned int kvm_check_cap(long cap)
 
 void vm_enable_dirty_ring(struct kvm_vm *vm, uint32_t ring_size)
 {
-       vm_enable_cap(vm, KVM_CAP_DIRTY_LOG_RING, ring_size);
+       if (vm_check_cap(vm, KVM_CAP_DIRTY_LOG_RING_ACQ_REL))
+               vm_enable_cap(vm, KVM_CAP_DIRTY_LOG_RING_ACQ_REL, ring_size);
+       else
+               vm_enable_cap(vm, KVM_CAP_DIRTY_LOG_RING, ring_size);
        vm->dirty_ring_size = ring_size;
 }