AMD IOMMU: add domain id free function
authorJoerg Roedel <joerg.roedel@amd.com>
Tue, 2 Dec 2008 17:28:53 +0000 (18:28 +0100)
committerJoerg Roedel <joerg.roedel@amd.com>
Sat, 3 Jan 2009 13:11:53 +0000 (14:11 +0100)
Impact: add code to release a domain id

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
arch/x86/kernel/amd_iommu.c

index 8a0fd3d099735a072c7c936d60502af39d4c6d8a..0922d5fe633c25ad14fb0fcf5bb7df1245f28817 100644 (file)
@@ -571,6 +571,18 @@ static u16 domain_id_alloc(void)
        return id;
 }
 
+#ifdef CONFIG_IOMMU_API
+static void domain_id_free(int id)
+{
+       unsigned long flags;
+
+       write_lock_irqsave(&amd_iommu_devtable_lock, flags);
+       if (id > 0 && id < MAX_DOMAIN_ID)
+               __clear_bit(id, amd_iommu_pd_alloc_bitmap);
+       write_unlock_irqrestore(&amd_iommu_devtable_lock, flags);
+}
+#endif
+
 /*
  * Used to reserve address ranges in the aperture (e.g. for exclusion
  * ranges.