[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] amd iommu: disable iommu emulation on non-iommu systems



# HG changeset patch
# User Wei Wang <wei.wang2@xxxxxxx>
# Date 1327758036 0
# Node ID 04623ceabb7296a4e3f51401397ecef4febdd659
# Parent  54000bca7a6ad096f5cdbc9318ba0d099d76e1a7
amd iommu: disable iommu emulation on non-iommu systems

Introduce a new flag to disable iommu emulation on old iommu systems.
This patch is taken from my v4 patch queue, which is till pending, to
make old or non-iommu system to run cleanly without interfered by
iommuv2 codes. This might be helpful to isolate iommuv2 code in
debugging unstable regressions. The reset part of v4 will be re-based.

Signed-off-by: Wei Wang <wei.wang2@xxxxxxx>
Committed-by: Keir Fraser <keir@xxxxxxx>
---


diff -r 54000bca7a6a -r 04623ceabb72 xen/drivers/passthrough/amd/iommu_guest.c
--- a/xen/drivers/passthrough/amd/iommu_guest.c Fri Jan 27 19:17:03 2012 +0000
+++ b/xen/drivers/passthrough/amd/iommu_guest.c Sat Jan 28 13:40:36 2012 +0000
@@ -805,6 +805,9 @@
     p2m_type_t t;
     struct guest_iommu *iommu = domain_iommu(d);
 
+    if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
+        return 0;
+
     if ( !iommu )
         return -EACCES;
 
@@ -867,7 +870,7 @@
     struct guest_iommu *iommu;
     struct hvm_iommu *hd  = domain_hvm_iommu(d);
 
-    if ( !is_hvm_domain(d) )
+    if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
         return 0;
 
     iommu = xzalloc(struct guest_iommu);
@@ -893,7 +896,7 @@
 {
     struct guest_iommu *iommu;
 
-    if ( !is_hvm_domain(d) )
+    if ( !is_hvm_domain(d) || !iommu_enabled || !iommuv2_enabled )
         return;
 
     iommu = domain_iommu(d);
diff -r 54000bca7a6a -r 04623ceabb72 xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c  Fri Jan 27 19:17:03 2012 +0000
+++ b/xen/drivers/passthrough/amd/iommu_init.c  Sat Jan 28 13:40:36 2012 +0000
@@ -38,6 +38,7 @@
 static struct radix_tree_root ivrs_maps;
 struct list_head amd_iommu_head;
 struct table_struct device_table;
+bool_t iommuv2_enabled;
 
 static int iommu_has_ht_flag(struct amd_iommu *iommu, u8 mask)
 {
@@ -887,6 +888,9 @@
 
     get_iommu_features(iommu);
 
+    if ( iommu->features )
+        iommuv2_enabled = 1;
+
     if ( allocate_cmd_buffer(iommu) == NULL )
         goto error_out;
 
@@ -950,6 +954,7 @@
     iommu_enabled = 0;
     iommu_passthrough = 0;
     iommu_intremap = 0;
+    iommuv2_enabled = 0;
 }
 
 /*
diff -r 54000bca7a6a -r 04623ceabb72 xen/include/asm-x86/amd-iommu.h
--- a/xen/include/asm-x86/amd-iommu.h   Fri Jan 27 19:17:03 2012 +0000
+++ b/xen/include/asm-x86/amd-iommu.h   Sat Jan 28 13:40:36 2012 +0000
@@ -182,4 +182,6 @@
     struct guest_iommu_msi  msi;
 };
 
+extern bool_t iommuv2_enabled;
+
 #endif /* _ASM_X86_64_AMD_IOMMU_H */

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.