KVM: Integrate gfn_to_memslot_approx() into search_memslots()
authorMaciej S. Szmigiero <maciej.szmigiero@oracle.com>
Mon, 6 Dec 2021 19:54:25 +0000 (20:54 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 8 Dec 2021 09:24:30 +0000 (04:24 -0500)
commitc928bfc2632fa3dd6a3bd4504ac6d8e42302287a
tree79d34395cf30656db4734e314a56e1aeeefcaf42
parentf5756029eef501bcd39ecd844968e4fb3055c1bd
KVM: Integrate gfn_to_memslot_approx() into search_memslots()

s390 arch has gfn_to_memslot_approx() which is almost identical to
search_memslots(), differing only in that in case the gfn falls in a hole
one of the memslots bordering the hole is returned.

Add this lookup mode as an option to search_memslots() so we don't have two
almost identical functions for looking up a memslot by its gfn.

Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
[sean: tweaked helper names to keep gfn_to_memslot_approx() in s390]
Reviewed-by: Sean Christopherson <seanjc@google.com>
Message-Id: <171cd89b52c718dbe180ecd909b4437a64a7e2ec.1638817640.git.maciej.szmigiero@oracle.com>
arch/s390/kvm/kvm-s390.c
include/linux/kvm_host.h
virt/kvm/kvm_main.c