With need_iommu() only ever true when iommu_enabled is also true, and
with the former getting set when a PCI device gets added to a guest,
the checks can be consolidated. The range set check are left in place
just in case raw MMIO or I/O port ranges get passed to a guest.
At once drop open-coding of cache_flush_permitted().
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Tim Deegan <tim@xen.org>
#include <public/hvm/e820.h>
#include <xen/types.h>
#include <asm/e820.h>
+#include <asm/iocap.h>
#include <asm/mm.h>
#include <asm/paging.h>
#include <asm/p2m.h>
return -1;
}
- if ( !iommu_enabled ||
- (rangeset_is_empty(d->iomem_caps) &&
- rangeset_is_empty(d->arch.ioport_caps) &&
- !has_arch_pdevs(d)) )
+ if ( !need_iommu(d) && !cache_flush_permitted(d) )
{
ASSERT(!direct_mmio ||
!((mfn_x(mfn) ^ d->arch.hvm_domain.vmx.apic_access_mfn) >>