diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2008-12-08 06:05:55 -0500 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2009-01-03 08:11:55 -0500 |
commit | 6d98cd8043c13438e4ca8a9464893f0224198a30 (patch) | |
tree | 2ffaa5b1391188fe99a306473650d3b18bb50e15 /arch/x86/kernel/amd_iommu.c | |
parent | e275a2a0fc9e2168b15f6c7814e30b7ad58b1c7c (diff) |
AMD IOMMU: add domain cleanup helper function
Impact: add a function to remove all devices from a domain
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.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c index 140875b3f6ef..5d3f085289eb 100644 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c | |||
@@ -1579,3 +1579,31 @@ free_domains: | |||
1579 | 1579 | ||
1580 | return ret; | 1580 | return ret; |
1581 | } | 1581 | } |
1582 | |||
1583 | /***************************************************************************** | ||
1584 | * | ||
1585 | * The following functions belong to the exported interface of AMD IOMMU | ||
1586 | * | ||
1587 | * This interface allows access to lower level functions of the IOMMU | ||
1588 | * like protection domain handling and assignement of devices to domains | ||
1589 | * which is not possible with the dma_ops interface. | ||
1590 | * | ||
1591 | *****************************************************************************/ | ||
1592 | |||
1593 | #ifdef CONFIG_IOMMU_API | ||
1594 | |||
1595 | static void cleanup_domain(struct protection_domain *domain) | ||
1596 | { | ||
1597 | unsigned long flags; | ||
1598 | u16 devid; | ||
1599 | |||
1600 | write_lock_irqsave(&amd_iommu_devtable_lock, flags); | ||
1601 | |||
1602 | for (devid = 0; devid <= amd_iommu_last_bdf; ++devid) | ||
1603 | if (amd_iommu_pd_table[devid] == domain) | ||
1604 | __detach_device(domain, devid); | ||
1605 | |||
1606 | write_unlock_irqrestore(&amd_iommu_devtable_lock, flags); | ||
1607 | } | ||
1608 | |||
1609 | #endif | ||