aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2008-12-03 08:52:32 -0500
committerJoerg Roedel <joerg.roedel@amd.com>2009-01-03 08:11:07 -0500
commit5d450806eb0e569c5846a5825e7f535980b0da32 (patch)
tree6b110597307b7e8443e200bd5432ab0cd220d0a2 /drivers
parent19de40a8472fa64693eab844911eec277d489f6c (diff)
VT-d: adapt domain init and destroy functions for IOMMU API
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/intel-iommu.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 772fb22e1be..5c95a5a6544 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -34,6 +34,7 @@
34#include <linux/mempool.h> 34#include <linux/mempool.h>
35#include <linux/timer.h> 35#include <linux/timer.h>
36#include <linux/iova.h> 36#include <linux/iova.h>
37#include <linux/iommu.h>
37#include <linux/intel-iommu.h> 38#include <linux/intel-iommu.h>
38#include <asm/cacheflush.h> 39#include <asm/cacheflush.h>
39#include <asm/iommu.h> 40#include <asm/iommu.h>
@@ -2962,32 +2963,34 @@ static void vm_domain_exit(struct dmar_domain *domain)
2962 free_domain_mem(domain); 2963 free_domain_mem(domain);
2963} 2964}
2964 2965
2965struct dmar_domain *intel_iommu_alloc_domain(void) 2966static int intel_iommu_domain_init(struct iommu_domain *domain)
2966{ 2967{
2967 struct dmar_domain *domain; 2968 struct dmar_domain *dmar_domain;
2968 2969
2969 domain = iommu_alloc_vm_domain(); 2970 dmar_domain = iommu_alloc_vm_domain();
2970 if (!domain) { 2971 if (!dmar_domain) {
2971 printk(KERN_ERR 2972 printk(KERN_ERR
2972 "intel_iommu_domain_alloc: domain == NULL\n"); 2973 "intel_iommu_domain_init: dmar_domain == NULL\n");
2973 return NULL; 2974 return -ENOMEM;
2974 } 2975 }
2975 if (vm_domain_init(domain, DEFAULT_DOMAIN_ADDRESS_WIDTH)) { 2976 if (vm_domain_init(dmar_domain, DEFAULT_DOMAIN_ADDRESS_WIDTH)) {
2976 printk(KERN_ERR 2977 printk(KERN_ERR
2977 "intel_iommu_domain_alloc: domain_init() failed\n"); 2978 "intel_iommu_domain_init() failed\n");
2978 vm_domain_exit(domain); 2979 vm_domain_exit(dmar_domain);
2979 return NULL; 2980 return -ENOMEM;
2980 } 2981 }
2982 domain->priv = dmar_domain;
2981 2983
2982 return domain; 2984 return 0;
2983} 2985}
2984EXPORT_SYMBOL_GPL(intel_iommu_alloc_domain);
2985 2986
2986void intel_iommu_free_domain(struct dmar_domain *domain) 2987static void intel_iommu_domain_destroy(struct iommu_domain *domain)
2987{ 2988{
2988 vm_domain_exit(domain); 2989 struct dmar_domain *dmar_domain = domain->priv;
2990
2991 domain->priv = NULL;
2992 vm_domain_exit(dmar_domain);
2989} 2993}
2990EXPORT_SYMBOL_GPL(intel_iommu_free_domain);
2991 2994
2992int intel_iommu_attach_device(struct dmar_domain *domain, 2995int intel_iommu_attach_device(struct dmar_domain *domain,
2993 struct pci_dev *pdev) 2996 struct pci_dev *pdev)