summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c
diff options
context:
space:
mode:
authorseshendra Gadagottu <sgadagottu@nvidia.com>2017-07-06 01:55:39 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-10-13 18:19:17 -0400
commit506f891f76800b059e960a195bb0da4c71cb2e16 (patch)
tree220c50356430b38c682bd80a21d7f337b4d086e2 /drivers/gpu/nvgpu/gv11b/fifo_gv11b.c
parenta693acc5b45020b359bf11f0370b7dd63d4f994c (diff)
gpu: nvgpu: gv11b: add syncpt shim ro map
For sync-point read map, create read only map per vm and share with all channels that are using same vm. Now restrict rw map to single syncpoint shim memory range. JIRA GPUT19X-2 Change-Id: Ibd0b82d1cdb8861e1dbb073b27da1f9c9ab1d2ab Signed-off-by: seshendra Gadagottu <sgadagottu@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1514339 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gv11b/fifo_gv11b.c')
-rw-r--r--drivers/gpu/nvgpu/gv11b/fifo_gv11b.c48
1 files changed, 27 insertions, 21 deletions
diff --git a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c
index 5fe40663..b8798033 100644
--- a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c
@@ -1664,33 +1664,41 @@ void gv11b_fifo_deinit_eng_method_buffers(struct gk20a *g,
1664int gv11b_fifo_alloc_syncpt_buf(struct channel_gk20a *c, 1664int gv11b_fifo_alloc_syncpt_buf(struct channel_gk20a *c,
1665 u32 syncpt_id, struct nvgpu_mem *syncpt_buf) 1665 u32 syncpt_id, struct nvgpu_mem *syncpt_buf)
1666{ 1666{
1667 struct page **pages;
1668 u32 nr_pages; 1667 u32 nr_pages;
1669 u32 i;
1670 int err = 0; 1668 int err = 0;
1671 struct gk20a *g = c->g; 1669 struct gk20a *g = c->g;
1670 struct vm_gk20a *vm = c->vm;
1672 1671
1673 /* 1672 /*
1674 * Add rw mapping for entire syncpt shim for current channel vm 1673 * Add ro map for complete sync point shim range in vm
1675 * TODO : This needs to replaced with a new mecahnism where 1674 * All channels sharing same vm will share same ro mapping.
1676 * only current syncpoint range will be rw and other sync 1675 * Create rw map for current channel sync point
1677 * points range is read only for current channel vm. Also share 1676 */
1678 * these mapping accross channels if they share same vm 1677 if (!vm->syncpt_ro_map_gpu_va) {
1679 */ 1678 vm->syncpt_ro_map_gpu_va = nvgpu_gmmu_map(c->vm,
1680 nr_pages = DIV_ROUND_UP(g->syncpt_unit_size, PAGE_SIZE); 1679 &g->syncpt_mem, g->syncpt_unit_size,
1681 pages = nvgpu_kzalloc(g, sizeof(struct page *) * nr_pages); 1680 0, gk20a_mem_flag_read_only,
1682 for (i = 0; i < nr_pages; i++) 1681 false, APERTURE_SYSMEM);
1683 pages[i] = phys_to_page(g->syncpt_unit_base + 1682
1684 PAGE_SIZE * i); 1683 if (!vm->syncpt_ro_map_gpu_va) {
1685 __nvgpu_mem_create_from_pages(g, syncpt_buf, pages, nr_pages); 1684 nvgpu_err(g, "failed to ro map syncpt buffer");
1686 nvgpu_kfree(g, pages); 1685 nvgpu_dma_free(g, &g->syncpt_mem);
1686 err = -ENOMEM;
1687 }
1688 }
1689
1690 nr_pages = DIV_ROUND_UP(g->syncpt_size, PAGE_SIZE);
1691 __nvgpu_mem_create_from_phys(g, syncpt_buf,
1692 (g->syncpt_unit_base +
1693 nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(syncpt_id)),
1694 nr_pages);
1687 syncpt_buf->gpu_va = nvgpu_gmmu_map(c->vm, syncpt_buf, 1695 syncpt_buf->gpu_va = nvgpu_gmmu_map(c->vm, syncpt_buf,
1688 g->syncpt_unit_size, 0, gk20a_mem_flag_none, 1696 g->syncpt_size, 0, gk20a_mem_flag_none,
1689 false, APERTURE_SYSMEM); 1697 false, APERTURE_SYSMEM);
1690 1698
1691 if (!syncpt_buf->gpu_va) { 1699 if (!syncpt_buf->gpu_va) {
1692 nvgpu_err(c->g, "failed to map syncpt buffer"); 1700 nvgpu_err(g, "failed to map syncpt buffer");
1693 nvgpu_dma_free(c->g, syncpt_buf); 1701 nvgpu_dma_free(g, syncpt_buf);
1694 err = -ENOMEM; 1702 err = -ENOMEM;
1695 } 1703 }
1696 return err; 1704 return err;
@@ -1740,11 +1748,9 @@ u32 gv11b_fifo_get_syncpt_wait_cmd_size(void)
1740 1748
1741void gv11b_fifo_add_syncpt_incr_cmd(struct gk20a *g, 1749void gv11b_fifo_add_syncpt_incr_cmd(struct gk20a *g,
1742 bool wfi_cmd, struct priv_cmd_entry *cmd, 1750 bool wfi_cmd, struct priv_cmd_entry *cmd,
1743 u32 id, u64 gpu_va_base) 1751 u32 id, u64 gpu_va)
1744{ 1752{
1745 u32 off = cmd->off; 1753 u32 off = cmd->off;
1746 u64 gpu_va = gpu_va_base +
1747 nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(id);
1748 1754
1749 gk20a_dbg_fn(""); 1755 gk20a_dbg_fn("");
1750 1756