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
committed by Stephen Boyd
parent 41b03a2df8
commit 5c0b9cbdf9
3 changed files with 24 additions and 0 deletions

View File

@@ -358,6 +358,15 @@ int iommu_unmap_range(struct iommu_domain *domain, unsigned int iova,
}
EXPORT_SYMBOL_GPL(iommu_unmap_range);
phys_addr_t iommu_get_pt_base_addr(struct iommu_domain *domain)
{
if (unlikely(domain->ops->get_pt_base_addr == NULL))
return 0;
return domain->ops->get_pt_base_addr(domain);
}
EXPORT_SYMBOL_GPL(iommu_get_pt_base_addr);
int iommu_device_group(struct device *dev, unsigned int *groupid)
{
if (iommu_present(dev->bus) && dev->bus->iommu_ops->device_group)

View File

@@ -669,6 +669,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,
@@ -678,6 +684,7 @@ static struct iommu_ops msm_iommu_ops = {
.unmap = msm_iommu_unmap,
.iova_to_phys = msm_iommu_iova_to_phys,
.domain_has_cap = msm_iommu_domain_has_cap,
.get_pt_base_addr = msm_iommu_get_pt_base_addr,
.pgsize_bitmap = MSM_IOMMU_PGSIZES,
};

View File

@@ -19,6 +19,7 @@
#ifndef __LINUX_IOMMU_H
#define __LINUX_IOMMU_H
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/scatterlist.h>
@@ -79,6 +80,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);
int (*device_group)(struct device *dev, unsigned int *groupid);
unsigned long pgsize_bitmap;
};
@@ -103,6 +105,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);
extern void iommu_set_fault_handler(struct iommu_domain *domain,
iommu_fault_handler_t handler);
extern int iommu_device_group(struct device *dev, unsigned int *groupid);
@@ -212,6 +215,11 @@ 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;
}
static inline void iommu_set_fault_handler(struct iommu_domain *domain,
iommu_fault_handler_t handler)
{