Skip to content

Commit

Permalink
iommu/amd: Fix hotplug with iommu=pt
Browse files Browse the repository at this point in the history
This did not work because devices are not put into the
pt_domain. Fix this.

Cc: stable@vger.kernel.org
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
  • Loading branch information
Joerg Roedel committed Jul 19, 2012
1 parent 2c13d47 commit 2c9195e
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions drivers/iommu/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2254,6 +2254,18 @@ static int device_change_notifier(struct notifier_block *nb,

iommu_init_device(dev);

/*
* dev_data is still NULL and
* got initialized in iommu_init_device
*/
dev_data = get_dev_data(dev);

if (iommu_pass_through || dev_data->iommu_v2) {
dev_data->passthrough = true;
attach_device(dev, pt_domain);
break;
}

domain = domain_for_device(dev);

/* allocate a protection domain if a device is added */
Expand All @@ -2271,10 +2283,7 @@ static int device_change_notifier(struct notifier_block *nb,

dev_data = get_dev_data(dev);

if (!dev_data->passthrough)
dev->archdata.dma_ops = &amd_iommu_dma_ops;
else
dev->archdata.dma_ops = &nommu_dma_ops;
dev->archdata.dma_ops = &amd_iommu_dma_ops;

break;
case BUS_NOTIFY_DEL_DEVICE:
Expand Down

0 comments on commit 2c9195e

Please sign in to comment.