All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] move the snoop control detection to aviod invalid capability
@ 2009-02-12  8:52 Xin, Xiaohui
  0 siblings, 0 replies; only message in thread
From: Xin, Xiaohui @ 2009-02-12  8:52 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 219 bytes --]

The patch attached is to move the snoop control detection out of the acpi_dmar_init() where the capability value is not initialized thus we may get random value.

Signed-off-by: Xin, Xiaohui<xiaohui.xin@intel.com>


[-- Attachment #1.2: Type: text/html, Size: 2130 bytes --]

[-- Attachment #2: fix.diff --]
[-- Type: application/octet-stream, Size: 1988 bytes --]

diff -r bf9cdbec516a xen/drivers/passthrough/vtd/dmar.c
--- a/xen/drivers/passthrough/vtd/dmar.c	Wed Feb 11 16:36:59 2009 +0000
+++ b/xen/drivers/passthrough/vtd/dmar.c	Wed Feb 11 19:19:57 2009 -0500
@@ -519,8 +519,6 @@
 int acpi_dmar_init(void)
 {
     int rc;
-    struct acpi_drhd_unit *drhd;
-    struct iommu *iommu;
 
     rc = -ENODEV;
     if ( force_iommu )
@@ -537,22 +535,7 @@
     if ( list_empty(&acpi_drhd_units) )
         goto fail;
 
-    /* Giving that all devices within guest use same io page table,
-     * enable snoop control only if all VT-d engines support it.
-     */
-    if ( iommu_snoop )
-    {
-        for_each_drhd_unit ( drhd )
-        {
-            iommu = drhd->iommu;
-            if ( !ecap_snp_ctl(iommu->ecap) ) {
-                iommu_snoop = 0;
-                break;
-            }
-        }
-    }
-
-    printk("Intel VT-d has been enabled, snoop_control=%d.\n", iommu_snoop);
+    printk("Intel VT-d has been enabled\n");
 
     return 0;
 
diff -r bf9cdbec516a xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Wed Feb 11 16:36:59 2009 +0000
+++ b/xen/drivers/passthrough/vtd/iommu.c	Wed Feb 11 19:19:57 2009 -0500
@@ -1765,6 +1765,23 @@
     if ( init_vtd_hw() )
         goto error;
 
+    /* Giving that all devices within guest use same io page table,
+     * enable snoop control only if all VT-d engines support it.
+     */
+
+    if ( iommu_snoop )
+    {
+        for_each_drhd_unit ( drhd )
+        {
+            iommu = drhd->iommu;
+            if ( !ecap_snp_ctl(iommu->ecap) ) {
+                iommu_snoop = 0;
+                break;
+            }
+        }
+    }
+    
+    printk("Intel VT-d snoop control %sabled\n", iommu_snoop ? "en" : "dis");
     register_keyhandler('V', dump_iommu_info, "dump iommu info");
 
     return 0;
@@ -1773,6 +1790,7 @@
     for_each_drhd_unit ( drhd )
         iommu_free(drhd);
     vtd_enabled = 0;
+    iommu_snoop = 0;
     return -ENOMEM;
 }
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-02-12  8:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-12  8:52 [PATCH] move the snoop control detection to aviod invalid capability Xin, Xiaohui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.