summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c
diff options
context:
space:
mode:
authorRichard Zhao <rizhao@nvidia.com>2018-01-25 19:51:54 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2018-01-31 05:40:52 -0500
commit5326dfe3fa59e7d465ffc2f0d7f81aaf9de48278 (patch)
tree94ec53a97a665fbcbf8004614c65b5090fb89b70 /drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c
parentb386768d323c95f530dd28b695927426e52fe0dc (diff)
gpu: nvgpu: vgpu: add vgpu_ivc_* wrappers
tegra_gr_comm_* are wrapped as vgpu_ivc_*, which helps make vgpu code more common. Jira EVLR-2364 Change-Id: Id49462ed6c176c73ceee8c6bc41104447748e187 Signed-off-by: Richard Zhao <rizhao@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1645656 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Aingara Paramakuru <aparamakuru@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c
index 3d5afcf9..6bd34a57 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c
@@ -21,6 +21,7 @@
21#include <linux/dma-mapping.h> 21#include <linux/dma-mapping.h>
22#include <linux/pm_runtime.h> 22#include <linux/pm_runtime.h>
23#include <linux/pm_qos.h> 23#include <linux/pm_qos.h>
24#include <linux/platform_device.h>
24#include <soc/tegra/chip-id.h> 25#include <soc/tegra/chip-id.h>
25#include <uapi/linux/nvgpu.h> 26#include <uapi/linux/nvgpu.h>
26 27
@@ -49,11 +50,11 @@
49 50
50#include <nvgpu/hw/gk20a/hw_mc_gk20a.h> 51#include <nvgpu/hw/gk20a/hw_mc_gk20a.h>
51 52
52static inline int vgpu_comm_init(struct platform_device *pdev) 53static inline int vgpu_comm_init(struct gk20a *g)
53{ 54{
54 size_t queue_sizes[] = { TEGRA_VGPU_QUEUE_SIZES }; 55 size_t queue_sizes[] = { TEGRA_VGPU_QUEUE_SIZES };
55 56
56 return tegra_gr_comm_init(pdev, 3, queue_sizes, TEGRA_VGPU_QUEUE_CMD, 57 return vgpu_ivc_init(g, 3, queue_sizes, TEGRA_VGPU_QUEUE_CMD,
57 ARRAY_SIZE(queue_sizes)); 58 ARRAY_SIZE(queue_sizes));
58} 59}
59 60
@@ -61,7 +62,7 @@ static inline void vgpu_comm_deinit(void)
61{ 62{
62 size_t queue_sizes[] = { TEGRA_VGPU_QUEUE_SIZES }; 63 size_t queue_sizes[] = { TEGRA_VGPU_QUEUE_SIZES };
63 64
64 tegra_gr_comm_deinit(TEGRA_VGPU_QUEUE_CMD, ARRAY_SIZE(queue_sizes)); 65 vgpu_ivc_deinit(TEGRA_VGPU_QUEUE_CMD, ARRAY_SIZE(queue_sizes));
65} 66}
66 67
67int vgpu_comm_sendrecv(struct tegra_vgpu_cmd_msg *msg, size_t size_in, 68int vgpu_comm_sendrecv(struct tegra_vgpu_cmd_msg *msg, size_t size_in,
@@ -72,12 +73,12 @@ int vgpu_comm_sendrecv(struct tegra_vgpu_cmd_msg *msg, size_t size_in,
72 void *data = msg; 73 void *data = msg;
73 int err; 74 int err;
74 75
75 err = tegra_gr_comm_sendrecv(tegra_gr_comm_get_server_vmid(), 76 err = vgpu_ivc_sendrecv(vgpu_ivc_get_server_vmid(),
76 TEGRA_VGPU_QUEUE_CMD, &handle, &data, &size); 77 TEGRA_VGPU_QUEUE_CMD, &handle, &data, &size);
77 if (!err) { 78 if (!err) {
78 WARN_ON(size < size_out); 79 WARN_ON(size < size_out);
79 memcpy(msg, data, size_out); 80 memcpy(msg, data, size_out);
80 tegra_gr_comm_release(handle); 81 vgpu_ivc_release(handle);
81 } 82 }
82 83
83 return err; 84 return err;
@@ -149,7 +150,7 @@ static int vgpu_intr_thread(void *dev_id)
149 size_t size; 150 size_t size;
150 int err; 151 int err;
151 152
152 err = tegra_gr_comm_recv(TEGRA_VGPU_QUEUE_INTR, &handle, 153 err = vgpu_ivc_recv(TEGRA_VGPU_QUEUE_INTR, &handle,
153 (void **)&msg, &size, &sender); 154 (void **)&msg, &size, &sender);
154 if (err == -ETIME) 155 if (err == -ETIME)
155 continue; 156 continue;
@@ -157,7 +158,7 @@ static int vgpu_intr_thread(void *dev_id)
157 continue; 158 continue;
158 159
159 if (msg->event == TEGRA_VGPU_EVENT_ABORT) { 160 if (msg->event == TEGRA_VGPU_EVENT_ABORT) {
160 tegra_gr_comm_release(handle); 161 vgpu_ivc_release(handle);
161 break; 162 break;
162 } 163 }
163 164
@@ -193,7 +194,7 @@ static int vgpu_intr_thread(void *dev_id)
193 break; 194 break;
194 } 195 }
195 196
196 tegra_gr_comm_release(handle); 197 vgpu_ivc_release(handle);
197 } 198 }
198 199
199 while (!nvgpu_thread_should_stop(&priv->intr_handler)) 200 while (!nvgpu_thread_should_stop(&priv->intr_handler))
@@ -225,7 +226,7 @@ static void vgpu_remove_support(struct gk20a *g)
225 g->mm.remove_support(&g->mm); 226 g->mm.remove_support(&g->mm);
226 227
227 msg.event = TEGRA_VGPU_EVENT_ABORT; 228 msg.event = TEGRA_VGPU_EVENT_ABORT;
228 err = tegra_gr_comm_send(TEGRA_GR_COMM_ID_SELF, TEGRA_VGPU_QUEUE_INTR, 229 err = vgpu_ivc_send(vgpu_ivc_get_peer_self(), TEGRA_VGPU_QUEUE_INTR,
229 &msg, sizeof(msg)); 230 &msg, sizeof(msg));
230 WARN_ON(err); 231 WARN_ON(err);
231 nvgpu_thread_stop(&priv->intr_handler); 232 nvgpu_thread_stop(&priv->intr_handler);
@@ -699,7 +700,7 @@ int vgpu_probe(struct platform_device *pdev)
699 } 700 }
700 } 701 }
701 702
702 err = vgpu_comm_init(pdev); 703 err = vgpu_comm_init(gk20a);
703 if (err) { 704 if (err) {
704 dev_err(dev, "failed to init comm interface\n"); 705 dev_err(dev, "failed to init comm interface\n");
705 return -ENOSYS; 706 return -ENOSYS;