ia64/xen-unstable

changeset 18838:b1a38832be05

VT-d code cleanup

- remove a printk line. This printk may be output too many on some
platforms, thus result in hang during dom0 booting.
- add write buffer flush in domain_context_unmap_one()
- when map/unmap context, if context is not flushed, needn't to flush
iotlb

Signed-off-by: Weidong Han <weidong.han@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Nov 27 11:22:38 2008 +0000 (2008-11-27)
parents a558165cfead
children 840b761e07c1
files xen/drivers/passthrough/vtd/iommu.c
line diff
     1.1 --- a/xen/drivers/passthrough/vtd/iommu.c	Thu Nov 27 11:21:19 2008 +0000
     1.2 +++ b/xen/drivers/passthrough/vtd/iommu.c	Thu Nov 27 11:22:38 2008 +0000
     1.3 @@ -446,10 +446,6 @@ static int flush_iotlb_reg(void *_iommu,
     1.4      if ( DMA_TLB_IAIG(val) == 0 )
     1.5          dprintk(XENLOG_ERR VTDPREFIX, "IOMMU: flush IOTLB failed\n");
     1.6  
     1.7 -    if ( DMA_TLB_IAIG(val) != DMA_TLB_IIRG(type) )
     1.8 -        dprintk(XENLOG_INFO VTDPREFIX,
     1.9 -                "IOMMU: tlb flush request %x, actual %x\n",
    1.10 -               (u32)DMA_TLB_IIRG(type), (u32)DMA_TLB_IAIG(val));
    1.11      /* flush iotlb entry will implicitly flush write buffer */
    1.12      return 0;
    1.13  }
    1.14 @@ -1127,10 +1123,11 @@ static int domain_context_mapping_one(
    1.15      unmap_vtd_domain_page(context_entries);
    1.16  
    1.17      /* Context entry was previously non-present (with domid 0). */
    1.18 -    iommu_flush_context_device(iommu, 0, (((u16)bus) << 8) | devfn,
    1.19 -                               DMA_CCMD_MASK_NOBIT, 1);
    1.20 -    if ( iommu_flush_iotlb_dsi(iommu, 0, 1) )
    1.21 +    if ( iommu_flush_context_device(iommu, 0, (((u16)bus) << 8) | devfn,
    1.22 +                                    DMA_CCMD_MASK_NOBIT, 1) )
    1.23          iommu_flush_write_buffer(iommu);
    1.24 +    else
    1.25 +        iommu_flush_iotlb_dsi(iommu, 0, 1);
    1.26  
    1.27      set_bit(iommu->index, &hd->iommu_bitmap);
    1.28      spin_unlock_irqrestore(&iommu->lock, flags);
    1.29 @@ -1310,8 +1307,12 @@ static int domain_context_unmap_one(
    1.30      context_clear_present(*context);
    1.31      context_clear_entry(*context);
    1.32      iommu_flush_cache_entry(context);
    1.33 -    iommu_flush_context_domain(iommu, domain_iommu_domid(domain), 0);
    1.34 -    iommu_flush_iotlb_dsi(iommu, domain_iommu_domid(domain), 0);
    1.35 +
    1.36 +    if ( iommu_flush_context_domain(iommu, domain_iommu_domid(domain), 0) )
    1.37 +        iommu_flush_write_buffer(iommu);
    1.38 +    else
    1.39 +        iommu_flush_iotlb_dsi(iommu, domain_iommu_domid(domain), 0);
    1.40 +
    1.41      unmap_vtd_domain_page(context_entries);
    1.42      spin_unlock_irqrestore(&iommu->lock, flags);
    1.43