AMD/IOMMU: have callers specify the target level for page table walks
authorJan Beulich <jbeulich@suse.com>
Fri, 22 Apr 2022 12:51:37 +0000 (14:51 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 22 Apr 2022 12:51:37 +0000 (14:51 +0200)
commit5fafa6cf529a6c0cd0b12c920a2cc68a3cca99e1
tree8f3d535fbac8b92e273ad5173dce0530ecff5982
parent43f3d51139178a03823b061482c674e15ce3d49c
AMD/IOMMU: have callers specify the target level for page table walks

In order to be able to insert/remove super-pages we need to allow
callers of the walking function to specify at which point to stop the
walk. (For now at least gcc will instantiate just a variant of the
function with the parameter eliminated, so effectively no change to
generated code as far as the parameter addition goes.)

Instead of merely adjusting a BUG_ON() condition, convert it into an
error return - there's no reason to crash the entire host in that case.
Leave an assertion though for spotting issues early in debug builds.

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