video: tegra: host: Multiple chunks per gMMU page
Terje Bergstrom [Wed, 24 Apr 2013 12:14:55 +0000 (15:14 +0300)]
There might be multiple scatterlist chunks for each gMMU page. Deal
with that by skipping as many chunks as needed.

Change-Id: Ide704980ae40a786a11950b3070730cd55721974
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/222476
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Lauri Peltonen <lpeltonen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ken Adams <kadams@nvidia.com>

drivers/video/tegra/host/gk20a/mm_gk20a.c

index 4acec87..7b326a2 100644 (file)
@@ -1040,9 +1040,10 @@ static int update_gmmu_ptes(struct vm_gk20a *vm, u32 page_size_idx,
                                        pte_w[1] |= gmmu_pte_vol_true_f();
 
                                cur_offset += 1 << page_shift;
-                               if (cur_offset >= cur_chunk->length) {
+                               while (cur_chunk &&
+                                       cur_offset >= cur_chunk->length) {
+                                       cur_offset -= cur_chunk->length;
                                        cur_chunk = sg_next(cur_chunk);
-                                       cur_offset = 0;
                                }
                                pte->ref_cnt++;
                        } else {