IOMMU: have iommu_{,un}map() split requests into largest possible chunks
authorJan Beulich <jbeulich@suse.com>
Fri, 20 May 2022 10:23:31 +0000 (12:23 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 20 May 2022 10:23:31 +0000 (12:23 +0200)
commitba3fcb5f52eb2d3cc43b64bad2fc78507ad4fc7a
tree5b3f36397cc3bdb8c981db9e4e37d015b4a433e1
parente0de7c2ee63dc440b41c79c203707abde3a473dc
IOMMU: have iommu_{,un}map() split requests into largest possible chunks

Introduce a helper function to determine the largest possible mapping
that allows covering a request (or the next part of it that is left to
be processed).

In order to not add yet more recurring dfn_add() / mfn_add() to the two
callers of the new helper, also introduce local variables holding the
values presently operated on.

Note that strictly speaking iommu_unmap() doen't need to consult
mapping_order(), as unmapping doesn't require superpage support. This,
however, prevents freeing of deep hierarchies of page tables in vendor
code (once suitably enabled), which otherwise would require dealing with
preemption needs.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
xen/drivers/passthrough/iommu.c