iommu: msm: Convert msm mapping functions to use iommu_map_sg
iommu_map_sg is the new preferred API over map_range. Switch custom APIs to use it. Change-Id: I5bca775a6b9950e89bf0a629ba66ad34005853f1 Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
This commit is contained in:
parent
e74f7dd242
commit
5d94b66a97
|
@ -82,6 +82,7 @@ int msm_iommu_map_extra(struct iommu_domain *domain,
|
|||
struct scatterlist *sglist;
|
||||
unsigned int nrpages = PFN_ALIGN(size) >> PAGE_SHIFT;
|
||||
struct page *dummy_page = phys_to_page(phy_addr);
|
||||
size_t map_ret;
|
||||
|
||||
sglist = vmalloc(sizeof(*sglist) * nrpages);
|
||||
if (!sglist) {
|
||||
|
@ -94,10 +95,14 @@ int msm_iommu_map_extra(struct iommu_domain *domain,
|
|||
for (i = 0; i < nrpages; i++)
|
||||
sg_set_page(&sglist[i], dummy_page, PAGE_SIZE, 0);
|
||||
|
||||
ret = iommu_map_range(domain, temp_iova, sglist, size, prot);
|
||||
if (ret) {
|
||||
map_ret = iommu_map_sg(domain, temp_iova, sglist, nrpages,
|
||||
prot);
|
||||
if (map_ret != size) {
|
||||
pr_err("%s: could not map extra %lx in domain %p\n",
|
||||
__func__, start_iova, domain);
|
||||
ret = -EINVAL;
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
vfree(sglist);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -195,7 +195,7 @@ static int msm_iommu_map_iommu(struct msm_iommu_meta *meta,
|
|||
unsigned long extra, size;
|
||||
struct sg_table *table;
|
||||
int prot = IOMMU_WRITE | IOMMU_READ;
|
||||
|
||||
size_t map_ret;
|
||||
|
||||
size = meta->size;
|
||||
data->mapped_size = iova_length;
|
||||
|
@ -224,13 +224,16 @@ static int msm_iommu_map_iommu(struct msm_iommu_meta *meta,
|
|||
goto out1;
|
||||
}
|
||||
|
||||
ret = iommu_map_range(domain, data->iova_addr,
|
||||
map_ret = iommu_map_sg(domain, data->iova_addr,
|
||||
table->sgl,
|
||||
size, prot);
|
||||
if (ret) {
|
||||
table->nents, prot);
|
||||
if (map_ret != size) {
|
||||
pr_err("%s: could not map %lx in domain %p\n",
|
||||
__func__, data->iova_addr, domain);
|
||||
ret = -EINVAL;
|
||||
goto out1;
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
if (extra) {
|
||||
|
|
Loading…
Reference in New Issue