summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/fence_gk20a.c
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-05-25 08:11:38 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-06-08 09:37:15 -0400
commit0ad7f1d9aa18d959abf3cba6ca4e532fc9246a31 (patch)
tree781bd0ef8ffa6d11d45b9f595bfcbc966e5733e7 /drivers/gpu/nvgpu/gk20a/fence_gk20a.c
parent2c9713e21c9ab93e7af45a4b9e76c1f378aab024 (diff)
gpu: nvgpu: use nvgpu specific nvhost APIs
Remove use of linux specifix header files <linux/nvhost.h> and <linux/nvhost_ioctl.h> and use nvgpu specific header file <nvgpu/nvhost.h> instead This is needed to remove all Linux dependencies from nvgpu driver Replace all nvhost_*() calls by nvgpu_nvhost_*() calls from new nvgpu library Remove platform device pointer host1x_dev from struct gk20a and add struct nvgpu_nvhost_dev instead Jira NVGPU-29 Change-Id: Ia7af70602cfc16f9ccc380752538c05a9cbb8a67 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1489726 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/fence_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/fence_gk20a.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c
index 7c5d33c7..5392e77c 100644
--- a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c
@@ -21,6 +21,7 @@
21#include <nvgpu/semaphore.h> 21#include <nvgpu/semaphore.h>
22#include <nvgpu/kmem.h> 22#include <nvgpu/kmem.h>
23#include <nvgpu/soc.h> 23#include <nvgpu/soc.h>
24#include <nvgpu/nvhost.h>
24 25
25#include "gk20a.h" 26#include "gk20a.h"
26#include "channel_gk20a.h" 27#include "channel_gk20a.h"
@@ -30,11 +31,6 @@
30#include "../drivers/staging/android/sync.h" 31#include "../drivers/staging/android/sync.h"
31#endif 32#endif
32 33
33#ifdef CONFIG_TEGRA_GK20A_NVHOST
34#include <linux/nvhost.h>
35#include <linux/nvhost_ioctl.h>
36#endif
37
38struct gk20a_fence_ops { 34struct gk20a_fence_ops {
39 int (*wait)(struct gk20a_fence *, long timeout); 35 int (*wait)(struct gk20a_fence *, long timeout);
40 bool (*is_expired)(struct gk20a_fence *); 36 bool (*is_expired)(struct gk20a_fence *);
@@ -268,8 +264,8 @@ int gk20a_fence_from_semaphore(
268 264
269static int gk20a_syncpt_fence_wait(struct gk20a_fence *f, long timeout) 265static int gk20a_syncpt_fence_wait(struct gk20a_fence *f, long timeout)
270{ 266{
271 return nvhost_syncpt_wait_timeout_ext( 267 return nvgpu_nvhost_syncpt_wait_timeout_ext(
272 f->host1x_pdev, f->syncpt_id, f->syncpt_value, 268 f->nvhost_dev, f->syncpt_id, f->syncpt_value,
273 (u32)timeout, NULL, NULL); 269 (u32)timeout, NULL, NULL);
274} 270}
275 271
@@ -281,13 +277,14 @@ static bool gk20a_syncpt_fence_is_expired(struct gk20a_fence *f)
281 * syncpt value to be updated. For this case, we force a read 277 * syncpt value to be updated. For this case, we force a read
282 * of the value from HW, and then check for expiration. 278 * of the value from HW, and then check for expiration.
283 */ 279 */
284 if (!nvhost_syncpt_is_expired_ext(f->host1x_pdev, f->syncpt_id, 280 if (!nvgpu_nvhost_syncpt_is_expired_ext(f->nvhost_dev, f->syncpt_id,
285 f->syncpt_value)) { 281 f->syncpt_value)) {
286 u32 val; 282 u32 val;
287 283
288 if (!nvhost_syncpt_read_ext_check(f->host1x_pdev, 284 if (!nvgpu_nvhost_syncpt_read_ext_check(f->nvhost_dev,
289 f->syncpt_id, &val)) { 285 f->syncpt_id, &val)) {
290 return nvhost_syncpt_is_expired_ext(f->host1x_pdev, 286 return nvgpu_nvhost_syncpt_is_expired_ext(
287 f->nvhost_dev,
291 f->syncpt_id, f->syncpt_value); 288 f->syncpt_id, f->syncpt_value);
292 } 289 }
293 } 290 }
@@ -302,7 +299,7 @@ static const struct gk20a_fence_ops gk20a_syncpt_fence_ops = {
302 299
303int gk20a_fence_from_syncpt( 300int gk20a_fence_from_syncpt(
304 struct gk20a_fence *fence_out, 301 struct gk20a_fence *fence_out,
305 struct platform_device *host1x_pdev, 302 struct nvgpu_nvhost_dev *nvhost_dev,
306 u32 id, u32 value, bool wfi, 303 u32 id, u32 value, bool wfi,
307 bool need_sync_fence) 304 bool need_sync_fence)
308{ 305{
@@ -310,14 +307,9 @@ int gk20a_fence_from_syncpt(
310 struct sync_fence *sync_fence = NULL; 307 struct sync_fence *sync_fence = NULL;
311 308
312#ifdef CONFIG_SYNC 309#ifdef CONFIG_SYNC
313 struct nvhost_ctrl_sync_fence_info pt = {
314 .id = id,
315 .thresh = value
316 };
317
318 if (need_sync_fence) { 310 if (need_sync_fence) {
319 sync_fence = nvhost_sync_create_fence(host1x_pdev, &pt, 1, 311 sync_fence = nvgpu_nvhost_sync_create_fence(nvhost_dev,
320 "fence"); 312 id, value, 1, "fence");
321 if (IS_ERR(sync_fence)) 313 if (IS_ERR(sync_fence))
322 return -1; 314 return -1;
323 } 315 }
@@ -331,7 +323,7 @@ int gk20a_fence_from_syncpt(
331#endif 323#endif
332 return -EINVAL; 324 return -EINVAL;
333 } 325 }
334 f->host1x_pdev = host1x_pdev; 326 f->nvhost_dev = nvhost_dev;
335 f->syncpt_id = id; 327 f->syncpt_id = id;
336 f->syncpt_value = value; 328 f->syncpt_value = value;
337 329
@@ -344,7 +336,7 @@ int gk20a_fence_from_syncpt(
344#else 336#else
345int gk20a_fence_from_syncpt( 337int gk20a_fence_from_syncpt(
346 struct gk20a_fence *fence_out, 338 struct gk20a_fence *fence_out,
347 struct platform_device *host1x_pdev, 339 struct nvgpu_nvhost_dev *nvhost_dev,
348 u32 id, u32 value, bool wfi, 340 u32 id, u32 value, bool wfi,
349 bool need_sync_fence) 341 bool need_sync_fence)
350{ 342{