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)
commit601b737ecd1f780d1f3bddbaa6cfd58b208a79ae
tree5b7725d27456145b030eea2c2730780e3760a170
parentdabbea96f96de7f334277171b98cfc49607ea4b4
intel-iommu: Fix inappropriate use of superpages in __domain_mapping()

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