KVM: selftests: Introduce num-pages conversion utilities
authorAndrew Jones <drjones@redhat.com>
Fri, 14 Feb 2020 14:59:20 +0000 (15:59 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 24 Feb 2020 19:05:23 +0000 (20:05 +0100)
commit87a802d93e7ef55216d8884fdf7e5f491a6fe501
tree48eea7b90298e9a8eeb56bb61ee4bc39026b72aa
parent377a41c9ef84181bff5a3af2da9dfd21d6a08911
KVM: selftests: Introduce num-pages conversion utilities

Guests and hosts don't have to have the same page size. This means
calculations are necessary when selecting the number of guest pages
to allocate in order to ensure the number is compatible with the
host. Provide utilities to help with those calculations and apply
them where appropriate.

We also revert commit bffed38d4fb5 ("kvm: selftests: aarch64:
dirty_log_test: fix unaligned memslot size") and then use
vm_adjust_num_guest_pages() there instead.

Signed-off-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/dirty_log_test.c
tools/testing/selftests/kvm/include/kvm_util.h
tools/testing/selftests/kvm/lib/kvm_util.c