]> xenbits.xensource.com Git - xen.git/commit
AMD/IOMMU: wait for command slot to be available
authorJan Beulich <jbeulich@suse.com>
Tue, 8 Jun 2021 17:29:40 +0000 (18:29 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 8 Jun 2021 17:29:40 +0000 (18:29 +0100)
commitc4e44343579e2c3304d676404d81b2b9bd893c5b
tree33f305ecb1353b875528ca747ec3ee06d6aa76fe
parent8cf276cb2e0b99b96333865873f56b0b31555ff1
AMD/IOMMU: wait for command slot to be available

No caller cared about send_iommu_command() indicating unavailability of
a slot. Hence if a sufficient number prior commands timed out, we did
blindly assume that the requested command was submitted to the IOMMU
when really it wasn't. This could mean both a hanging system (waiting
for a command to complete that was never seen by the IOMMU) or blindly
propagating success back to callers, making them believe they're fine
to e.g. free previously unmapped pages.

Fold the three involved functions into one, add spin waiting for an
available slot along the lines of VT-d's qinval_next_index(), and as a
consequence drop all error indicator return types/values.

This is part of XSA-373 / CVE-2021-28692.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul@xen.org>
xen/drivers/passthrough/amd/iommu_cmd.c