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: fix assertion fault in pci passthro

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] VT-d: fix assertion fault in pci passthrough code
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 13 Jul 2009 04:00:25 -0700
Delivery-date: Mon, 13 Jul 2009 04:01:14 -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 1247482369 -3600
# Node ID f17c897546bf679641053ca586d08e2d393339a3
# Parent  3f12d48f2880c626fed746add5f2627b05626cba
VT-d: fix assertion fault in pci passthrough code

Remove ASSERT(spin_is_locked(&pcidevs_lock)) in
pci_get_pdev_by_domain() to allow caller the flexibility to not hold
the lock if it does not care if the device is hot removed between the
time it got the pdev and the time it is used to get the corresponding
vt-d engine.  In the new RHSA use case, we just wanted to get the vt-d
engine of any device passthrough in the domain. Also, rename RHSA
field "domain" to "proximity domain" to avoid overloading the term
"domain" in virtualization context.

Signed-off-by: Allen Kay <allen.m.kay@xxxxxxxxx>
---
 xen/drivers/passthrough/pci.c       |    2 --
 xen/drivers/passthrough/vtd/dmar.c  |    2 +-
 xen/drivers/passthrough/vtd/dmar.h  |    2 +-
 xen/drivers/passthrough/vtd/iommu.c |   10 +++++++++-
 xen/include/xen/acpi.h              |    2 +-
 5 files changed, 12 insertions(+), 6 deletions(-)

diff -r 3f12d48f2880 -r f17c897546bf xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c     Mon Jul 13 11:51:07 2009 +0100
+++ b/xen/drivers/passthrough/pci.c     Mon Jul 13 11:52:49 2009 +0100
@@ -89,8 +89,6 @@ struct pci_dev *pci_get_pdev_by_domain(s
 {
     struct pci_dev *pdev = NULL;
 
-    ASSERT(spin_is_locked(&pcidevs_lock));
-
     list_for_each_entry ( pdev, &alldevs_list, alldevs_list )
          if ( (pdev->bus == bus || bus == -1) &&
               (pdev->devfn == devfn || devfn == -1) &&
diff -r 3f12d48f2880 -r f17c897546bf xen/drivers/passthrough/vtd/dmar.c
--- a/xen/drivers/passthrough/vtd/dmar.c        Mon Jul 13 11:51:07 2009 +0100
+++ b/xen/drivers/passthrough/vtd/dmar.c        Mon Jul 13 11:52:49 2009 +0100
@@ -499,7 +499,7 @@ acpi_parse_one_rhsa(struct acpi_dmar_ent
     memset(rhsau, 0, sizeof(struct acpi_rhsa_unit));
 
     rhsau->address = rhsa->address;
-    rhsau->domain = rhsa->domain;
+    rhsau->proximity_domain = rhsa->proximity_domain;
     list_add_tail(&rhsau->list, &acpi_rhsa_units);
 
     return ret;
diff -r 3f12d48f2880 -r f17c897546bf xen/drivers/passthrough/vtd/dmar.h
--- a/xen/drivers/passthrough/vtd/dmar.h        Mon Jul 13 11:51:07 2009 +0100
+++ b/xen/drivers/passthrough/vtd/dmar.h        Mon Jul 13 11:52:49 2009 +0100
@@ -72,7 +72,7 @@ struct acpi_rhsa_unit {
 struct acpi_rhsa_unit {
     struct list_head list;
     u64    address;
-    u32    domain;
+    u32    proximity_domain;
 };
 
 #define for_each_drhd_unit(drhd) \
diff -r 3f12d48f2880 -r f17c897546bf xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c       Mon Jul 13 11:51:07 2009 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c       Mon Jul 13 11:52:49 2009 +0100
@@ -143,10 +143,14 @@ u64 alloc_pgtable_maddr(struct acpi_drhd
     struct acpi_rhsa_unit *rhsa;
     struct page_info *pg;
     u64 *vaddr;
+    int node = -1;
 
     rhsa = drhd_to_rhsa(drhd);
+    if ( rhsa )
+        node =  pxm_to_node(rhsa->proximity_domain);
+
     pg = alloc_domheap_pages(NULL, get_order_from_pages(npages),
-                             rhsa ? rhsa->domain : 0);
+                             (node == -1 ) ? 0 : MEMF_node(node));
     if ( !pg )
         return 0;
     vaddr = map_domain_page(page_to_mfn(pg));
@@ -204,6 +208,10 @@ static u64 addr_to_dma_page_maddr(struct
     ASSERT(spin_is_locked(&hd->mapping_lock));
     if ( hd->pgd_maddr == 0 )
     {
+        /*
+         * just get any passthrough device in the domainr - assume user
+         * assigns only devices from same node to a given guest.
+         */
         pdev = pci_get_pdev_by_domain(domain, -1, -1);
         drhd = acpi_find_matched_drhd_unit(pdev);
         if ( !alloc || ((hd->pgd_maddr = alloc_pgtable_maddr(drhd, 1)) == 0) )
diff -r 3f12d48f2880 -r f17c897546bf xen/include/xen/acpi.h
--- a/xen/include/xen/acpi.h    Mon Jul 13 11:51:07 2009 +0100
+++ b/xen/include/xen/acpi.h    Mon Jul 13 11:52:49 2009 +0100
@@ -227,7 +227,7 @@ struct acpi_table_atsr {
 
 struct acpi_table_rhsa {
         struct  acpi_dmar_entry_header header;
-        u32     domain;
+        u32     proximity_domain;
         u64     address; /* register base address for this drhd */
 } __attribute__ ((packed));
 

_______________________________________________
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: fix assertion fault in pci passthrough code, Xen patchbot-unstable <=