VT-d: re-order register restoring in vtd_resume()
authorJan Beulich <jbeulich@suse.com>
Tue, 30 Mar 2021 12:39:54 +0000 (14:39 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 30 Mar 2021 12:39:54 +0000 (14:39 +0200)
commit95e07f8c0e64889ee56015c7f99bdf5309e9e8ef
treec8ae135bac57671e075abac56c07183e49b9af03
parent0d597e7bd1bd8a57619690d457f79769777a5834
VT-d: re-order register restoring in vtd_resume()

For one FECTL must be written last - the interrupt shouldn't be unmasked
without first having written the data and address needed to actually
deliver it. In the common case (when dma_msi_set_affinity() doesn't end
up bailing early) this happens from init_vtd_hw(), but for this to
actually have the intended effect we shouldn't subsequently overwrite
what was written there - this is only benign when old and new settings
match. Instead we should restore the registers ahead of calling
init_vtd_hw(), just for the unlikely case of dma_msi_set_affinity()
bailing early.

In the moved code drop some stray casts as well.

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