ia64/xen-unstable

changeset 19231:bd991b0431aa

vt-d: workaround for Mobile Series 4 Chipset

Incorporated VT-d workaround for a sighting on Intel Mobile Series 4
chipset found in Linux iommu. The sighting is the chipset is not
reporting write buffer flush capability correctly.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Feb 19 10:59:43 2009 +0000 (2009-02-19)
parents 0c61a377c627
children 2a8ba98a5cff
files xen/drivers/passthrough/vtd/iommu.c
line diff
     1.1 --- a/xen/drivers/passthrough/vtd/iommu.c	Thu Feb 19 10:53:46 2009 +0000
     1.2 +++ b/xen/drivers/passthrough/vtd/iommu.c	Thu Feb 19 10:59:43 2009 +0000
     1.3 @@ -41,6 +41,7 @@
     1.4  static spinlock_t domid_bitmap_lock;    /* protect domain id bitmap */
     1.5  static int domid_bitmap_size;           /* domain id bitmap size in bits */
     1.6  static unsigned long *domid_bitmap;     /* iommu domain id bitmap */
     1.7 +static bool_t rwbf_quirk;
     1.8  
     1.9  static void setup_dom0_devices(struct domain *d);
    1.10  static void setup_dom0_rmrr(struct domain *d);
    1.11 @@ -231,7 +232,7 @@ static void iommu_flush_write_buffer(str
    1.12      unsigned long flag;
    1.13      s_time_t start_time;
    1.14  
    1.15 -    if ( !cap_rwbf(iommu->cap) )
    1.16 +    if ( !rwbf_quirk && !cap_rwbf(iommu->cap) )
    1.17          return;
    1.18      val = iommu->gcmd | DMA_GCMD_WBF;
    1.19  
    1.20 @@ -1719,6 +1720,19 @@ static void setup_dom0_rmrr(struct domai
    1.21      spin_unlock(&pcidevs_lock);
    1.22  }
    1.23  
    1.24 +static void platform_quirks(void)
    1.25 +{
    1.26 +    u32 id;
    1.27 +
    1.28 +    /* Mobile 4 Series Chipset neglects to set RWBF capability. */
    1.29 +    id = pci_conf_read32(0, 0, 0, 0);
    1.30 +    if ( id == 0x2a408086 )
    1.31 +    {
    1.32 +        dprintk(XENLOG_INFO VTDPREFIX, "DMAR: Forcing write-buffer flush\n");
    1.33 +        rwbf_quirk = 1;
    1.34 +    }
    1.35 +}
    1.36 +
    1.37  int intel_vtd_setup(void)
    1.38  {
    1.39      struct acpi_drhd_unit *drhd;
    1.40 @@ -1727,6 +1741,8 @@ int intel_vtd_setup(void)
    1.41      if ( !vtd_enabled )
    1.42          return -ENODEV;
    1.43  
    1.44 +    platform_quirks();
    1.45 +
    1.46      spin_lock_init(&domid_bitmap_lock);
    1.47      clflush_size = get_cache_line_size();
    1.48