aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-06-09 10:18:11 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-09 10:18:11 -0400
commit92db1e6af747faa129e236d68386af26a0efc12b (patch)
treefd54bc603cef2724db965aa08e410b7982875ae2
parent0bf841281e58d0b3cc9fe9dc4383df7694bde6bd (diff)
parente9a22a13c71986851e931bdfa054f68839ff8576 (diff)
Merge branch 'amd-iommu/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu into core/iommu
-rw-r--r--arch/x86/kernel/amd_iommu.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 2c63d8748133..1c60554537c3 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -1145,17 +1145,6 @@ static int device_change_notifier(struct notifier_block *nb,
1145 "to a non-dma-ops domain\n", dev_name(dev)); 1145 "to a non-dma-ops domain\n", dev_name(dev));
1146 1146
1147 switch (action) { 1147 switch (action) {
1148 case BUS_NOTIFY_BOUND_DRIVER:
1149 if (domain)
1150 goto out;
1151 dma_domain = find_protection_domain(devid);
1152 if (!dma_domain)
1153 dma_domain = iommu->default_dom;
1154 attach_device(iommu, &dma_domain->domain, devid);
1155 DUMP_printk(KERN_INFO "AMD IOMMU: Using protection domain "
1156 "%d for device %s\n",
1157 dma_domain->domain.id, dev_name(dev));
1158 break;
1159 case BUS_NOTIFY_UNBOUND_DRIVER: 1148 case BUS_NOTIFY_UNBOUND_DRIVER:
1160 if (!domain) 1149 if (!domain)
1161 goto out; 1150 goto out;
@@ -1277,9 +1266,8 @@ static int get_device_resources(struct device *dev,
1277 dma_dom = (*iommu)->default_dom; 1266 dma_dom = (*iommu)->default_dom;
1278 *domain = &dma_dom->domain; 1267 *domain = &dma_dom->domain;
1279 attach_device(*iommu, *domain, *bdf); 1268 attach_device(*iommu, *domain, *bdf);
1280 DUMP_printk(KERN_INFO "AMD IOMMU: Using protection domain " 1269 DUMP_printk("Using protection domain %d for device %s\n",
1281 "%d for device %s\n", 1270 (*domain)->id, dev_name(dev));
1282 (*domain)->id, dev_name(dev));
1283 } 1271 }
1284 1272
1285 if (domain_for_device(_bdf) == NULL) 1273 if (domain_for_device(_bdf) == NULL)
@@ -1779,8 +1767,10 @@ static void *alloc_coherent(struct device *dev, size_t size,
1779 *dma_addr = __map_single(dev, iommu, domain->priv, paddr, 1767 *dma_addr = __map_single(dev, iommu, domain->priv, paddr,
1780 size, DMA_BIDIRECTIONAL, true, dma_mask); 1768 size, DMA_BIDIRECTIONAL, true, dma_mask);
1781 1769
1782 if (*dma_addr == bad_dma_address) 1770 if (*dma_addr == bad_dma_address) {
1771 spin_unlock_irqrestore(&domain->lock, flags);
1783 goto out_free; 1772 goto out_free;
1773 }
1784 1774
1785 iommu_completion_wait(iommu); 1775 iommu_completion_wait(iommu);
1786 1776
@@ -2082,7 +2072,7 @@ static int amd_iommu_attach_device(struct iommu_domain *dom,
2082 2072
2083 old_domain = domain_for_device(devid); 2073 old_domain = domain_for_device(devid);
2084 if (old_domain) 2074 if (old_domain)
2085 return -EBUSY; 2075 detach_device(old_domain, devid);
2086 2076
2087 attach_device(iommu, domain, devid); 2077 attach_device(iommu, domain, devid);
2088 2078