VT-d: re-order register restoring in vtd_resume()
authorJan Beulich <jbeulich@suse.com>
Tue, 20 Apr 2021 10:02:35 +0000 (12:02 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 20 Apr 2021 10:02:35 +0000 (12:02 +0200)
commit732cf387c9bb343ac89ddd4a2e713880d62d2b5f
treeab15247aae18eeeceffc4afcbb2790570d83d0bb
parente9f10a9add1fb81475b5c6ef0fbc1b423dac3dad
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>
master commit: 95e07f8c0e64889ee56015c7f99bdf5309e9e8ef
master date: 2021-03-30 14:39:54 +0200
xen/drivers/passthrough/vtd/iommu.c