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

Commit c2a2876e authored by Joerg Roedel's avatar Joerg Roedel
Browse files

iommu/amd: Make sure dma_ops are set for hotplug devices



There is a bug introduced with commit 27c2127a that causes
devices which are hot unplugged and then hot-replugged to
not have per-device dma_ops set. This causes these devices
to not function correctly. Fixed with this patch.

Cc: stable@vger.kernel.org
Reported-by: default avatarAndreas Degert <andreas.degert@googlemail.com>
Signed-off-by: default avatarJoerg Roedel <joro@8bytes.org>
parent 4fdc7824
Loading
Loading
Loading
Loading
+10 −12
Original line number Diff line number Diff line
@@ -2466,8 +2466,7 @@ static int device_change_notifier(struct notifier_block *nb,

		/* allocate a protection domain if a device is added */
		dma_domain = find_protection_domain(devid);
		if (dma_domain)
			goto out;
		if (!dma_domain) {
			dma_domain = dma_ops_domain_alloc();
			if (!dma_domain)
				goto out;
@@ -2476,8 +2475,7 @@ static int device_change_notifier(struct notifier_block *nb,
			spin_lock_irqsave(&iommu_pd_list_lock, flags);
			list_add_tail(&dma_domain->list, &iommu_pd_list);
			spin_unlock_irqrestore(&iommu_pd_list_lock, flags);

		dev_data = get_dev_data(dev);
		}

		dev->archdata.dma_ops = &amd_iommu_dma_ops;