All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][VTD] fix assertion fault in pci passthrough code
@ 2009-07-10 19:17 Kay, Allen M
  0 siblings, 0 replies; only message in thread
From: Kay, Allen M @ 2009-07-10 19:17 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 549 bytes --]

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@intel.com

[-- Attachment #2: devlock0710.patch --]
[-- Type: application/octet-stream, Size: 3107 bytes --]

diff -r 8ee92b9f890f xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c	Fri Jul 10 18:12:13 2009 +0100
+++ b/xen/drivers/passthrough/pci.c	Fri Jul 10 11:52:56 2009 -0700
@@ -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 8ee92b9f890f xen/drivers/passthrough/vtd/dmar.c
--- a/xen/drivers/passthrough/vtd/dmar.c	Fri Jul 10 18:12:13 2009 +0100
+++ b/xen/drivers/passthrough/vtd/dmar.c	Fri Jul 10 11:52:56 2009 -0700
@@ -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 8ee92b9f890f xen/drivers/passthrough/vtd/dmar.h
--- a/xen/drivers/passthrough/vtd/dmar.h	Fri Jul 10 18:12:13 2009 +0100
+++ b/xen/drivers/passthrough/vtd/dmar.h	Fri Jul 10 11:52:56 2009 -0700
@@ -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 8ee92b9f890f xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Fri Jul 10 18:12:13 2009 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Fri Jul 10 11:52:56 2009 -0700
@@ -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 8ee92b9f890f xen/include/xen/acpi.h
--- a/xen/include/xen/acpi.h	Fri Jul 10 18:12:13 2009 +0100
+++ b/xen/include/xen/acpi.h	Fri Jul 10 11:52:56 2009 -0700
@@ -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));
 

[-- 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-07-10 19:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-10 19:17 [PATCH][VTD] fix assertion fault in pci passthrough code Kay, Allen M

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.