Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 271582
b: refs/heads/master
c: e5aa7f0
h: refs/heads/master
v: v3
  • Loading branch information
Joerg Roedel committed Oct 21, 2011
1 parent 637b876 commit 0547a44
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a1b60c1cd913c5ccfb38c717ba0bd22622425fa7
refs/heads/master: e5aa7f00776f2d73f410ede5c1f68246cdc83de1
34 changes: 27 additions & 7 deletions trunk/drivers/iommu/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,34 +110,48 @@ EXPORT_SYMBOL_GPL(iommu_domain_alloc);

void iommu_domain_free(struct iommu_domain *domain)
{
iommu_ops->domain_destroy(domain);
if (likely(domain->ops->domain_destroy != NULL))
domain->ops->domain_destroy(domain);

kfree(domain);
}
EXPORT_SYMBOL_GPL(iommu_domain_free);

int iommu_attach_device(struct iommu_domain *domain, struct device *dev)
{
return iommu_ops->attach_dev(domain, dev);
if (unlikely(domain->ops->attach_dev == NULL))
return -ENODEV;

return domain->ops->attach_dev(domain, dev);
}
EXPORT_SYMBOL_GPL(iommu_attach_device);

void iommu_detach_device(struct iommu_domain *domain, struct device *dev)
{
iommu_ops->detach_dev(domain, dev);
if (unlikely(domain->ops->detach_dev == NULL))
return;

domain->ops->detach_dev(domain, dev);
}
EXPORT_SYMBOL_GPL(iommu_detach_device);

phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
unsigned long iova)
{
return iommu_ops->iova_to_phys(domain, iova);
if (unlikely(domain->ops->iova_to_phys == NULL))
return 0;

return domain->ops->iova_to_phys(domain, iova);
}
EXPORT_SYMBOL_GPL(iommu_iova_to_phys);

int iommu_domain_has_cap(struct iommu_domain *domain,
unsigned long cap)
{
return iommu_ops->domain_has_cap(domain, cap);
if (unlikely(domain->ops->domain_has_cap == NULL))
return 0;

return domain->ops->domain_has_cap(domain, cap);
}
EXPORT_SYMBOL_GPL(iommu_domain_has_cap);

Expand All @@ -146,22 +160,28 @@ int iommu_map(struct iommu_domain *domain, unsigned long iova,
{
size_t size;

if (unlikely(domain->ops->map == NULL))
return -ENODEV;

size = PAGE_SIZE << gfp_order;

BUG_ON(!IS_ALIGNED(iova | paddr, size));

return iommu_ops->map(domain, iova, paddr, gfp_order, prot);
return domain->ops->map(domain, iova, paddr, gfp_order, prot);
}
EXPORT_SYMBOL_GPL(iommu_map);

int iommu_unmap(struct iommu_domain *domain, unsigned long iova, int gfp_order)
{
size_t size;

if (unlikely(domain->ops->unmap == NULL))
return -ENODEV;

size = PAGE_SIZE << gfp_order;

BUG_ON(!IS_ALIGNED(iova, size));

return iommu_ops->unmap(domain, iova, gfp_order);
return domain->ops->unmap(domain, iova, gfp_order);
}
EXPORT_SYMBOL_GPL(iommu_unmap);

0 comments on commit 0547a44

Please sign in to comment.