Commit 4b3402f1 authored by Marc Zyngier's avatar Marc Zyngier

KVM: selftests: dirty-log: Use KVM_CAP_DIRTY_LOG_RING_ACQ_REL if available

Pick KVM_CAP_DIRTY_LOG_RING_ACQ_REL if exposed by the kernel.
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
Reviewed-by: default avatarGavin Shan <gshan@redhat.com>
Reviewed-by: default avatarPeter Xu <peterx@redhat.com>
Link: https://lore.kernel.org/r/20220926145120.27974-7-maz@kernel.org
parent 4eb6486c
...@@ -265,7 +265,8 @@ static void default_after_vcpu_run(struct kvm_vcpu *vcpu, int ret, int err) ...@@ -265,7 +265,8 @@ static void default_after_vcpu_run(struct kvm_vcpu *vcpu, int ret, int err)
static bool dirty_ring_supported(void) static bool dirty_ring_supported(void)
{ {
return kvm_has_cap(KVM_CAP_DIRTY_LOG_RING); return (kvm_has_cap(KVM_CAP_DIRTY_LOG_RING) ||
kvm_has_cap(KVM_CAP_DIRTY_LOG_RING_ACQ_REL));
} }
static void dirty_ring_create_vm_done(struct kvm_vm *vm) static void dirty_ring_create_vm_done(struct kvm_vm *vm)
......
...@@ -82,7 +82,10 @@ unsigned int kvm_check_cap(long cap) ...@@ -82,7 +82,10 @@ unsigned int kvm_check_cap(long cap)
void vm_enable_dirty_ring(struct kvm_vm *vm, uint32_t ring_size) 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; vm->dirty_ring_size = ring_size;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment