ia64/xen-unstable

changeset 16194:5a213170b06e

vt-d: Fix a bug in pmr register disabling code.
Signed-off-by: Allen Kay <allen.m.kay@intel.com>
author Keir Fraser <keir@xensource.com>
date Tue Oct 23 09:31:03 2007 +0100 (2007-10-23)
parents b28ae5f00553
children 4970cbf9b19e
files xen/arch/x86/hvm/vmx/vtd/utils.c xen/include/asm-x86/hvm/vmx/intel-iommu.h
line diff
     1.1 --- a/xen/arch/x86/hvm/vmx/vtd/utils.c	Tue Oct 23 09:26:43 2007 +0100
     1.2 +++ b/xen/arch/x86/hvm/vmx/vtd/utils.c	Tue Oct 23 09:31:03 2007 +0100
     1.3 @@ -64,24 +64,28 @@ int vtd_hw_check(void)
     1.4      return 0;
     1.5  }
     1.6  
     1.7 -/* disable vt-d protected memory registers */
     1.8 +/* Disable vt-d protected memory registers. */
     1.9  void disable_pmr(struct iommu *iommu)
    1.10  {
    1.11      unsigned long start_time, status;
    1.12 +    unsigned int val;
    1.13  
    1.14 -    gdprintk(XENLOG_INFO VTDPREFIX,
    1.15 -        "disabling protected memory registers\n");
    1.16 +    val = dmar_readl(iommu->reg, DMAR_PMEN_REG);
    1.17 +    dmar_writel(iommu->reg, DMAR_PMEN_REG, val & ~DMA_PMEN_EPM);
    1.18 +    start_time = jiffies;
    1.19  
    1.20 -    dmar_writel(iommu->reg, DMAR_PMEN_REG, 0);
    1.21 -    start_time = jiffies;
    1.22 -    while (1) {
    1.23 +    for ( ; ; )
    1.24 +    {
    1.25          status = dmar_readl(iommu->reg, DMAR_PMEN_REG);
    1.26          if ( (status & DMA_PMEN_PRS) == 0 )
    1.27              break;
    1.28 -        if (time_after(jiffies, start_time + DMAR_OPERATION_TIMEOUT))
    1.29 +        if ( time_after(jiffies, start_time + DMAR_OPERATION_TIMEOUT) )
    1.30              panic("Cannot set QIE field for queue invalidation\n");
    1.31          cpu_relax();
    1.32      }
    1.33 +
    1.34 +    dprintk(XENLOG_INFO VTDPREFIX,
    1.35 +            "disabled protected memory registers\n");
    1.36  }
    1.37  
    1.38  #if defined(__x86_64__)
     2.1 --- a/xen/include/asm-x86/hvm/vmx/intel-iommu.h	Tue Oct 23 09:26:43 2007 +0100
     2.2 +++ b/xen/include/asm-x86/hvm/vmx/intel-iommu.h	Tue Oct 23 09:31:03 2007 +0100
     2.3 @@ -147,7 +147,7 @@
     2.4  
     2.5  /* PMEN_REG */
     2.6  #define DMA_PMEN_EPM   (((u32)1) << 31)
     2.7 -#define DMA_PMEN_PRS   (((u32)1) << 1)
     2.8 +#define DMA_PMEN_PRS   (((u32)1) << 0)
     2.9  
    2.10  /* CCMD_REG */
    2.11  #define DMA_CCMD_INVL_GRANU_OFFSET  61