Merge "drivers: iommu: Add iommu_map_sg for msm_iommu"

This commit is contained in:
Linux Build Service Account 2015-03-18 15:04:51 -07:00 committed by Gerrit - the friendly Code Review server
commit 4114f8ec47
2 changed files with 45 additions and 0 deletions

View File

@ -1069,6 +1069,28 @@ static int msm_iommu_unmap_range(struct iommu_domain *domain, unsigned int va,
return 0;
}
static size_t msm_iommu_map_sg(struct iommu_domain *domain, unsigned long va,
struct scatterlist *sg, unsigned int nr_entries,
int prot)
{
int ret, i;
struct scatterlist *tmp;
unsigned long len = 0;
/*
* Longer term work: convert over to generic page table management
* which means we can work on scattergather lists and the whole range
*/
for_each_sg(sg, tmp, nr_entries, i)
len += tmp->length;
ret = msm_iommu_map_range(domain, va, sg, len, prot);
if (ret)
return 0;
else
return len;
}
#ifdef CONFIG_IOMMU_LPAE
static phys_addr_t msm_iommu_get_phy_from_PAR(unsigned long va, u64 par)
{
@ -1549,6 +1571,7 @@ static struct iommu_ops msm_iommu_ops = {
.unmap = msm_iommu_unmap,
.map_range = msm_iommu_map_range,
.unmap_range = msm_iommu_unmap_range,
.map_sg = msm_iommu_map_sg,
.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,

View File

@ -898,6 +898,27 @@ fail:
return ret;
}
static size_t msm_iommu_map_sg(struct iommu_domain *domain, unsigned long va,
struct scatterlist *sg, unsigned int nr_entries,
int prot)
{
int ret, i;
struct scatterlist *tmp;
unsigned long len = 0;
/*
* Longer term work: convert over to generic page table management
* which means we can work on scattergather lists and the whole range
*/
for_each_sg(sg, tmp, nr_entries, i)
len += tmp->length;
ret = msm_iommu_map_range(domain, va, sg, len, prot);
if (ret)
return 0;
else
return len;
}
static int msm_iommu_unmap_range(struct iommu_domain *domain, unsigned int va,
unsigned int len)
@ -975,6 +996,7 @@ static struct iommu_ops msm_iommu_ops = {
.map = msm_iommu_map,
.unmap = msm_iommu_unmap,
.map_range = msm_iommu_map_range,
.map_sg = msm_iommu_map_sg,
.unmap_range = msm_iommu_unmap_range,
.iova_to_phys = msm_iommu_iova_to_phys,
.domain_has_cap = msm_iommu_domain_has_cap,