msm: iommu: Create iommu api to return the page table address

Create a new iommu api to return the base address of the domain's
pagetable.

Change-Id: Ibf5425fa7ae253b16bfe795614bd7943efd7e3e3
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
This commit is contained in:
Shubhraprakash Das
2011-12-02 18:01:57 -07:00
parent 4121ed0859
commit 4c436f219b
3 changed files with 23 additions and 1 deletions

View File

@@ -979,6 +979,12 @@ fail:
return 0;
}
static phys_addr_t msm_iommu_get_pt_base_addr(struct iommu_domain *domain)
{
struct msm_priv *priv = domain->priv;
return __pa(priv->pgtable);
}
static struct iommu_ops msm_iommu_ops = {
.domain_init = msm_iommu_domain_init,
.domain_destroy = msm_iommu_domain_destroy,
@@ -989,7 +995,8 @@ static struct iommu_ops msm_iommu_ops = {
.map_range = msm_iommu_map_range,
.unmap_range = msm_iommu_unmap_range,
.iova_to_phys = msm_iommu_iova_to_phys,
.domain_has_cap = msm_iommu_domain_has_cap
.domain_has_cap = msm_iommu_domain_has_cap,
.get_pt_base_addr = msm_iommu_get_pt_base_addr
};
static int __init get_tex_class(int icp, int ocp, int mt, int nos)

View File

@@ -171,3 +171,12 @@ int iommu_unmap_range(struct iommu_domain *domain, unsigned int iova,
return iommu_ops->unmap_range(domain, iova, len);
}
EXPORT_SYMBOL_GPL(iommu_unmap_range);
phys_addr_t iommu_get_pt_base_addr(struct iommu_domain *domain)
{
if (!iommu_found())
return 0;
return iommu_ops->get_pt_base_addr(domain);
}
EXPORT_SYMBOL_GPL(iommu_get_pt_base_addr);

View File

@@ -53,6 +53,7 @@ struct iommu_ops {
unsigned long iova);
int (*domain_has_cap)(struct iommu_domain *domain,
unsigned long cap);
phys_addr_t (*get_pt_base_addr)(struct iommu_domain *domain);
};
#ifdef CONFIG_IOMMU_API
@@ -77,6 +78,7 @@ extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
unsigned long iova);
extern int iommu_domain_has_cap(struct iommu_domain *domain,
unsigned long cap);
extern phys_addr_t iommu_get_pt_base_addr(struct iommu_domain *domain);
#else /* CONFIG_IOMMU_API */
@@ -146,6 +148,10 @@ static inline int domain_has_cap(struct iommu_domain *domain,
return 0;
}
static inline phys_addr_t iommu_get_pt_base_addr(struct iommu_domain *domain)
{
return 0;
}
#endif /* CONFIG_IOMMU_API */
#endif /* __LINUX_IOMMU_H */