summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2014-11-05 08:21:32 -0500
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:12:07 -0400
commit2c5fdd1c8a76ef9ca21abcf894f2c9525d57fd49 (patch)
tree7fc979029d0f0acddecd22637a3aa2e92c450dc5
parent2c23d1066f947e697240f5e61529c5b48407fa08 (diff)
gpu: nvgpu: Fix comptag calculation for 64k pages
Comptags are assigned per 128k. For 64k pages this means we need to assign same index to two pages. Change the logic to use byte sizes. Change-Id: If298d6b10f1c1cad8cd390f686d22db103b02d12 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/594403
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
index 08dd41c5..c37f790e 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
@@ -1685,7 +1685,7 @@ static int update_gmmu_ptes_locked(struct vm_gk20a *vm,
1685 struct scatterlist *cur_chunk; 1685 struct scatterlist *cur_chunk;
1686 unsigned int cur_offset; 1686 unsigned int cur_offset;
1687 u32 pte_w[2] = {0, 0}; /* invalid pte */ 1687 u32 pte_w[2] = {0, 0}; /* invalid pte */
1688 u32 ctag = ctag_offset; 1688 u32 ctag = ctag_offset * SZ_128K;
1689 u32 ctag_incr; 1689 u32 ctag_incr;
1690 u32 page_size = vm->gmmu_page_sizes[pgsz_idx]; 1690 u32 page_size = vm->gmmu_page_sizes[pgsz_idx];
1691 u64 addr = 0; 1691 u64 addr = 0;
@@ -1700,7 +1700,7 @@ static int update_gmmu_ptes_locked(struct vm_gk20a *vm,
1700 /* If ctag_offset !=0 add 1 else add 0. The idea is to avoid a branch 1700 /* If ctag_offset !=0 add 1 else add 0. The idea is to avoid a branch
1701 * below (per-pte). Note: this doesn't work unless page size (when 1701 * below (per-pte). Note: this doesn't work unless page size (when
1702 * comptags are active) is 128KB. We have checks elsewhere for that. */ 1702 * comptags are active) is 128KB. We have checks elsewhere for that. */
1703 ctag_incr = !!ctag_offset; 1703 ctag_incr = ctag_offset ? page_size : 0;
1704 1704
1705 cur_offset = 0; 1705 cur_offset = 0;
1706 if (sgt) { 1706 if (sgt) {
@@ -1769,7 +1769,7 @@ static int update_gmmu_ptes_locked(struct vm_gk20a *vm,
1769 >> gmmu_pte_address_shift_v()); 1769 >> gmmu_pte_address_shift_v());
1770 pte_w[1] = gmmu_pte_aperture_video_memory_f() | 1770 pte_w[1] = gmmu_pte_aperture_video_memory_f() |
1771 gmmu_pte_kind_f(kind_v) | 1771 gmmu_pte_kind_f(kind_v) |
1772 gmmu_pte_comptagline_f(ctag); 1772 gmmu_pte_comptagline_f(ctag / SZ_128K);
1773 1773
1774 if (rw_flag == gk20a_mem_flag_read_only) { 1774 if (rw_flag == gk20a_mem_flag_read_only) {
1775 pte_w[0] |= gmmu_pte_read_only_true_f(); 1775 pte_w[0] |= gmmu_pte_read_only_true_f();