diff options
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | 10 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 119 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/gr_gm20b.c | 5 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/gr_gp10b.c | 27 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/subctx_gv11b.c | 8 |
5 files changed, 7 insertions, 162 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c index 7e0aee11..59f7fab4 100644 --- a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | |||
@@ -657,9 +657,6 @@ int gk20a_fecs_trace_bind_channel(struct gk20a *g, | |||
657 | 657 | ||
658 | mem = &ch_ctx->mem; | 658 | mem = &ch_ctx->mem; |
659 | 659 | ||
660 | if (nvgpu_mem_begin(g, mem)) | ||
661 | return -ENOMEM; | ||
662 | |||
663 | nvgpu_log(g, gpu_dbg_ctxsw, "addr_hi=%x addr_lo=%x count=%d", hi, | 660 | nvgpu_log(g, gpu_dbg_ctxsw, "addr_hi=%x addr_lo=%x count=%d", hi, |
664 | lo, GK20A_FECS_TRACE_NUM_RECORDS); | 661 | lo, GK20A_FECS_TRACE_NUM_RECORDS); |
665 | 662 | ||
@@ -668,14 +665,9 @@ int gk20a_fecs_trace_bind_channel(struct gk20a *g, | |||
668 | ctxsw_prog_main_image_context_timestamp_buffer_control_num_records_f( | 665 | ctxsw_prog_main_image_context_timestamp_buffer_control_num_records_f( |
669 | GK20A_FECS_TRACE_NUM_RECORDS)); | 666 | GK20A_FECS_TRACE_NUM_RECORDS)); |
670 | 667 | ||
671 | nvgpu_mem_end(g, mem); | ||
672 | |||
673 | if (nvgpu_is_enabled(g, NVGPU_FECS_TRACE_VA)) | 668 | if (nvgpu_is_enabled(g, NVGPU_FECS_TRACE_VA)) |
674 | mem = &ch->ctx_header.mem; | 669 | mem = &ch->ctx_header.mem; |
675 | 670 | ||
676 | if (nvgpu_mem_begin(g, mem)) | ||
677 | return -ENOMEM; | ||
678 | |||
679 | nvgpu_mem_wr(g, mem, | 671 | nvgpu_mem_wr(g, mem, |
680 | ctxsw_prog_main_image_context_timestamp_buffer_ptr_o(), | 672 | ctxsw_prog_main_image_context_timestamp_buffer_ptr_o(), |
681 | lo); | 673 | lo); |
@@ -684,8 +676,6 @@ int gk20a_fecs_trace_bind_channel(struct gk20a *g, | |||
684 | ctxsw_prog_main_image_context_timestamp_buffer_ptr_v_f(hi) | | 676 | ctxsw_prog_main_image_context_timestamp_buffer_ptr_v_f(hi) | |
685 | aperture_mask); | 677 | aperture_mask); |
686 | 678 | ||
687 | nvgpu_mem_end(g, mem); | ||
688 | |||
689 | /* pid (process identifier) in user space, corresponds to tgid (thread | 679 | /* pid (process identifier) in user space, corresponds to tgid (thread |
690 | * group id) in kernel space. | 680 | * group id) in kernel space. |
691 | */ | 681 | */ |
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index 28ccb896..b218397a 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c | |||
@@ -111,15 +111,10 @@ int gr_gk20a_get_ctx_id(struct gk20a *g, | |||
111 | Flush and invalidate before cpu update. */ | 111 | Flush and invalidate before cpu update. */ |
112 | g->ops.mm.l2_flush(g, true); | 112 | g->ops.mm.l2_flush(g, true); |
113 | 113 | ||
114 | if (nvgpu_mem_begin(g, mem)) | ||
115 | return -ENOMEM; | ||
116 | |||
117 | *ctx_id = nvgpu_mem_rd(g, mem, | 114 | *ctx_id = nvgpu_mem_rd(g, mem, |
118 | ctxsw_prog_main_image_context_id_o()); | 115 | ctxsw_prog_main_image_context_id_o()); |
119 | nvgpu_log(g, gpu_dbg_fn | gpu_dbg_intr, "ctx_id: 0x%x", *ctx_id); | 116 | nvgpu_log(g, gpu_dbg_fn | gpu_dbg_intr, "ctx_id: 0x%x", *ctx_id); |
120 | 117 | ||
121 | nvgpu_mem_end(g, mem); | ||
122 | |||
123 | return 0; | 118 | return 0; |
124 | } | 119 | } |
125 | 120 | ||
@@ -696,12 +691,6 @@ int gr_gk20a_ctx_patch_write_begin(struct gk20a *g, | |||
696 | struct nvgpu_gr_ctx *gr_ctx, | 691 | struct nvgpu_gr_ctx *gr_ctx, |
697 | bool update_patch_count) | 692 | bool update_patch_count) |
698 | { | 693 | { |
699 | int err = 0; | ||
700 | |||
701 | err = nvgpu_mem_begin(g, &gr_ctx->patch_ctx.mem); | ||
702 | if (err) | ||
703 | return err; | ||
704 | |||
705 | if (update_patch_count) { | 694 | if (update_patch_count) { |
706 | /* reset patch count if ucode has already processed it */ | 695 | /* reset patch count if ucode has already processed it */ |
707 | gr_ctx->patch_ctx.data_count = nvgpu_mem_rd(g, | 696 | gr_ctx->patch_ctx.data_count = nvgpu_mem_rd(g, |
@@ -717,8 +706,6 @@ void gr_gk20a_ctx_patch_write_end(struct gk20a *g, | |||
717 | struct nvgpu_gr_ctx *gr_ctx, | 706 | struct nvgpu_gr_ctx *gr_ctx, |
718 | bool update_patch_count) | 707 | bool update_patch_count) |
719 | { | 708 | { |
720 | nvgpu_mem_end(g, &gr_ctx->patch_ctx.mem); | ||
721 | |||
722 | /* Write context count to context image if it is mapped */ | 709 | /* Write context count to context image if it is mapped */ |
723 | if (update_patch_count) { | 710 | if (update_patch_count) { |
724 | nvgpu_mem_wr(g, &gr_ctx->mem, | 711 | nvgpu_mem_wr(g, &gr_ctx->mem, |
@@ -832,31 +819,22 @@ static int gr_gk20a_ctx_zcull_setup(struct gk20a *g, struct channel_gk20a *c) | |||
832 | gr_ctx = &tsg->gr_ctx; | 819 | gr_ctx = &tsg->gr_ctx; |
833 | mem = &gr_ctx->mem; | 820 | mem = &gr_ctx->mem; |
834 | 821 | ||
835 | if (nvgpu_mem_begin(g, mem)) | ||
836 | return -ENOMEM; | ||
837 | |||
838 | if (nvgpu_mem_begin(g, ctxheader)) { | ||
839 | ret = -ENOMEM; | ||
840 | goto clean_up_mem; | ||
841 | } | ||
842 | |||
843 | if (gr_ctx->zcull_ctx.gpu_va == 0 && | 822 | if (gr_ctx->zcull_ctx.gpu_va == 0 && |
844 | gr_ctx->zcull_ctx.ctx_sw_mode == | 823 | gr_ctx->zcull_ctx.ctx_sw_mode == |
845 | ctxsw_prog_main_image_zcull_mode_separate_buffer_v()) { | 824 | ctxsw_prog_main_image_zcull_mode_separate_buffer_v()) { |
846 | ret = -EINVAL; | 825 | return -EINVAL; |
847 | goto clean_up; | ||
848 | } | 826 | } |
849 | 827 | ||
850 | ret = gk20a_disable_channel_tsg(g, c); | 828 | ret = gk20a_disable_channel_tsg(g, c); |
851 | if (ret) { | 829 | if (ret) { |
852 | nvgpu_err(g, "failed to disable channel/TSG"); | 830 | nvgpu_err(g, "failed to disable channel/TSG"); |
853 | goto clean_up; | 831 | return ret; |
854 | } | 832 | } |
855 | ret = gk20a_fifo_preempt(g, c); | 833 | ret = gk20a_fifo_preempt(g, c); |
856 | if (ret) { | 834 | if (ret) { |
857 | gk20a_enable_channel_tsg(g, c); | 835 | gk20a_enable_channel_tsg(g, c); |
858 | nvgpu_err(g, "failed to preempt channel/TSG"); | 836 | nvgpu_err(g, "failed to preempt channel/TSG"); |
859 | goto clean_up; | 837 | return ret; |
860 | } | 838 | } |
861 | 839 | ||
862 | nvgpu_mem_wr(g, mem, | 840 | nvgpu_mem_wr(g, mem, |
@@ -871,11 +849,6 @@ static int gr_gk20a_ctx_zcull_setup(struct gk20a *g, struct channel_gk20a *c) | |||
871 | 849 | ||
872 | gk20a_enable_channel_tsg(g, c); | 850 | gk20a_enable_channel_tsg(g, c); |
873 | 851 | ||
874 | clean_up: | ||
875 | nvgpu_mem_end(g, ctxheader); | ||
876 | clean_up_mem: | ||
877 | nvgpu_mem_end(g, mem); | ||
878 | |||
879 | return ret; | 852 | return ret; |
880 | } | 853 | } |
881 | 854 | ||
@@ -1597,12 +1570,6 @@ restore_fe_go_idle: | |||
1597 | goto restore_fe_go_idle; | 1570 | goto restore_fe_go_idle; |
1598 | } | 1571 | } |
1599 | 1572 | ||
1600 | if (nvgpu_mem_begin(g, gold_mem)) | ||
1601 | goto clean_up; | ||
1602 | |||
1603 | if (nvgpu_mem_begin(g, gr_mem)) | ||
1604 | goto clean_up; | ||
1605 | |||
1606 | ctx_header_words = roundup(ctx_header_bytes, sizeof(u32)); | 1573 | ctx_header_words = roundup(ctx_header_bytes, sizeof(u32)); |
1607 | ctx_header_words >>= 2; | 1574 | ctx_header_words >>= 2; |
1608 | 1575 | ||
@@ -1655,9 +1622,6 @@ clean_up: | |||
1655 | else | 1622 | else |
1656 | nvgpu_log_fn(g, "done"); | 1623 | nvgpu_log_fn(g, "done"); |
1657 | 1624 | ||
1658 | nvgpu_mem_end(g, gold_mem); | ||
1659 | nvgpu_mem_end(g, gr_mem); | ||
1660 | |||
1661 | nvgpu_mutex_release(&gr->ctx_mutex); | 1625 | nvgpu_mutex_release(&gr->ctx_mutex); |
1662 | return err; | 1626 | return err; |
1663 | } | 1627 | } |
@@ -1701,11 +1665,6 @@ int gr_gk20a_update_smpc_ctxsw_mode(struct gk20a *g, | |||
1701 | Flush and invalidate before cpu update. */ | 1665 | Flush and invalidate before cpu update. */ |
1702 | g->ops.mm.l2_flush(g, true); | 1666 | g->ops.mm.l2_flush(g, true); |
1703 | 1667 | ||
1704 | if (nvgpu_mem_begin(g, mem)) { | ||
1705 | ret = -ENOMEM; | ||
1706 | goto out; | ||
1707 | } | ||
1708 | |||
1709 | data = nvgpu_mem_rd(g, mem, | 1668 | data = nvgpu_mem_rd(g, mem, |
1710 | ctxsw_prog_main_image_pm_o()); | 1669 | ctxsw_prog_main_image_pm_o()); |
1711 | 1670 | ||
@@ -1717,7 +1676,6 @@ int gr_gk20a_update_smpc_ctxsw_mode(struct gk20a *g, | |||
1717 | nvgpu_mem_wr(g, mem, | 1676 | nvgpu_mem_wr(g, mem, |
1718 | ctxsw_prog_main_image_pm_o(), data); | 1677 | ctxsw_prog_main_image_pm_o(), data); |
1719 | 1678 | ||
1720 | nvgpu_mem_end(g, mem); | ||
1721 | out: | 1679 | out: |
1722 | gk20a_enable_channel_tsg(g, c); | 1680 | gk20a_enable_channel_tsg(g, c); |
1723 | return ret; | 1681 | return ret; |
@@ -1807,24 +1765,7 @@ int gr_gk20a_update_hwpm_ctxsw_mode(struct gk20a *g, | |||
1807 | } | 1765 | } |
1808 | 1766 | ||
1809 | /* Now clear the buffer */ | 1767 | /* Now clear the buffer */ |
1810 | if (nvgpu_mem_begin(g, &pm_ctx->mem)) { | ||
1811 | ret = -ENOMEM; | ||
1812 | goto cleanup_pm_buf; | ||
1813 | } | ||
1814 | |||
1815 | nvgpu_memset(g, &pm_ctx->mem, 0, 0, pm_ctx->mem.size); | 1768 | nvgpu_memset(g, &pm_ctx->mem, 0, 0, pm_ctx->mem.size); |
1816 | |||
1817 | nvgpu_mem_end(g, &pm_ctx->mem); | ||
1818 | } | ||
1819 | |||
1820 | if (nvgpu_mem_begin(g, gr_mem)) { | ||
1821 | ret = -ENOMEM; | ||
1822 | goto cleanup_pm_buf; | ||
1823 | } | ||
1824 | |||
1825 | if (nvgpu_mem_begin(g, ctxheader)) { | ||
1826 | ret = -ENOMEM; | ||
1827 | goto clean_up_mem; | ||
1828 | } | 1769 | } |
1829 | 1770 | ||
1830 | data = nvgpu_mem_rd(g, gr_mem, ctxsw_prog_main_image_pm_o()); | 1771 | data = nvgpu_mem_rd(g, gr_mem, ctxsw_prog_main_image_pm_o()); |
@@ -1848,22 +1789,10 @@ int gr_gk20a_update_hwpm_ctxsw_mode(struct gk20a *g, | |||
1848 | else | 1789 | else |
1849 | g->ops.gr.write_pm_ptr(g, gr_mem, virt_addr); | 1790 | g->ops.gr.write_pm_ptr(g, gr_mem, virt_addr); |
1850 | 1791 | ||
1851 | nvgpu_mem_end(g, ctxheader); | ||
1852 | nvgpu_mem_end(g, gr_mem); | ||
1853 | |||
1854 | /* enable channel */ | 1792 | /* enable channel */ |
1855 | gk20a_enable_channel_tsg(g, c); | 1793 | gk20a_enable_channel_tsg(g, c); |
1856 | 1794 | ||
1857 | return 0; | 1795 | return 0; |
1858 | clean_up_mem: | ||
1859 | nvgpu_mem_end(g, gr_mem); | ||
1860 | cleanup_pm_buf: | ||
1861 | nvgpu_gmmu_unmap(c->vm, &pm_ctx->mem, pm_ctx->mem.gpu_va); | ||
1862 | nvgpu_dma_free(g, &pm_ctx->mem); | ||
1863 | memset(&pm_ctx->mem, 0, sizeof(struct nvgpu_mem)); | ||
1864 | |||
1865 | gk20a_enable_channel_tsg(g, c); | ||
1866 | return ret; | ||
1867 | } | 1796 | } |
1868 | 1797 | ||
1869 | void gk20a_gr_init_ctxsw_hdr_data(struct gk20a *g, | 1798 | void gk20a_gr_init_ctxsw_hdr_data(struct gk20a *g, |
@@ -1904,9 +1833,6 @@ int gr_gk20a_load_golden_ctx_image(struct gk20a *g, | |||
1904 | Flush and invalidate before cpu update. */ | 1833 | Flush and invalidate before cpu update. */ |
1905 | g->ops.mm.l2_flush(g, true); | 1834 | g->ops.mm.l2_flush(g, true); |
1906 | 1835 | ||
1907 | if (nvgpu_mem_begin(g, mem)) | ||
1908 | return -ENOMEM; | ||
1909 | |||
1910 | nvgpu_mem_wr_n(g, mem, 0, | 1836 | nvgpu_mem_wr_n(g, mem, 0, |
1911 | gr->ctx_vars.local_golden_image, | 1837 | gr->ctx_vars.local_golden_image, |
1912 | gr->ctx_vars.golden_image_size); | 1838 | gr->ctx_vars.golden_image_size); |
@@ -1973,7 +1899,6 @@ int gr_gk20a_load_golden_ctx_image(struct gk20a *g, | |||
1973 | if (gr_ctx->pm_ctx.mem.gpu_va == 0) { | 1899 | if (gr_ctx->pm_ctx.mem.gpu_va == 0) { |
1974 | nvgpu_err(g, | 1900 | nvgpu_err(g, |
1975 | "context switched pm with no pm buffer!"); | 1901 | "context switched pm with no pm buffer!"); |
1976 | nvgpu_mem_end(g, mem); | ||
1977 | return -EFAULT; | 1902 | return -EFAULT; |
1978 | } | 1903 | } |
1979 | 1904 | ||
@@ -1989,8 +1914,6 @@ int gr_gk20a_load_golden_ctx_image(struct gk20a *g, | |||
1989 | 1914 | ||
1990 | g->ops.gr.write_pm_ptr(g, mem, virt_addr); | 1915 | g->ops.gr.write_pm_ptr(g, mem, virt_addr); |
1991 | 1916 | ||
1992 | nvgpu_mem_end(g, mem); | ||
1993 | |||
1994 | return ret; | 1917 | return ret; |
1995 | } | 1918 | } |
1996 | 1919 | ||
@@ -4840,12 +4763,6 @@ static int gr_gk20a_init_access_map(struct gk20a *g) | |||
4840 | u32 *whitelist = NULL; | 4763 | u32 *whitelist = NULL; |
4841 | int w, num_entries = 0; | 4764 | int w, num_entries = 0; |
4842 | 4765 | ||
4843 | if (nvgpu_mem_begin(g, mem)) { | ||
4844 | nvgpu_err(g, | ||
4845 | "failed to map priv access map memory"); | ||
4846 | return -ENOMEM; | ||
4847 | } | ||
4848 | |||
4849 | nvgpu_memset(g, mem, 0, 0, PAGE_SIZE * nr_pages); | 4766 | nvgpu_memset(g, mem, 0, 0, PAGE_SIZE * nr_pages); |
4850 | 4767 | ||
4851 | g->ops.gr.get_access_map(g, &whitelist, &num_entries); | 4768 | g->ops.gr.get_access_map(g, &whitelist, &num_entries); |
@@ -4864,7 +4781,6 @@ static int gr_gk20a_init_access_map(struct gk20a *g) | |||
4864 | nvgpu_mem_wr32(g, mem, map_byte / sizeof(u32), x); | 4781 | nvgpu_mem_wr32(g, mem, map_byte / sizeof(u32), x); |
4865 | } | 4782 | } |
4866 | 4783 | ||
4867 | nvgpu_mem_end(g, mem); | ||
4868 | return 0; | 4784 | return 0; |
4869 | } | 4785 | } |
4870 | 4786 | ||
@@ -6758,22 +6674,12 @@ static int gr_gk20a_ctx_patch_smpc(struct gk20a *g, | |||
6758 | ctxsw_prog_main_image_patch_count_o(), | 6674 | ctxsw_prog_main_image_patch_count_o(), |
6759 | gr_ctx->patch_ctx.data_count); | 6675 | gr_ctx->patch_ctx.data_count); |
6760 | if (ctxheader->gpu_va) { | 6676 | if (ctxheader->gpu_va) { |
6761 | /* | ||
6762 | * Main context can be gr_ctx or pm_ctx. | ||
6763 | * CPU access for relevant ctx is taken | ||
6764 | * care of in the calling function | ||
6765 | * __gr_gk20a_exec_ctx_ops. Need to take | ||
6766 | * care of cpu access to ctxheader here. | ||
6767 | */ | ||
6768 | if (nvgpu_mem_begin(g, ctxheader)) | ||
6769 | return -ENOMEM; | ||
6770 | nvgpu_mem_wr(g, ctxheader, | 6677 | nvgpu_mem_wr(g, ctxheader, |
6771 | ctxsw_prog_main_image_patch_adr_lo_o(), | 6678 | ctxsw_prog_main_image_patch_adr_lo_o(), |
6772 | vaddr_lo); | 6679 | vaddr_lo); |
6773 | nvgpu_mem_wr(g, ctxheader, | 6680 | nvgpu_mem_wr(g, ctxheader, |
6774 | ctxsw_prog_main_image_patch_adr_hi_o(), | 6681 | ctxsw_prog_main_image_patch_adr_hi_o(), |
6775 | vaddr_hi); | 6682 | vaddr_hi); |
6776 | nvgpu_mem_end(g, ctxheader); | ||
6777 | } else { | 6683 | } else { |
6778 | nvgpu_mem_wr(g, mem, | 6684 | nvgpu_mem_wr(g, mem, |
6779 | ctxsw_prog_main_image_patch_adr_lo_o(), | 6685 | ctxsw_prog_main_image_patch_adr_lo_o(), |
@@ -8038,17 +7944,8 @@ int __gr_gk20a_exec_ctx_ops(struct channel_gk20a *ch, | |||
8038 | ctx_ops[i].type == REGOP(TYPE_GR_CTX_QUAD), | 7944 | ctx_ops[i].type == REGOP(TYPE_GR_CTX_QUAD), |
8039 | ctx_ops[i].quad); | 7945 | ctx_ops[i].quad); |
8040 | if (!err) { | 7946 | if (!err) { |
8041 | if (!gr_ctx_ready) { | 7947 | if (!gr_ctx_ready) |
8042 | /* would have been a variant of | ||
8043 | * gr_gk20a_apply_instmem_overrides, | ||
8044 | * recoded in-place instead. | ||
8045 | */ | ||
8046 | if (nvgpu_mem_begin(g, &gr_ctx->mem)) { | ||
8047 | err = -ENOMEM; | ||
8048 | goto cleanup; | ||
8049 | } | ||
8050 | gr_ctx_ready = true; | 7948 | gr_ctx_ready = true; |
8051 | } | ||
8052 | current_mem = &gr_ctx->mem; | 7949 | current_mem = &gr_ctx->mem; |
8053 | } else { | 7950 | } else { |
8054 | err = gr_gk20a_get_pm_ctx_buffer_offsets(g, | 7951 | err = gr_gk20a_get_pm_ctx_buffer_offsets(g, |
@@ -8072,10 +7969,6 @@ int __gr_gk20a_exec_ctx_ops(struct channel_gk20a *ch, | |||
8072 | err = -EINVAL; | 7969 | err = -EINVAL; |
8073 | goto cleanup; | 7970 | goto cleanup; |
8074 | } | 7971 | } |
8075 | if (nvgpu_mem_begin(g, &gr_ctx->pm_ctx.mem)) { | ||
8076 | err = -ENOMEM; | ||
8077 | goto cleanup; | ||
8078 | } | ||
8079 | pm_ctx_ready = true; | 7972 | pm_ctx_ready = true; |
8080 | } | 7973 | } |
8081 | current_mem = &gr_ctx->pm_ctx.mem; | 7974 | current_mem = &gr_ctx->pm_ctx.mem; |
@@ -8148,10 +8041,6 @@ int __gr_gk20a_exec_ctx_ops(struct channel_gk20a *ch, | |||
8148 | 8041 | ||
8149 | if (gr_ctx->patch_ctx.mem.cpu_va) | 8042 | if (gr_ctx->patch_ctx.mem.cpu_va) |
8150 | gr_gk20a_ctx_patch_write_end(g, gr_ctx, gr_ctx_ready); | 8043 | gr_gk20a_ctx_patch_write_end(g, gr_ctx, gr_ctx_ready); |
8151 | if (gr_ctx_ready) | ||
8152 | nvgpu_mem_end(g, &gr_ctx->mem); | ||
8153 | if (pm_ctx_ready) | ||
8154 | nvgpu_mem_end(g, &gr_ctx->pm_ctx.mem); | ||
8155 | 8044 | ||
8156 | return err; | 8045 | return err; |
8157 | } | 8046 | } |
diff --git a/drivers/gpu/nvgpu/gm20b/gr_gm20b.c b/drivers/gpu/nvgpu/gm20b/gr_gm20b.c index 261c3054..f9eb97ce 100644 --- a/drivers/gpu/nvgpu/gm20b/gr_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/gr_gm20b.c | |||
@@ -1056,16 +1056,11 @@ int gr_gm20b_update_pc_sampling(struct channel_gk20a *c, | |||
1056 | return -EINVAL; | 1056 | return -EINVAL; |
1057 | 1057 | ||
1058 | 1058 | ||
1059 | if (nvgpu_mem_begin(c->g, mem)) | ||
1060 | return -ENOMEM; | ||
1061 | |||
1062 | v = nvgpu_mem_rd(c->g, mem, ctxsw_prog_main_image_pm_o()); | 1059 | v = nvgpu_mem_rd(c->g, mem, ctxsw_prog_main_image_pm_o()); |
1063 | v &= ~ctxsw_prog_main_image_pm_pc_sampling_m(); | 1060 | v &= ~ctxsw_prog_main_image_pm_pc_sampling_m(); |
1064 | v |= ctxsw_prog_main_image_pm_pc_sampling_f(enable); | 1061 | v |= ctxsw_prog_main_image_pm_pc_sampling_f(enable); |
1065 | nvgpu_mem_wr(c->g, mem, ctxsw_prog_main_image_pm_o(), v); | 1062 | nvgpu_mem_wr(c->g, mem, ctxsw_prog_main_image_pm_o(), v); |
1066 | 1063 | ||
1067 | nvgpu_mem_end(c->g, mem); | ||
1068 | |||
1069 | nvgpu_log_fn(c->g, "done"); | 1064 | nvgpu_log_fn(c->g, "done"); |
1070 | 1065 | ||
1071 | return 0; | 1066 | return 0; |
diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c index be9a7cf6..6249992a 100644 --- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c | |||
@@ -1115,10 +1115,6 @@ void gr_gp10b_dump_ctxsw_stats(struct gk20a *g, struct vm_gk20a *vm, | |||
1115 | { | 1115 | { |
1116 | struct nvgpu_mem *mem = &gr_ctx->mem; | 1116 | struct nvgpu_mem *mem = &gr_ctx->mem; |
1117 | 1117 | ||
1118 | if (nvgpu_mem_begin(g, mem)) { | ||
1119 | WARN_ON("Cannot map context"); | ||
1120 | return; | ||
1121 | } | ||
1122 | nvgpu_err(g, "ctxsw_prog_main_image_magic_value_o : %x (expect %x)", | 1118 | nvgpu_err(g, "ctxsw_prog_main_image_magic_value_o : %x (expect %x)", |
1123 | nvgpu_mem_rd(g, mem, | 1119 | nvgpu_mem_rd(g, mem, |
1124 | ctxsw_prog_main_image_magic_value_o()), | 1120 | ctxsw_prog_main_image_magic_value_o()), |
@@ -1159,7 +1155,6 @@ void gr_gp10b_dump_ctxsw_stats(struct gk20a *g, struct vm_gk20a *vm, | |||
1159 | "image compute preemption option (CTA is 1) %x", | 1155 | "image compute preemption option (CTA is 1) %x", |
1160 | nvgpu_mem_rd(g, mem, | 1156 | nvgpu_mem_rd(g, mem, |
1161 | ctxsw_prog_main_image_compute_preemption_options_o())); | 1157 | ctxsw_prog_main_image_compute_preemption_options_o())); |
1162 | nvgpu_mem_end(g, mem); | ||
1163 | } | 1158 | } |
1164 | 1159 | ||
1165 | void gr_gp10b_update_ctxsw_preemption_mode(struct gk20a *g, | 1160 | void gr_gp10b_update_ctxsw_preemption_mode(struct gk20a *g, |
@@ -2175,12 +2170,9 @@ int gr_gp10b_set_boosted_ctx(struct channel_gk20a *ch, | |||
2175 | gr_ctx->boosted_ctx = boost; | 2170 | gr_ctx->boosted_ctx = boost; |
2176 | mem = &gr_ctx->mem; | 2171 | mem = &gr_ctx->mem; |
2177 | 2172 | ||
2178 | if (nvgpu_mem_begin(g, mem)) | ||
2179 | return -ENOMEM; | ||
2180 | |||
2181 | err = gk20a_disable_channel_tsg(g, ch); | 2173 | err = gk20a_disable_channel_tsg(g, ch); |
2182 | if (err) | 2174 | if (err) |
2183 | goto unmap_ctx; | 2175 | return err; |
2184 | 2176 | ||
2185 | err = gk20a_fifo_preempt(g, ch); | 2177 | err = gk20a_fifo_preempt(g, ch); |
2186 | if (err) | 2178 | if (err) |
@@ -2193,8 +2185,6 @@ int gr_gp10b_set_boosted_ctx(struct channel_gk20a *ch, | |||
2193 | 2185 | ||
2194 | enable_ch: | 2186 | enable_ch: |
2195 | gk20a_enable_channel_tsg(g, ch); | 2187 | gk20a_enable_channel_tsg(g, ch); |
2196 | unmap_ctx: | ||
2197 | nvgpu_mem_end(g, mem); | ||
2198 | 2188 | ||
2199 | return err; | 2189 | return err; |
2200 | } | 2190 | } |
@@ -2217,8 +2207,6 @@ int gr_gp10b_set_preemption_mode(struct channel_gk20a *ch, | |||
2217 | struct tsg_gk20a *tsg; | 2207 | struct tsg_gk20a *tsg; |
2218 | struct vm_gk20a *vm; | 2208 | struct vm_gk20a *vm; |
2219 | struct nvgpu_mem *mem; | 2209 | struct nvgpu_mem *mem; |
2220 | struct ctx_header_desc *ctx = &ch->ctx_header; | ||
2221 | struct nvgpu_mem *ctxheader = &ctx->mem; | ||
2222 | u32 class; | 2210 | u32 class; |
2223 | int err = 0; | 2211 | int err = 0; |
2224 | 2212 | ||
@@ -2263,15 +2251,9 @@ int gr_gp10b_set_preemption_mode(struct channel_gk20a *ch, | |||
2263 | } | 2251 | } |
2264 | } | 2252 | } |
2265 | 2253 | ||
2266 | if (nvgpu_mem_begin(g, mem)) | ||
2267 | return -ENOMEM; | ||
2268 | |||
2269 | if (nvgpu_mem_begin(g, ctxheader)) | ||
2270 | goto unamp_ctx_header; | ||
2271 | |||
2272 | err = gk20a_disable_channel_tsg(g, ch); | 2254 | err = gk20a_disable_channel_tsg(g, ch); |
2273 | if (err) | 2255 | if (err) |
2274 | goto unmap_ctx; | 2256 | return err; |
2275 | 2257 | ||
2276 | err = gk20a_fifo_preempt(g, ch); | 2258 | err = gk20a_fifo_preempt(g, ch); |
2277 | if (err) | 2259 | if (err) |
@@ -2292,11 +2274,6 @@ int gr_gp10b_set_preemption_mode(struct channel_gk20a *ch, | |||
2292 | 2274 | ||
2293 | enable_ch: | 2275 | enable_ch: |
2294 | gk20a_enable_channel_tsg(g, ch); | 2276 | gk20a_enable_channel_tsg(g, ch); |
2295 | unmap_ctx: | ||
2296 | nvgpu_mem_end(g, ctxheader); | ||
2297 | unamp_ctx_header: | ||
2298 | nvgpu_mem_end(g, mem); | ||
2299 | |||
2300 | return err; | 2277 | return err; |
2301 | } | 2278 | } |
2302 | 2279 | ||
diff --git a/drivers/gpu/nvgpu/gv11b/subctx_gv11b.c b/drivers/gpu/nvgpu/gv11b/subctx_gv11b.c index 61fb8954..aad2b2fc 100644 --- a/drivers/gpu/nvgpu/gv11b/subctx_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/subctx_gv11b.c | |||
@@ -82,11 +82,7 @@ int gv11b_alloc_subctx_header(struct channel_gk20a *c) | |||
82 | return -ENOMEM; | 82 | return -ENOMEM; |
83 | } | 83 | } |
84 | /* Now clear the buffer */ | 84 | /* Now clear the buffer */ |
85 | if (nvgpu_mem_begin(g, &ctx->mem)) | ||
86 | return -ENOMEM; | ||
87 | |||
88 | nvgpu_memset(g, &ctx->mem, 0, 0, ctx->mem.size); | 85 | nvgpu_memset(g, &ctx->mem, 0, 0, ctx->mem.size); |
89 | nvgpu_mem_end(g, &ctx->mem); | ||
90 | } | 86 | } |
91 | return ret; | 87 | return ret; |
92 | } | 88 | } |
@@ -117,8 +113,6 @@ int gv11b_update_subctx_header(struct channel_gk20a *c, u64 gpu_va) | |||
117 | 113 | ||
118 | gr_mem = &ctx->mem; | 114 | gr_mem = &ctx->mem; |
119 | g->ops.mm.l2_flush(g, true); | 115 | g->ops.mm.l2_flush(g, true); |
120 | if (nvgpu_mem_begin(g, gr_mem)) | ||
121 | return -ENOMEM; | ||
122 | 116 | ||
123 | /* set priv access map */ | 117 | /* set priv access map */ |
124 | addr_lo = u64_lo32(gr_ctx->global_ctx_buffer_va[PRIV_ACCESS_MAP_VA]); | 118 | addr_lo = u64_lo32(gr_ctx->global_ctx_buffer_va[PRIV_ACCESS_MAP_VA]); |
@@ -153,7 +147,7 @@ int gv11b_update_subctx_header(struct channel_gk20a *c, u64 gpu_va) | |||
153 | nvgpu_mem_wr(g, gr_mem, | 147 | nvgpu_mem_wr(g, gr_mem, |
154 | ctxsw_prog_main_image_ctl_o(), | 148 | ctxsw_prog_main_image_ctl_o(), |
155 | ctxsw_prog_main_image_ctl_type_per_veid_header_v()); | 149 | ctxsw_prog_main_image_ctl_type_per_veid_header_v()); |
156 | nvgpu_mem_end(g, gr_mem); | 150 | |
157 | return ret; | 151 | return ret; |
158 | } | 152 | } |
159 | 153 | ||