]> xenbits.xensource.com Git - people/pauldu/xen.git/commitdiff
vt-d: fix IM bit unmask of Fault Event Control Register in init_vtd_hw()
authorQuan Xu <quan.xu@intel.com>
Fri, 25 Sep 2015 16:03:04 +0000 (18:03 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 25 Sep 2015 16:03:04 +0000 (18:03 +0200)
Bit 0:29 in Fault Event Control Register are 'Reserved and Preserved',
software cannot write 0 to it unconditionally. Software must preserve
the value read for writes.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Quan Xu <quan.xu@intel.com>
xen/drivers/passthrough/vtd/iommu.c

index 1d8b561f38142ce861c51892b15f5999855e694f..82549376cfa64f311c0981bdd74418a0295d3ff9 100644 (file)
@@ -2012,6 +2012,7 @@ static int init_vtd_hw(void)
     struct iommu_flush *flush = NULL;
     int ret;
     unsigned long flags;
+    u32 sts;
 
     /*
      * Basic VT-d HW init: set VT-d interrupt, clear VT-d faults.  
@@ -2025,7 +2026,9 @@ static int init_vtd_hw(void)
         clear_fault_bits(iommu);
 
         spin_lock_irqsave(&iommu->register_lock, flags);
-        dmar_writel(iommu->reg, DMAR_FECTL_REG, 0);
+        sts = dmar_readl(iommu->reg, DMAR_FECTL_REG);
+        sts &= ~DMA_FECTL_IM;
+        dmar_writel(iommu->reg, DMAR_FECTL_REG, sts);
         spin_unlock_irqrestore(&iommu->register_lock, flags);
     }