use is_iommu_enabled() where appropriate...
authorPaul Durrant <paul.durrant@citrix.com>
Tue, 17 Sep 2019 14:11:48 +0000 (16:11 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 17 Sep 2019 14:11:48 +0000 (16:11 +0200)
commit71e617a6b8f69849c70eda1b3c58f1ff6b244e5a
tree3049d359d0a0fcd1ee672dc37a74a23de43bf1f5
parentc45f59292367ca61059fc1be6f198c0f78f25b8b
use is_iommu_enabled() where appropriate...

...rather than testing the global iommu_enabled flag and ops pointer.

Now that there is a per-domain flag indicating whether the domain is
permitted to use the IOMMU (which determines whether the ops pointer will
be set), many tests of the global iommu_enabled flag and ops pointer can
be translated into tests of the per-domain flag. Some of the other tests of
purely the global iommu_enabled flag can also be translated into tests of
the per-domain flag.

NOTE: The comment in iommu_share_p2m_table() is also fixed; need_iommu()
      disappeared some time ago. Also, whilst the style of the 'if' in
      flask_iommu_resource_use_perm() is fixed, I have not translated any
      instances of u32 into uint32_t to keep consistency. IMO such a
      translation would be better done globally for the source module in
      a separate patch.
      The change to the definition of iommu_call() is to keep the PV shim
      build happy. Without this change it will fail to compile with errors
      of the form:

iommu.c:361:32: error: unused variable ‘hd’ [-Werror=unused-variable]
     const struct domain_iommu *hd = dom_iommu(d);
                                     ^~

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: "Roger Pau Monné" <roger.pau@citrix.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Julien Grall <julien.grall@arm.com>
18 files changed:
xen/arch/arm/p2m.c
xen/arch/x86/dom0_build.c
xen/arch/x86/domctl.c
xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/vioapic.c
xen/arch/x86/hvm/vmx/vmcs.c
xen/arch/x86/hvm/vmx/vmx.c
xen/arch/x86/mm/p2m-ept.c
xen/drivers/passthrough/amd/iommu_guest.c
xen/drivers/passthrough/device_tree.c
xen/drivers/passthrough/io.c
xen/drivers/passthrough/iommu.c
xen/drivers/passthrough/pci.c
xen/drivers/passthrough/vtd/iommu.c
xen/drivers/passthrough/vtd/x86/hvm.c
xen/drivers/passthrough/x86/iommu.c
xen/include/asm-x86/iommu.h
xen/xsm/flask/hooks.c