iommu/amd: Add missing spin_lock initialization
PATCH 1/2 iommu/amd: Add missing spin_lock initialization
Add missing spin_lock initialization in amd_iommu_bind_pasid() function and make lockdep happy again.
Cc [email protected] # >= v3.3
Signed-off-by Joerg Roedel <[email protected]>
--- drivers/iommu/amd_iommu_v2.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/iommu/amd_iommu_v2.c +2 -0
@@ -681,6 +681,8 @@ int amd_iommu_bind_pasid(struct pci_dev *pdev, int pasid,atomic_set (&pasid_state->count,1 );init_waitqueue_head (&pasid_state->wq); +spin_lock_init (&pasid_state->lock); + pasid_state->task = task; pasid_state->mm =get_task_mm (task); pasid_state->device_state = dev_state;
Signature · 1 line
1.7.9.5
PATCH 2/2 iommu/amd: Fix hotplug with iommu=pt
This did not work because devices are not put into the pt_domain. Fix this.
Signed-off-by Joerg Roedel <[email protected]>
--- drivers/iommu/amd_iommu.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/iommu/amd_iommu.c +13 -4
@@ -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 */
@@ -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 :
Signature · 1 line
1.7.9.5