ia64/xen-unstable

changeset 17937:d4cf12d128ed

VT-d: Fix queue invalidation

Correct invalidate_sync(), and clean up qinval_setup().

Signed-off-by: Weidong Han <weidong.han@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jul 01 11:41:43 2008 +0100 (2008-07-01)
parents 0b7f7c564c83
children 6685c412698f
files xen/drivers/passthrough/vtd/qinval.c
line diff
     1.1 --- a/xen/drivers/passthrough/vtd/qinval.c	Tue Jul 01 11:40:55 2008 +0100
     1.2 +++ b/xen/drivers/passthrough/vtd/qinval.c	Tue Jul 01 11:41:43 2008 +0100
     1.3 @@ -222,7 +222,7 @@ int invalidate_sync(struct iommu *iommu)
     1.4      int ret = -1;
     1.5      struct qi_ctrl *qi_ctrl = iommu_qi_ctrl(iommu);
     1.6  
     1.7 -    if ( qi_ctrl->qinval_maddr == 0 )
     1.8 +    if ( qi_ctrl->qinval_maddr != 0 )
     1.9      {
    1.10          ret = queue_invalidate_wait(iommu,
    1.11              0, 1, 1, 1, &qi_ctrl->qinval_poll_status);
    1.12 @@ -416,7 +416,6 @@ static int flush_iotlb_qi(
    1.13  int qinval_setup(struct iommu *iommu)
    1.14  {
    1.15      s_time_t start_time;
    1.16 -    u32 status = 0;
    1.17      struct qi_ctrl *qi_ctrl;
    1.18      struct iommu_flush *flush;
    1.19  
    1.20 @@ -450,15 +449,12 @@ int qinval_setup(struct iommu *iommu)
    1.21  
    1.22      /* Make sure hardware complete it */
    1.23      start_time = NOW();
    1.24 -    for ( ; ; )
    1.25 +    while ( !(dmar_readl(iommu->reg, DMAR_GSTS_REG) & DMA_GSTS_QIES) )
    1.26      {
    1.27 -        status = dmar_readl(iommu->reg, DMAR_GSTS_REG);
    1.28 -        if ( status & DMA_GSTS_QIES )
    1.29 -            break;
    1.30          if ( NOW() > (start_time + DMAR_OPERATION_TIMEOUT) )
    1.31              panic("Cannot set QIE field for queue invalidation\n");
    1.32          cpu_relax();
    1.33      }
    1.34 -    status = 0;
    1.35 -    return status;
    1.36 +
    1.37 +    return 0;
    1.38  }