[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] vt-d: Fix a bug in pmr register disabling code.



# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1193128263 -3600
# Node ID 5a213170b06e0739b4c8914eedee5530d55a6bb7
# Parent  b28ae5f00553ea053bd4e4576634d8ea49e77bc3
vt-d: Fix a bug in pmr register disabling code.
Signed-off-by: Allen Kay <allen.m.kay@xxxxxxxxx>
---
 xen/arch/x86/hvm/vmx/vtd/utils.c          |   20 ++++++++++++--------
 xen/include/asm-x86/hvm/vmx/intel-iommu.h |    2 +-
 2 files changed, 13 insertions(+), 9 deletions(-)

diff -r b28ae5f00553 -r 5a213170b06e xen/arch/x86/hvm/vmx/vtd/utils.c
--- a/xen/arch/x86/hvm/vmx/vtd/utils.c  Tue Oct 23 09:26:43 2007 +0100
+++ b/xen/arch/x86/hvm/vmx/vtd/utils.c  Tue Oct 23 09:31:03 2007 +0100
@@ -64,24 +64,28 @@ int vtd_hw_check(void)
     return 0;
 }
 
-/* disable vt-d protected memory registers */
+/* Disable vt-d protected memory registers. */
 void disable_pmr(struct iommu *iommu)
 {
     unsigned long start_time, status;
-
-    gdprintk(XENLOG_INFO VTDPREFIX,
-        "disabling protected memory registers\n");
-
-    dmar_writel(iommu->reg, DMAR_PMEN_REG, 0);
+    unsigned int val;
+
+    val = dmar_readl(iommu->reg, DMAR_PMEN_REG);
+    dmar_writel(iommu->reg, DMAR_PMEN_REG, val & ~DMA_PMEN_EPM);
     start_time = jiffies;
-    while (1) {
+
+    for ( ; ; )
+    {
         status = dmar_readl(iommu->reg, DMAR_PMEN_REG);
         if ( (status & DMA_PMEN_PRS) == 0 )
             break;
-        if (time_after(jiffies, start_time + DMAR_OPERATION_TIMEOUT))
+        if ( time_after(jiffies, start_time + DMAR_OPERATION_TIMEOUT) )
             panic("Cannot set QIE field for queue invalidation\n");
         cpu_relax();
     }
+
+    dprintk(XENLOG_INFO VTDPREFIX,
+            "disabled protected memory registers\n");
 }
 
 #if defined(__x86_64__)
diff -r b28ae5f00553 -r 5a213170b06e xen/include/asm-x86/hvm/vmx/intel-iommu.h
--- a/xen/include/asm-x86/hvm/vmx/intel-iommu.h Tue Oct 23 09:26:43 2007 +0100
+++ b/xen/include/asm-x86/hvm/vmx/intel-iommu.h Tue Oct 23 09:31:03 2007 +0100
@@ -147,7 +147,7 @@
 
 /* PMEN_REG */
 #define DMA_PMEN_EPM   (((u32)1) << 31)
-#define DMA_PMEN_PRS   (((u32)1) << 1)
+#define DMA_PMEN_PRS   (((u32)1) << 0)
 
 /* CCMD_REG */
 #define DMA_CCMD_INVL_GRANU_OFFSET  61

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.