This makes the check more precise, and brings VTd in line with AMD code.
Signed-off-by: Tim Deegan <tim@xen.org>
BUG_ON( !hd->root_table );
- if ( iommu_hap_pt_share && is_hvm_domain(d) )
+ if ( iommu_use_hap_pt(d) )
return 0;
memset(pt_mfn, 0, sizeof(pt_mfn));
BUG_ON( !hd->root_table );
- if ( iommu_hap_pt_share && is_hvm_domain(d) )
+ if ( iommu_use_hap_pt(d) )
return 0;
memset(pt_mfn, 0, sizeof(pt_mfn));
ASSERT( is_hvm_domain(d) && d->arch.hvm_domain.hap_enabled );
- if ( !iommu_hap_pt_share )
+ if ( !iommu_use_hap_pt(d) )
return;
pgd_mfn = pagetable_get_mfn(p2m_get_pagetable(p2m_get_hostp2m(d)));
#include <xen/sched.h>
#include <xen/pci.h>
#include <xen/pci_regs.h>
+#include <xen/paging.h>
#include <asm/hvm/iommu.h>
#include <asm/amd-iommu.h>
#include <asm/hvm/svm/amd-iommu-proto.h>
{
struct hvm_iommu *hd = domain_hvm_iommu(d);
- if ( iommu_hap_pt_share )
+ if ( iommu_use_hap_pt(d) )
return;
spin_lock(&hd->mapping_lock);
if ( has_arch_pdevs(d) && !need_iommu(d) )
{
d->need_iommu = 1;
- if ( !iommu_hap_pt_share )
+ if ( !iommu_use_hap_pt(d) )
rc = iommu_populate_page_table(d);
goto done;
}
if ( list_empty(&acpi_drhd_units) )
return;
- if ( iommu_hap_pt_share )
+ if ( iommu_use_hap_pt(d) )
return;
spin_lock(&hd->mapping_lock);
int iommu_domid;
/* Do nothing if VT-d shares EPT page table */
- if ( iommu_hap_pt_share )
+ if ( iommu_use_hap_pt(d) )
return 0;
/* do nothing if dom0 and iommu supports pass thru */
ASSERT( is_hvm_domain(d) && d->arch.hvm_domain.hap_enabled );
- if ( !iommu_hap_pt_share )
+ if ( !iommu_use_hap_pt(d) )
return;
pgd_mfn = pagetable_get_mfn(p2m_get_pagetable(p2m_get_hostp2m(d)));
extern bool_t iommu_debug;
extern bool_t amd_iommu_perdev_intremap;
+/* Does this domain have a P2M table we can use as its IOMMU pagetable? */
+#define iommu_use_hap_pt(d) (paging_mode_hap(d) && iommu_hap_pt_share)
+
extern struct rangeset *mmio_ro_ranges;
#define domain_hvm_iommu(d) (&d->arch.hvm_domain.hvm_iommu)