]> git.baikalelectronics.ru Git - kernel.git/commit
iommu/amd: Only unmap large pages from the first pte
authorAlex Williamson <alex.williamson@redhat.com>
Fri, 21 Jun 2013 20:33:19 +0000 (14:33 -0600)
committerJoerg Roedel <joro@8bytes.org>
Sun, 23 Jun 2013 11:57:17 +0000 (13:57 +0200)
commit4abf3772e948389ac476e29cb1141d65b8fda9fa
tree9ea6d021890eb26b83c4c0b98609420bf08598c2
parente7762399eddb2c78d8496dd1b8b21d03f970bf0f
iommu/amd: Only unmap large pages from the first pte

If we use a large mapping, the expectation is that only unmaps from
the first pte in the superpage are supported.  Unmaps from offsets
into the superpage should fail (ie. return zero sized unmap).  In the
current code, unmapping from an offset clears the size of the full
mapping starting from an offset.  For instance, if we map a 16k
physically contiguous range at IOVA 0x0 with a large page, then
attempt to unmap 4k at offset 12k, 4 ptes are cleared (12k - 28k) and
the unmap returns 16k unmapped.  This potentially incorrectly clears
valid mappings and confuses drivers like VFIO that use the unmap size
to release pinned pages.

Fix by refusing to unmap from offsets into the page.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Joerg Roedel <joro@8bytes.org>
drivers/iommu/amd_iommu.c