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));