VT-d: adjust domid map updating when unmapping context
authorJan Beulich <jbeulich@suse.com>
Thu, 24 Jun 2021 14:29:13 +0000 (16:29 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 24 Jun 2021 14:29:13 +0000 (16:29 +0200)
commit32655880057ce2829f962d46916ea6cec60f98d3
tree71331977486bed25bd7f29ba3ee5f88e55e03a28
parentf3401d65d9f0dce508c3d7da55de4a093d748ae1
VT-d: adjust domid map updating when unmapping context

When an earlier error occurred, cleaning up the domid mapping data is
wrong, as references likely still exist. The only exception to this is
when the actual unmapping worked, but some flush failed (supposedly
impossible after XSA-373). The guest will get crashed in such a case
though, so add fallback cleanup to domain destruction to cover this
case. This in turn makes it desirable to silence the dprintk() in
domain_iommu_domid().

Note that no error will be returned anymore when the lookup fails - in
the common case lookup failure would already have caused
domain_context_unmap_one() to fail, yet even from a more general
perspective it doesn't look right to fail domain_context_unmap() in such
a case when this was the last device, but not when any earlier unmap was
otherwise successful.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
xen/drivers/passthrough/vtd/iommu.c