kernel-ark/virt/kvm
Greg Edwards 27ef63c7e9 KVM: IOMMU: hva align mapping page size
When determining the page size we could use to map with the IOMMU, the
page size should also be aligned with the hva, not just the gfn.  The
gfn may not reflect the real alignment within the hugetlbfs file.

Most of the time, this works fine.  However, if the hugetlbfs file is
backed by non-contiguous huge pages, a multi-huge page memslot starts at
an unaligned offset within the hugetlbfs file, and the gfn is aligned
with respect to the huge page size, kvm_host_page_size() will return the
huge page size and we will use that to map with the IOMMU.

When we later unpin that same memslot, the IOMMU returns the unmap size
as the huge page size, and we happily unpin that many pfns in
monotonically increasing order, not realizing we are spanning
non-contiguous huge pages and partially unpin the wrong huge page.

Ensure the IOMMU mapping page size is aligned with the hva corresponding
to the gfn, which does reflect the alignment within the hugetlbfs file.

Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Greg Edwards <gedwards@ddn.com>
Cc: stable@vger.kernel.org
Signed-off-by: Gleb Natapov <gleb@redhat.com>
2013-11-05 09:55:36 +02:00
..
arm ARM: KVM: Bugfix: vgic_bytemap_get_reg per cpu regs 2013-08-30 16:12:38 +03:00
assigned-dev.c KVM: Move irq routing to generic code 2013-04-26 20:27:17 +02:00
async_pf.c KVM: Drop FOLL_GET in GUP when doing async page fault 2013-10-15 13:43:37 +03:00
async_pf.h KVM: Halt vcpu if page it tries to access is swapped out 2011-01-12 11:21:39 +02:00
coalesced_mmio.c KVM: make checks stricter in coalesced_mmio_in_range() 2011-12-27 11:17:07 +02:00
coalesced_mmio.h KVM: Make coalesced mmio use a device per zone 2011-09-25 19:17:57 +03:00
eventfd.c kvm eventfd: switch to fdget 2013-09-03 23:04:45 -04:00
ioapic.c KVM: Set TMR when programming ioapic entry 2013-04-16 16:32:40 -03:00
ioapic.h KVM: Set TMR when programming ioapic entry 2013-04-16 16:32:40 -03:00
iodev.h KVM: remove in_range from io devices 2009-09-10 08:33:05 +03:00
iommu.c KVM: IOMMU: hva align mapping page size 2013-11-05 09:55:36 +02:00
irq_comm.c KVM: Fix RTC interrupt coalescing tracking 2013-06-27 14:20:53 +03:00
irqchip.c KVM: Move irq routing setup to irqchip.c 2013-04-26 20:27:18 +02:00
Kconfig kvm: Add VFIO device 2013-10-30 19:02:03 +01:00
kvm_main.c Merge branch 'kvm-ppc-queue' of git://github.com/agraf/linux-2.6 into queue 2013-11-04 10:20:57 +02:00
vfio.c kvm: Create non-coherent DMA registeration 2013-10-30 19:02:23 +01:00