summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.c
diff options
context:
space:
mode:
authorAparna Das <aparnad@nvidia.com>2017-08-04 20:32:02 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-10-24 04:26:17 -0400
commitdf4e88a21d51d5e098b66c3094fa91ae633777e5 (patch)
treeccab3efbc341bda1ebe175a58d9539d587ad9fd7 /drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.c
parent86e1c3278fab9c7b335962549ba8f0860ef9f119 (diff)
gpu: nvgpu: vgpu: add support for gv11b syncpoints
In t19x, gv11b semaphore read and write operations are translated to host1x syncpoint read and write operations using semaphore syncpoint shim aperture. Implement relevant vgpu hal functions for this in fifo hal. Jira EVLR-1571 Change-Id: I6296cc6e592ea991e1c01bc9662d02fb063ff3c7 Signed-off-by: Aparna Das <aparnad@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1516367 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.c')
-rw-r--r--drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.c b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.c
index 048a4c64..ae9d52a7 100644
--- a/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.c
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.c
@@ -23,6 +23,82 @@
23#include <gk20a/gk20a.h> 23#include <gk20a/gk20a.h>
24 24
25#include "vgpu/vgpu.h" 25#include "vgpu/vgpu.h"
26#include "gv11b/fifo_gv11b.h"
27#include <nvgpu/nvhost_t19x.h>
28
29#include <linux/tegra_vgpu.h>
30
31#ifdef CONFIG_TEGRA_GK20A_NVHOST
32int vgpu_gv11b_fifo_alloc_syncpt_buf(struct channel_gk20a *c,
33 u32 syncpt_id, struct nvgpu_mem *syncpt_buf)
34{
35 int err;
36 struct gk20a *g = c->g;
37 struct vm_gk20a *vm = c->vm;
38 struct tegra_vgpu_cmd_msg msg = {};
39 struct tegra_vgpu_map_syncpt_params *p = &msg.params.t19x.map_syncpt;
40
41 /*
42 * Add ro map for complete sync point shim range in vm.
43 * All channels sharing same vm will share same ro mapping.
44 * Create rw map for current channel sync point.
45 */
46 if (!vm->syncpt_ro_map_gpu_va) {
47 vm->syncpt_ro_map_gpu_va = __nvgpu_vm_alloc_va(vm,
48 g->syncpt_unit_size,
49 gmmu_page_size_kernel);
50 if (!vm->syncpt_ro_map_gpu_va) {
51 nvgpu_err(g, "allocating read-only va space failed");
52 return -ENOMEM;
53 }
54
55 msg.cmd = TEGRA_VGPU_CMD_MAP_SYNCPT;
56 msg.handle = vgpu_get_handle(g);
57 p->as_handle = c->vm->handle;
58 p->gpu_va = vm->syncpt_ro_map_gpu_va;
59 p->len = g->syncpt_unit_size;
60 p->offset = 0;
61 p->prot = TEGRA_VGPU_MAP_PROT_READ_ONLY;
62 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg));
63 err = err ? err : msg.ret;
64 if (err) {
65 nvgpu_err(g,
66 "mapping read-only va space failed err %d",
67 err);
68 __nvgpu_vm_free_va(c->vm, vm->syncpt_ro_map_gpu_va,
69 gmmu_page_size_kernel);
70 vm->syncpt_ro_map_gpu_va = 0;
71 return err;
72 }
73 }
74
75 syncpt_buf->gpu_va = __nvgpu_vm_alloc_va(c->vm, g->syncpt_size,
76 gmmu_page_size_kernel);
77 if (!syncpt_buf->gpu_va) {
78 nvgpu_err(g, "allocating syncpt va space failed");
79 return -ENOMEM;
80 }
81
82 msg.cmd = TEGRA_VGPU_CMD_MAP_SYNCPT;
83 msg.handle = vgpu_get_handle(g);
84 p->as_handle = c->vm->handle;
85 p->gpu_va = syncpt_buf->gpu_va;
86 p->len = g->syncpt_size;
87 p->offset =
88 nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(syncpt_id);
89 p->prot = TEGRA_VGPU_MAP_PROT_NONE;
90 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg));
91 err = err ? err : msg.ret;
92 if (err) {
93 nvgpu_err(g, "mapping syncpt va space failed err %d", err);
94 __nvgpu_vm_free_va(c->vm, syncpt_buf->gpu_va,
95 gmmu_page_size_kernel);
96 return err;
97 }
98
99 return 0;
100}
101#endif /* CONFIG_TEGRA_GK20A_NVHOST */
26 102
27int vgpu_gv11b_init_fifo_setup_hw(struct gk20a *g) 103int vgpu_gv11b_init_fifo_setup_hw(struct gk20a *g)
28{ 104{