File 19230-vtd-mobile-series4-chipset.patch of Package xen

# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1235041183 0
# Node ID bd991b0431aad9a0e8631a09da138a4961117ef3
# Parent  0c61a377c6278c0d124617a86abfa37eba201d17
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>

Index: xen-3.3.1-testing/xen/drivers/passthrough/vtd/iommu.c
===================================================================
--- xen-3.3.1-testing.orig/xen/drivers/passthrough/vtd/iommu.c
+++ xen-3.3.1-testing/xen/drivers/passthrough/vtd/iommu.c
@@ -41,6 +41,7 @@
 static spinlock_t domid_bitmap_lock;    /* protect domain id bitmap */
 static int domid_bitmap_size;           /* domain id bitmap size in bits */
 static unsigned long *domid_bitmap;     /* iommu domain id bitmap */
+static bool_t rwbf_quirk;
 
 static void setup_dom0_devices(struct domain *d);
 static void setup_dom0_rmrr(struct domain *d);
@@ -263,7 +264,7 @@ static void iommu_flush_write_buffer(str
     unsigned long flag;
     s_time_t start_time;
 
-    if ( !cap_rwbf(iommu->cap) )
+    if ( !rwbf_quirk && !cap_rwbf(iommu->cap) )
         return;
     val = iommu->gcmd | DMA_GCMD_WBF;
 
@@ -1782,6 +1783,19 @@ static void setup_dom0_rmrr(struct domai
     }
 }
 
+static void platform_quirks(void)
+{
+    u32 id;
+
+    /* Mobile 4 Series Chipset neglects to set RWBF capability. */
+    id = pci_conf_read32(0, 0, 0, 0);
+    if ( id == 0x2a408086 )
+    {
+        dprintk(XENLOG_INFO VTDPREFIX, "DMAR: Forcing write-buffer flush\n");
+        rwbf_quirk = 1;
+    }
+}
+
 int intel_vtd_setup(void)
 {
     struct acpi_drhd_unit *drhd;
@@ -1790,6 +1804,8 @@ int intel_vtd_setup(void)
     if ( !vtd_enabled )
         return -ENODEV;
 
+    platform_quirks();
+
     spin_lock_init(&domid_bitmap_lock);
     clflush_size = get_clflush_size();
 
openSUSE Build Service is sponsored by