WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] AMD IOMMU: support "passthrough" and "no-

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] AMD IOMMU: support "passthrough" and "no-intremap" parameters.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 19 Aug 2009 07:40:30 -0700
Delivery-date: Wed, 19 Aug 2009 07:41:03 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1250688210 -3600
# Node ID 4e2ffbd99aebd76da7defac4ce0e9786f68d5121
# Parent  001a99da12947d3e2caadafc7458e40a8ba92fbf
AMD IOMMU: support  "passthrough" and "no-intremap" parameters.

Signed-off-by: Wei Wang <wei.wang2@xxxxxxx>
---
 xen/drivers/passthrough/amd/iommu_map.c       |    8 +++++---
 xen/drivers/passthrough/amd/pci_amd_iommu.c   |   19 ++++++++++++++-----
 xen/include/asm-x86/hvm/svm/amd-iommu-proto.h |    3 ++-
 3 files changed, 21 insertions(+), 9 deletions(-)

diff -r 001a99da1294 -r 4e2ffbd99aeb xen/drivers/passthrough/amd/iommu_map.c
--- a/xen/drivers/passthrough/amd/iommu_map.c   Wed Aug 19 14:22:52 2009 +0100
+++ b/xen/drivers/passthrough/amd/iommu_map.c   Wed Aug 19 14:23:30 2009 +0100
@@ -256,7 +256,7 @@ static void amd_iommu_set_page_directory
 
 void amd_iommu_set_dev_table_entry(u32 *dte, u64 root_ptr, u64 intremap_ptr,
                                    u16 domain_id, u8 sys_mgt, u8 dev_ex,
-                                   u8 paging_mode)
+                                   u8 paging_mode, u8 valid, u8 int_valid)
 {
     u64 addr_hi, addr_lo;
     u32 entry;
@@ -297,7 +297,8 @@ void amd_iommu_set_dev_table_entry(u32 *
     set_field_in_reg_u32(0xB, entry,
                          IOMMU_DEV_TABLE_INT_TABLE_LENGTH_MASK,
                          IOMMU_DEV_TABLE_INT_TABLE_LENGTH_SHIFT, &entry);
-    set_field_in_reg_u32(IOMMU_CONTROL_ENABLED, entry,
+    set_field_in_reg_u32(int_valid ? IOMMU_CONTROL_ENABLED :
+                         IOMMU_CONTROL_DISABLED, entry,
                          IOMMU_DEV_TABLE_INT_VALID_MASK,
                          IOMMU_DEV_TABLE_INT_VALID_SHIFT, &entry);
     set_field_in_reg_u32(IOMMU_CONTROL_ENABLED, entry,
@@ -340,7 +341,8 @@ void amd_iommu_set_dev_table_entry(u32 *
     set_field_in_reg_u32(IOMMU_CONTROL_ENABLED, entry,
                          IOMMU_DEV_TABLE_TRANSLATION_VALID_MASK,
                          IOMMU_DEV_TABLE_TRANSLATION_VALID_SHIFT, &entry);
-    set_field_in_reg_u32(IOMMU_CONTROL_ENABLED, entry,
+    set_field_in_reg_u32(valid ? IOMMU_CONTROL_ENABLED :
+                         IOMMU_CONTROL_DISABLED, entry,
                          IOMMU_DEV_TABLE_VALID_MASK,
                          IOMMU_DEV_TABLE_VALID_SHIFT, &entry);
     dte[0] = entry;
diff -r 001a99da1294 -r 4e2ffbd99aeb xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c       Wed Aug 19 14:22:52 
2009 +0100
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c       Wed Aug 19 14:23:30 
2009 +0100
@@ -69,7 +69,7 @@ static void amd_iommu_setup_domain_devic
     void *dte;
     unsigned long flags;
     int req_id;
-    u8 sys_mgt, dev_ex;
+    u8 sys_mgt, dev_ex, valid = 1, int_valid = 1;
     struct hvm_iommu *hd = domain_hvm_iommu(domain);
 
     BUG_ON( !hd->root_table || !hd->paging_mode || !int_remap_table );
@@ -85,12 +85,17 @@ static void amd_iommu_setup_domain_devic
         /* bind DTE to domain page-tables */
         sys_mgt = ivrs_mappings[req_id].dte_sys_mgt_enable;
         dev_ex = ivrs_mappings[req_id].dte_allow_exclusion;
+
+        if ( iommu_passthrough && (domain->domain_id == 0) )
+            valid = 0;
+        if ( !iommu_intremap )
+            int_valid = 0;
 
         amd_iommu_set_dev_table_entry((u32 *)dte,
                                       page_to_maddr(hd->root_table),
                                       virt_to_maddr(int_remap_table),
                                       hd->domain_id, sys_mgt, dev_ex,
-                                      hd->paging_mode);
+                                      hd->paging_mode, valid, int_valid);
 
         invalidate_dev_table_entry(iommu, req_id);
         invalidate_interrupt_table(iommu, req_id);
@@ -223,9 +228,13 @@ static int amd_iommu_domain_init(struct 
     if ( domain->domain_id == 0 )
     {
         unsigned long i; 
-       /* setup 1:1 page table for dom0 */
-        for ( i = 0; i < max_page; i++ )
-            amd_iommu_map_page(domain, i, i);
+
+        if ( !iommu_passthrough )
+        {
+            /* setup 1:1 page table for dom0 */
+            for ( i = 0; i < max_page; i++ )
+                amd_iommu_map_page(domain, i, i);
+        }
 
         amd_iommu_setup_dom0_devices(domain);
     }
diff -r 001a99da1294 -r 4e2ffbd99aeb 
xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h     Wed Aug 19 14:22:52 
2009 +0100
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h     Wed Aug 19 14:23:30 
2009 +0100
@@ -68,7 +68,8 @@ void invalidate_all_iommu_pages(struct d
 
 /* device table functions */
 void amd_iommu_set_dev_table_entry(u32 *dte, u64 root_ptr, u64 intremap_ptr,
-        u16 domain_id, u8 sys_mgt, u8 dev_ex, u8 paging_mode);
+        u16 domain_id, u8 sys_mgt, u8 dev_ex, u8 paging_mode,
+        u8 valid, u8 int_valid);
 int amd_iommu_is_dte_page_translation_valid(u32 *entry);
 void invalidate_dev_table_entry(struct amd_iommu *iommu, u16 devic_id);
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] AMD IOMMU: support "passthrough" and "no-intremap" parameters., Xen patchbot-unstable <=