diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index a328239375..abbeb13988 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -2109,7 +2109,7 @@ static int adjust_vtd_irq_affinities(void) } __initcall(adjust_vtd_irq_affinities); -static int __must_check init_vtd_hw(void) +static int __must_check init_vtd_hw(bool resume) { struct acpi_drhd_unit *drhd; struct vtd_iommu *iommu; @@ -2138,6 +2138,10 @@ static int __must_check init_vtd_hw(void) disable_qinval(iommu); } + if ( resume ) + /* FECTL write done by vtd_resume(). */ + continue; + spin_lock_irqsave(&iommu->register_lock, flags); sts = dmar_readl(iommu->reg, DMAR_FECTL_REG); sts &= ~DMA_FECTL_IM; @@ -2329,7 +2333,7 @@ static int __init vtd_setup(void) P(iommu_hap_pt_share, "Shared EPT tables"); #undef P - ret = init_vtd_hw(); + ret = init_vtd_hw(false); if ( ret ) goto error; @@ -2596,7 +2600,7 @@ static void vtd_resume(void) if ( !iommu_enabled ) return; - if ( init_vtd_hw() != 0 && force_iommu ) + if ( init_vtd_hw(true) != 0 && force_iommu ) panic("IOMMU setup failed, crash Xen for security purpose\n"); for_each_drhd_unit ( drhd )