aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/amd_iommu.c
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2008-12-10 13:33:26 -0500
committerJoerg Roedel <joerg.roedel@amd.com>2009-01-03 08:11:56 -0500
commit1ac4cbbc5eb56de96d264d10f464ba5222815b1b (patch)
tree1d98c0382683b4c7ec40602273fed14aabf222c7 /arch/x86/kernel/amd_iommu.c
parente2dc14a2a6c9a83baaafc51f06b7e73cec2167be (diff)
AMD IOMMU: allocate a new protection for hotplugged devices
Impact: also hotplug devices benefit from device isolation Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'arch/x86/kernel/amd_iommu.c')
-rw-r--r--arch/x86/kernel/amd_iommu.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index f2956546423b..f2260609eadc 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -923,6 +923,8 @@ static int device_change_notifier(struct notifier_block *nb,
923 struct protection_domain *domain; 923 struct protection_domain *domain;
924 struct dma_ops_domain *dma_domain; 924 struct dma_ops_domain *dma_domain;
925 struct amd_iommu *iommu; 925 struct amd_iommu *iommu;
926 int order = amd_iommu_aperture_order;
927 unsigned long flags;
926 928
927 if (devid > amd_iommu_last_bdf) 929 if (devid > amd_iommu_last_bdf)
928 goto out; 930 goto out;
@@ -955,6 +957,21 @@ static int device_change_notifier(struct notifier_block *nb,
955 goto out; 957 goto out;
956 detach_device(domain, devid); 958 detach_device(domain, devid);
957 break; 959 break;
960 case BUS_NOTIFY_ADD_DEVICE:
961 /* allocate a protection domain if a device is added */
962 dma_domain = find_protection_domain(devid);
963 if (dma_domain)
964 goto out;
965 dma_domain = dma_ops_domain_alloc(iommu, order);
966 if (!dma_domain)
967 goto out;
968 dma_domain->target_dev = devid;
969
970 spin_lock_irqsave(&iommu_pd_list_lock, flags);
971 list_add_tail(&dma_domain->list, &iommu_pd_list);
972 spin_unlock_irqrestore(&iommu_pd_list_lock, flags);
973
974 break;
958 default: 975 default:
959 goto out; 976 goto out;
960 } 977 }