iommu/vt-d: only unmap mapped entries
authorOmer Peleg <omer@cs.technion.ac.il>
Wed, 20 Apr 2016 08:33:25 +0000 (11:33 +0300)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Wed, 20 Apr 2016 19:06:01 +0000 (15:06 -0400)
commit769530e4ba4898748a293592f0920275b40cbb93
tree742a945e9b655c98cc8a0e4225640f9ea5e7254f
parentf5c0c08b1e0976cb493d503108f1b897ce58bc5d
iommu/vt-d: only unmap mapped entries

Current unmap implementation unmaps the entire area covered by the IOVA
range, which is a power-of-2 aligned region. The corresponding map,
however, only maps those pages originally mapped by the user. This
discrepancy can lead to unmapping of already unmapped entries, which is
unneeded work.

With this patch, only mapped pages are unmapped. This is also a baseline
for a map/unmap implementation based on IOVAs and not iova structures,
which will allow caching.

Signed-off-by: Omer Peleg <omer@cs.technion.ac.il>
[mad@cs.technion.ac.il: rebased and reworded the commit message]
Signed-off-by: Adam Morrison <mad@cs.technion.ac.il>
Reviewed-by: Shaohua Li <shli@fb.com>
Reviewed-by: Ben Serebrin <serebrin@google.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/iommu/intel-iommu.c