VT-d: undo device mappings upon error
authorJan Beulich <jbeulich@suse.com>
Thu, 15 Jul 2021 07:31:55 +0000 (09:31 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 15 Jul 2021 07:31:55 +0000 (09:31 +0200)
commit1dae9fd19fd44e5912169bb916192438be1b4479
tree6f7582db0d9ea66b9419149332d51b3ccae3bea4
parent64d93d6d414c8cb8d88afd08c544773f1c13d9aa
VT-d: undo device mappings upon error

When
 - flushes (supposedly not possible anymore after XSA-373),
 - secondary mappings for legacy PCI devices behind bridges,
 - secondary mappings for chipset quirks, or
 - find_upstream_bridge() invocations
fail, the successfully established device mappings should not be left
around.

Further, when (parts of) unmapping fail, simply returning an error is
typically not enough. Crash the domain instead in such cases, arranging
for domain cleanup to continue in a best effort manner despite such
failures.

Finally make domain_context_unmap()'s error behavior consistent in the
legacy PCI device case: Don't bail from the function in one special
case, but always just exit the switch statement.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul@xen.org>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
master commit: f3401d65d9f0dce508c3d7da55de4a093d748ae1
master date: 2021-06-24 16:28:25 +0200
xen/drivers/passthrough/vtd/iommu.c