提交 5d450806 编写于 作者: J Joerg Roedel

VT-d: adapt domain init and destroy functions for IOMMU API

Signed-off-by: NJoerg Roedel <joerg.roedel@amd.com>
上级 19de40a8
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <linux/mempool.h> #include <linux/mempool.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/iova.h> #include <linux/iova.h>
#include <linux/iommu.h>
#include <linux/intel-iommu.h> #include <linux/intel-iommu.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/iommu.h> #include <asm/iommu.h>
...@@ -2962,32 +2963,34 @@ static void vm_domain_exit(struct dmar_domain *domain) ...@@ -2962,32 +2963,34 @@ static void vm_domain_exit(struct dmar_domain *domain)
free_domain_mem(domain); free_domain_mem(domain);
} }
struct dmar_domain *intel_iommu_alloc_domain(void) static int intel_iommu_domain_init(struct iommu_domain *domain)
{ {
struct dmar_domain *domain; struct dmar_domain *dmar_domain;
domain = iommu_alloc_vm_domain(); dmar_domain = iommu_alloc_vm_domain();
if (!domain) { if (!dmar_domain) {
printk(KERN_ERR printk(KERN_ERR
"intel_iommu_domain_alloc: domain == NULL\n"); "intel_iommu_domain_init: dmar_domain == NULL\n");
return NULL; return -ENOMEM;
} }
if (vm_domain_init(domain, DEFAULT_DOMAIN_ADDRESS_WIDTH)) { if (vm_domain_init(dmar_domain, DEFAULT_DOMAIN_ADDRESS_WIDTH)) {
printk(KERN_ERR printk(KERN_ERR
"intel_iommu_domain_alloc: domain_init() failed\n"); "intel_iommu_domain_init() failed\n");
vm_domain_exit(domain); vm_domain_exit(dmar_domain);
return NULL; return -ENOMEM;
} }
domain->priv = dmar_domain;
return domain; return 0;
} }
EXPORT_SYMBOL_GPL(intel_iommu_alloc_domain);
void intel_iommu_free_domain(struct dmar_domain *domain) static void intel_iommu_domain_destroy(struct iommu_domain *domain)
{ {
vm_domain_exit(domain); struct dmar_domain *dmar_domain = domain->priv;
domain->priv = NULL;
vm_domain_exit(dmar_domain);
} }
EXPORT_SYMBOL_GPL(intel_iommu_free_domain);
int intel_iommu_attach_device(struct dmar_domain *domain, int intel_iommu_attach_device(struct dmar_domain *domain,
struct pci_dev *pdev) struct pci_dev *pdev)
......
...@@ -330,8 +330,6 @@ extern int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr, ...@@ -330,8 +330,6 @@ extern int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr,
extern void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); extern void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
struct dmar_domain *intel_iommu_alloc_domain(void);
void intel_iommu_free_domain(struct dmar_domain *domain);
int intel_iommu_attach_device(struct dmar_domain *domain, int intel_iommu_attach_device(struct dmar_domain *domain,
struct pci_dev *pdev); struct pci_dev *pdev);
void intel_iommu_detach_device(struct dmar_domain *domain, void intel_iommu_detach_device(struct dmar_domain *domain,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册