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] vt-d: Map RMRR in intel_iommu_add_device(

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] vt-d: Map RMRR in intel_iommu_add_device() if the device has RMRR;
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 25 Jul 2008 10:00:08 -0700
Delivery-date: Fri, 25 Jul 2008 09:59:54 -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 1216975488 -3600
# Node ID 7b6942ad565c95a770d53f3670b69b010ef4d4b1
# Parent  804d29cfd083bb45a5363e71260398b0ded7031e
vt-d: Map RMRR in intel_iommu_add_device() if the device has RMRR;
move domain_context_mapping() to be in front of list_move() in
reassign_device_ownership().

Signed-off-by: Weidong Han <weidong.han@xxxxxxxxx>
---
 xen/drivers/passthrough/vtd/iommu.c |   33 +++++++++++++++++++++++++++++++--
 1 files changed, 31 insertions(+), 2 deletions(-)

diff -r 804d29cfd083 -r 7b6942ad565c xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c       Fri Jul 25 09:40:14 2008 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c       Fri Jul 25 09:44:48 2008 +0100
@@ -1409,12 +1409,15 @@ static int reassign_device_ownership(
     pdev_iommu = drhd->iommu;
     domain_context_unmap(source, bus, devfn);
 
+    ret = domain_context_mapping(target, bus, devfn);
+    if ( ret )
+        return ret;
+
     write_lock(&pcidevs_lock);
     list_move(&pdev->domain_list, &target->arch.pdev_list);
     write_unlock(&pcidevs_lock);
     pdev->domain = target;
 
-    ret = domain_context_mapping(target, bus, devfn);
     spin_unlock(&pdev->lock);
 
     read_lock(&pcidevs_lock);
@@ -1583,9 +1586,35 @@ static int iommu_prepare_rmrr_dev(struct
 
 static int intel_iommu_add_device(struct pci_dev *pdev)
 {
+    struct acpi_rmrr_unit *rmrr;
+    u16 bdf;
+    int ret, i;
+
     if ( !pdev->domain )
         return -EINVAL;
-    return domain_context_mapping(pdev->domain, pdev->bus, pdev->devfn);
+
+    ret = domain_context_mapping(pdev->domain, pdev->bus, pdev->devfn);
+    if ( ret )
+    {
+        gdprintk(XENLOG_ERR VTDPREFIX,
+                 "intel_iommu_add_device: context mapping failed\n");
+        return ret;
+    }
+
+    for_each_rmrr_device ( rmrr, bdf, i )
+    {
+        if ( PCI_BUS(bdf) == pdev->bus && PCI_DEVFN2(bdf) == pdev->devfn )
+        {
+            ret = iommu_prepare_rmrr_dev(pdev->domain, rmrr,
+                                         pdev->bus, pdev->devfn);
+            if ( ret )
+                gdprintk(XENLOG_ERR VTDPREFIX,
+                         "intel_iommu_add_device: RMRR mapping failed\n");
+            break;
+        }
+    }
+
+    return ret;
 }
 
 static int intel_iommu_remove_device(struct pci_dev *pdev)

_______________________________________________
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] vt-d: Map RMRR in intel_iommu_add_device() if the device has RMRR;, Xen patchbot-unstable <=