iommu: msm: Check for map/unmap errors strictly

Over unmap, double unmap, double map are few errors
which needs to get caught right then and there. So,
be verbose for those errors instead of identifying
them later.

Change-Id: I364c65f63e79747f6544e76a475ad958c4fd1b5e
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
This commit is contained in:
Chintan Pandya 2015-06-26 18:06:27 +05:30 committed by Gerrit - the friendly Code Review server
parent 73bdbfef3c
commit fc3b32979e
1 changed files with 12 additions and 2 deletions

View File

@ -487,13 +487,18 @@ static int __msm_iommu_pagetable_map_range(struct msm_iommu_pt *pt,
ops->get_length(cookie, len), chunk_size);
if (chunk_size == SZ_4K) {
sl_4k(&sl_table[sl_offset], pa, pgprot4k);
ret = sl_4k(&sl_table[sl_offset], pa, pgprot4k);
if (ret)
goto fail;
sl_offset++;
/* Increment map count */
(*fl_pte_shadow)++;
} else {
BUG_ON(sl_offset + 16 > NUM_SL_PTE);
sl_64k(&sl_table[sl_offset], pa, pgprot64k);
ret = sl_64k(&sl_table[sl_offset], pa,
pgprot64k);
if (ret)
goto fail;
sl_offset += 16;
/* Increment map count */
*fl_pte_shadow += 16;
@ -536,6 +541,7 @@ void msm_iommu_pagetable_unmap_range(struct msm_iommu_pt *pt, unsigned long va,
u32 fl_offset;
u32 *sl_table;
u32 sl_start, sl_end;
u32 *temp;
int used;
BUG_ON(len & (SZ_4K - 1));
@ -556,6 +562,10 @@ void msm_iommu_pagetable_unmap_range(struct msm_iommu_pt *pt, unsigned long va,
sl_end = NUM_SL_PTE;
n_entries = sl_end - sl_start;
for (temp = sl_table + sl_start;
temp < sl_table + sl_end; temp++)
BUG_ON(!*temp);
memset(sl_table + sl_start, 0, n_entries * 4);
clean_pte(sl_table + sl_start, sl_table + sl_end,
pt->redirect);