Skip to content

Commit a7fc93f

Browse files
LuBaolujoergroedel
authored andcommitted
iommu/vt-d: Allocate and free pasid table
This patch allocates a PASID table for a PCI device at the time when the dmar dev_info is attached to dev->archdata.iommu, and free it in the opposite case. Cc: Ashok Raj <[email protected]> Cc: Jacob Pan <[email protected]> Cc: Kevin Tian <[email protected]> Cc: Liu Yi L <[email protected]> Signed-off-by: Lu Baolu <[email protected]> Reviewed-by: Liu Yi L <[email protected]> Signed-off-by: Joerg Roedel <[email protected]>
1 parent cc580e4 commit a7fc93f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/iommu/intel-iommu.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2509,6 +2509,15 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
25092509
list_add(&info->global, &device_domain_list);
25102510
if (dev)
25112511
dev->archdata.iommu = info;
2512+
2513+
if (dev && dev_is_pci(dev) && info->pasid_supported) {
2514+
ret = intel_pasid_alloc_table(dev);
2515+
if (ret) {
2516+
__dmar_remove_one_dev_info(info);
2517+
spin_unlock_irqrestore(&device_domain_lock, flags);
2518+
return NULL;
2519+
}
2520+
}
25122521
spin_unlock_irqrestore(&device_domain_lock, flags);
25132522

25142523
if (dev && domain_context_mapping(domain, dev)) {
@@ -4843,6 +4852,7 @@ static void __dmar_remove_one_dev_info(struct device_domain_info *info)
48434852
if (info->dev) {
48444853
iommu_disable_dev_iotlb(info);
48454854
domain_context_clear(iommu, info->dev);
4855+
intel_pasid_free_table(info->dev);
48464856
}
48474857

48484858
unlink_domain_info(info);

0 commit comments

Comments
 (0)