提交 c1eee67b 编写于 作者: C Chris Wright 提交者: Joerg Roedel

amd iommu: properly detach from protection domain on ->remove

Some drivers may use the dma api during ->remove which will
cause a protection domain to get reattached to a device.  Delay the
detach until after the driver is completely unbound.

[ joro: added a little merge helper ]

[ Impact: fix too early device<->domain removal ]
Signed-off-by: NChris Wright <chrisw@redhat.com>
Signed-off-by: NJoerg Roedel <joerg.roedel@amd.com>
上级 0bc252f4
...@@ -57,6 +57,10 @@ static int dma_ops_unity_map(struct dma_ops_domain *dma_dom, ...@@ -57,6 +57,10 @@ static int dma_ops_unity_map(struct dma_ops_domain *dma_dom,
static struct dma_ops_domain *find_protection_domain(u16 devid); static struct dma_ops_domain *find_protection_domain(u16 devid);
#ifndef BUS_NOTIFY_UNBOUND_DRIVER
#define BUS_NOTIFY_UNBOUND_DRIVER 0x0005
#endif
#ifdef CONFIG_AMD_IOMMU_STATS #ifdef CONFIG_AMD_IOMMU_STATS
/* /*
...@@ -1012,7 +1016,7 @@ static int device_change_notifier(struct notifier_block *nb, ...@@ -1012,7 +1016,7 @@ static int device_change_notifier(struct notifier_block *nb,
printk(KERN_INFO "AMD IOMMU: Using protection domain %d for " printk(KERN_INFO "AMD IOMMU: Using protection domain %d for "
"device %s\n", dma_domain->domain.id, dev_name(dev)); "device %s\n", dma_domain->domain.id, dev_name(dev));
break; break;
case BUS_NOTIFY_UNBIND_DRIVER: case BUS_NOTIFY_UNBOUND_DRIVER:
if (!domain) if (!domain)
goto out; goto out;
detach_device(domain, devid); detach_device(domain, devid);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册