VT-d: install sync_cache hook on demand
authorJan Beulich <jbeulich@suse.com>
Fri, 17 Jul 2020 15:48:42 +0000 (17:48 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 17 Jul 2020 15:48:42 +0000 (17:48 +0200)
commitbf2a0ed11d4cf79e9863576f97a8d306fc3b1d40
treec1c6b876047125a6074a34a0d8c83c64159070d1
parentf8fe3c07363d11fc81d8e7382dbcaa357c861569
VT-d: install sync_cache hook on demand

Instead of checking inside the hook whether any non-coherent IOMMUs are
present, simply install the hook only when this is the case.

To prove that there are no other references to the now dynamically
updated ops structure (and hence that its updating happens early
enough), make it static and rename it at the same time.

Note that this change implies that sync_cache() shouldn't be called
directly unless there are unusual circumstances, like is the case in
alloc_pgtable_maddr(), which gets invoked too early for iommu_ops to
be set already (and therefore we also need to be careful there to
avoid accessing vtd_ops later on, as it lives in .init).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
xen/drivers/passthrough/vtd/extern.h
xen/drivers/passthrough/vtd/iommu.c