Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 92db1e6a authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge branch 'amd-iommu/fixes' of...

Merge branch 'amd-iommu/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu into core/iommu
parents 0bf84128 e9a22a13
Loading
Loading
Loading
Loading
+6 −16
Original line number Original line Diff line number Diff line
@@ -1145,17 +1145,6 @@ static int device_change_notifier(struct notifier_block *nb,
			  "to a non-dma-ops domain\n", dev_name(dev));
			  "to a non-dma-ops domain\n", dev_name(dev));


	switch (action) {
	switch (action) {
	case BUS_NOTIFY_BOUND_DRIVER:
		if (domain)
			goto out;
		dma_domain = find_protection_domain(devid);
		if (!dma_domain)
			dma_domain = iommu->default_dom;
		attach_device(iommu, &dma_domain->domain, devid);
		DUMP_printk(KERN_INFO "AMD IOMMU: Using protection domain "
			    "%d for device %s\n",
			    dma_domain->domain.id, dev_name(dev));
		break;
	case BUS_NOTIFY_UNBOUND_DRIVER:
	case BUS_NOTIFY_UNBOUND_DRIVER:
		if (!domain)
		if (!domain)
			goto out;
			goto out;
@@ -1277,8 +1266,7 @@ static int get_device_resources(struct device *dev,
			dma_dom = (*iommu)->default_dom;
			dma_dom = (*iommu)->default_dom;
		*domain = &dma_dom->domain;
		*domain = &dma_dom->domain;
		attach_device(*iommu, *domain, *bdf);
		attach_device(*iommu, *domain, *bdf);
		DUMP_printk(KERN_INFO "AMD IOMMU: Using protection domain "
		DUMP_printk("Using protection domain %d for device %s\n",
				"%d for device %s\n",
			    (*domain)->id, dev_name(dev));
			    (*domain)->id, dev_name(dev));
	}
	}


@@ -1779,8 +1767,10 @@ static void *alloc_coherent(struct device *dev, size_t size,
	*dma_addr = __map_single(dev, iommu, domain->priv, paddr,
	*dma_addr = __map_single(dev, iommu, domain->priv, paddr,
				 size, DMA_BIDIRECTIONAL, true, dma_mask);
				 size, DMA_BIDIRECTIONAL, true, dma_mask);


	if (*dma_addr == bad_dma_address)
	if (*dma_addr == bad_dma_address) {
		spin_unlock_irqrestore(&domain->lock, flags);
		goto out_free;
		goto out_free;
	}


	iommu_completion_wait(iommu);
	iommu_completion_wait(iommu);


@@ -2082,7 +2072,7 @@ static int amd_iommu_attach_device(struct iommu_domain *dom,


	old_domain = domain_for_device(devid);
	old_domain = domain_for_device(devid);
	if (old_domain)
	if (old_domain)
		return -EBUSY;
		detach_device(old_domain, devid);


	attach_device(iommu, domain, devid);
	attach_device(iommu, domain, devid);