KVM: Introduce gfn_to_hva_memslot_prot
authorChristoffer Dall <christoffer.dall@linaro.org>
Tue, 19 Aug 2014 10:15:00 +0000 (12:15 +0200)
committerChristoffer Dall <christoffer.dall@linaro.org>
Thu, 2 Oct 2014 15:19:11 +0000 (17:19 +0200)
commit7ec68cffdc4807a95ae1db300bf857084f0c94da
treeeac807809a142cb88df7909067cd647375b76c02
parentae38cfa961f9605be43060001ccc41d39427cb64
KVM: Introduce gfn_to_hva_memslot_prot

To support read-only memory regions on arm and arm64, we have a need to
resolve a gfn to an hva given a pointer to a memslot to avoid looping
through the memslots twice and to reuse the hva error checking of
gfn_to_hva_prot(), add a new gfn_to_hva_memslot_prot() function and
refactor gfn_to_hva_prot() to use this function.

Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
(cherry picked from commit 64d831269ccbca1fc6d739a0f3c8aa24afb43a5e)
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
include/linux/kvm_host.h
virt/kvm/kvm_main.c