intel-iommu: Fix inappropriate use of superpages in __domain_mapping()
authorDavid Woodhouse <David.Woodhouse@intel.com>
Sat, 28 May 2011 23:37:43 +0000 (00:37 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Sat, 28 May 2011 23:54:19 +0000 (00:54 +0100)
After deciding to use a superpage, we were blindly continuing to do so
even when the remaining size to be mapped was not enough for another
superpage.

Fix the logic to switch back to smaller pages as necessary.

This means we can remove the bogus comparisons of nr_pages and sg_res
with lvl_pages — they must *never* be smaller. That would mean we'd set
up a mapping which is longer than we were asked to.

Change those checks to BUG_ON() instead.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/pci/intel-iommu.c

Simple merge