diff options
| -rw-r--r-- | drivers/iommu/amd_iommu.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 625626391f2d..3f365ab9f7c7 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
| @@ -2254,6 +2254,18 @@ static int device_change_notifier(struct notifier_block *nb, | |||
| 2254 | 2254 | ||
| 2255 | iommu_init_device(dev); | 2255 | iommu_init_device(dev); |
| 2256 | 2256 | ||
| 2257 | /* | ||
| 2258 | * dev_data is still NULL and | ||
| 2259 | * got initialized in iommu_init_device | ||
| 2260 | */ | ||
| 2261 | dev_data = get_dev_data(dev); | ||
| 2262 | |||
| 2263 | if (iommu_pass_through || dev_data->iommu_v2) { | ||
| 2264 | dev_data->passthrough = true; | ||
| 2265 | attach_device(dev, pt_domain); | ||
| 2266 | break; | ||
| 2267 | } | ||
| 2268 | |||
| 2257 | domain = domain_for_device(dev); | 2269 | domain = domain_for_device(dev); |
| 2258 | 2270 | ||
| 2259 | /* allocate a protection domain if a device is added */ | 2271 | /* allocate a protection domain if a device is added */ |
| @@ -2271,10 +2283,7 @@ static int device_change_notifier(struct notifier_block *nb, | |||
| 2271 | 2283 | ||
| 2272 | dev_data = get_dev_data(dev); | 2284 | dev_data = get_dev_data(dev); |
| 2273 | 2285 | ||
| 2274 | if (!dev_data->passthrough) | 2286 | dev->archdata.dma_ops = &amd_iommu_dma_ops; |
| 2275 | dev->archdata.dma_ops = &amd_iommu_dma_ops; | ||
| 2276 | else | ||
| 2277 | dev->archdata.dma_ops = &nommu_dma_ops; | ||
| 2278 | 2287 | ||
| 2279 | break; | 2288 | break; |
| 2280 | case BUS_NOTIFY_DEL_DEVICE: | 2289 | case BUS_NOTIFY_DEL_DEVICE: |
