KVM: Mapping IOMMU pages after updating memslot
authorYang Zhang <yang.z.zhang@Intel.com>
Thu, 24 Oct 2013 01:56:39 +0000 (09:56 +0800)
committerChristoffer Dall <christoffer.dall@linaro.org>
Thu, 2 Oct 2014 15:18:16 +0000 (17:18 +0200)
commitb695de83412eb8ff7c77b215fa24bca5b1871618
tree987b4dd75e65644b2bdb6807fbca5e73bde009d3
parent3d6b7ab3028ceacadd0a29b4757a788e24987d10
KVM: Mapping IOMMU pages after updating memslot

In kvm_iommu_map_pages(), we need to know the page size via call
kvm_host_page_size(). And it will check whether the target slot
is valid before return the right page size.
Currently, we will map the iommu pages when creating a new slot.
But we call kvm_iommu_map_pages() during preparing the new slot.
At that time, the new slot is not visible by domain(still in preparing).
So we cannot get the right page size from kvm_host_page_size() and
this will break the IOMMU super page logic.
The solution is to map the iommu pages after we insert the new slot
into domain.

Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
Tested-by: Patrick Lu <patrick.lu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit e0230e1327fb862c9b6cde24ae62d55f9db62c9b)
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
virt/kvm/kvm_main.c