From a51eb9da021c2934e196c5d8be04551703e6bb5b Mon Sep 17 00:00:00 2001 From: Debarshi Dutta Date: Fri, 11 May 2018 09:18:48 +0530 Subject: [PATCH] gpu: nvgpu: move sync_gk20a under common/linux directory sync_gk20a.* files are no longer used by core code and only invoked from linux specific implementations of the OS_FENCE framework which are under the common/linux directory. Hence, sync_gk20a.* files are also moved under common/linux. JIRA NVGPU-66 Change-Id: If623524611373d2da39b63cfb3c1e40089bf8d22 Signed-off-by: Debarshi Dutta Reviewed-on: https://git-master.nvidia.com/r/1712900 Reviewed-by: Vijayakumar Subbu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/Makefile | 2 +- drivers/gpu/nvgpu/common/linux/channel.c | 2 +- .../common/linux/os_fence_android_sema.c | 3 +- .../common/linux/os_fence_android_syncpt.c | 1 - .../linux/sync_sema_android.c} | 30 ++++------ .../nvgpu/common/linux/sync_sema_android.h | 51 ++++++++++++++++ drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c | 1 - drivers/gpu/nvgpu/gk20a/fence_gk20a.c | 1 - drivers/gpu/nvgpu/gk20a/sync_gk20a.h | 59 ------------------- 9 files changed, 67 insertions(+), 83 deletions(-) rename drivers/gpu/nvgpu/{gk20a/sync_gk20a.c => common/linux/sync_sema_android.c} (89%) create mode 100644 drivers/gpu/nvgpu/common/linux/sync_sema_android.h delete mode 100644 drivers/gpu/nvgpu/gk20a/sync_gk20a.h diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile index 5af7de359..8f8f8dc86 100644 --- a/drivers/gpu/nvgpu/Makefile +++ b/drivers/gpu/nvgpu/Makefile @@ -160,7 +160,7 @@ nvgpu-$(CONFIG_TEGRA_GK20A) += \ common/linux/platform_gp10b_tegra.o \ common/linux/platform_gv11b_tegra.o -nvgpu-$(CONFIG_SYNC) += gk20a/sync_gk20a.o \ +nvgpu-$(CONFIG_SYNC) += common/linux/sync_sema_android.o \ common/linux/os_fence_android.o \ common/linux/os_fence_android_sema.o diff --git a/drivers/gpu/nvgpu/common/linux/channel.c b/drivers/gpu/nvgpu/common/linux/channel.c index d767374bf..1e170b300 100644 --- a/drivers/gpu/nvgpu/common/linux/channel.c +++ b/drivers/gpu/nvgpu/common/linux/channel.c @@ -40,7 +40,7 @@ #include #include -#include "gk20a/sync_gk20a.h" +#include "sync_sema_android.h" u32 nvgpu_submit_gpfifo_user_flags_to_common_flags(u32 user_flags) { diff --git a/drivers/gpu/nvgpu/common/linux/os_fence_android_sema.c b/drivers/gpu/nvgpu/common/linux/os_fence_android_sema.c index d4aeb6ede..2bb71c995 100644 --- a/drivers/gpu/nvgpu/common/linux/os_fence_android_sema.c +++ b/drivers/gpu/nvgpu/common/linux/os_fence_android_sema.c @@ -21,10 +21,11 @@ #include #include -#include "gk20a/sync_gk20a.h" #include "gk20a/channel_sync_gk20a.h" #include "gk20a/mm_gk20a.h" +#include "sync_sema_android.h" + #include "../drivers/staging/android/sync.h" int nvgpu_os_fence_sema_wait_gen_cmd(struct nvgpu_os_fence *s, diff --git a/drivers/gpu/nvgpu/common/linux/os_fence_android_syncpt.c b/drivers/gpu/nvgpu/common/linux/os_fence_android_syncpt.c index b3712011c..d7a72fcd1 100644 --- a/drivers/gpu/nvgpu/common/linux/os_fence_android_syncpt.c +++ b/drivers/gpu/nvgpu/common/linux/os_fence_android_syncpt.c @@ -24,7 +24,6 @@ #include "gk20a/gk20a.h" #include "gk20a/channel_gk20a.h" -#include "gk20a/sync_gk20a.h" #include "gk20a/channel_sync_gk20a.h" #include "gk20a/mm_gk20a.h" diff --git a/drivers/gpu/nvgpu/gk20a/sync_gk20a.c b/drivers/gpu/nvgpu/common/linux/sync_sema_android.c similarity index 89% rename from drivers/gpu/nvgpu/gk20a/sync_gk20a.c rename to drivers/gpu/nvgpu/common/linux/sync_sema_android.c index 56c90da7f..fad213518 100644 --- a/drivers/gpu/nvgpu/gk20a/sync_gk20a.c +++ b/drivers/gpu/nvgpu/common/linux/sync_sema_android.c @@ -1,25 +1,19 @@ /* - * GK20A Sync Framework Integration + * Semaphore Sync Framework Integration * - * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2017-2018, NVIDIA Corporation. All rights reserved. * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #include @@ -36,7 +30,7 @@ #include "../drivers/staging/android/sync.h" -#include "sync_gk20a.h" +#include "sync_sema_android.h" static const struct sync_timeline_ops gk20a_sync_timeline_ops; diff --git a/drivers/gpu/nvgpu/common/linux/sync_sema_android.h b/drivers/gpu/nvgpu/common/linux/sync_sema_android.h new file mode 100644 index 000000000..4fca7bedd --- /dev/null +++ b/drivers/gpu/nvgpu/common/linux/sync_sema_android.h @@ -0,0 +1,51 @@ +/* + * Semaphore Sync Framework Integration + * + * Copyright (c) 2017-2018, NVIDIA Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef _GK20A_SYNC_H_ +#define _GK20A_SYNC_H_ + +struct sync_timeline; +struct sync_fence; +struct sync_pt; +struct nvgpu_semaphore; +struct fence; + +#ifdef CONFIG_SYNC +struct sync_timeline *gk20a_sync_timeline_create(const char *name); +void gk20a_sync_timeline_destroy(struct sync_timeline *); +void gk20a_sync_timeline_signal(struct sync_timeline *); +struct sync_fence *gk20a_sync_fence_create( + struct channel_gk20a *c, + struct nvgpu_semaphore *, + const char *fmt, ...); +struct sync_fence *gk20a_sync_fence_fdget(int fd); +struct nvgpu_semaphore *gk20a_sync_pt_sema(struct sync_pt *spt); +#else +static inline void gk20a_sync_timeline_destroy(struct sync_timeline *obj) {} +static inline void gk20a_sync_timeline_signal(struct sync_timeline *obj) {} +static inline struct sync_fence *gk20a_sync_fence_fdget(int fd) +{ + return NULL; +} +static inline struct sync_timeline *gk20a_sync_timeline_create( + const char *name) { + return NULL; +} +#endif + +#endif diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c index a20474442..68fbb738b 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c @@ -34,7 +34,6 @@ #include "channel_sync_gk20a.h" #include "gk20a.h" #include "fence_gk20a.h" -#include "sync_gk20a.h" #include "mm_gk20a.h" #ifdef CONFIG_TEGRA_GK20A_NVHOST diff --git a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c index 0f7f3ea17..142663dd1 100644 --- a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c @@ -31,7 +31,6 @@ #include "gk20a.h" #include "channel_gk20a.h" -#include "sync_gk20a.h" struct gk20a_fence_ops { int (*wait)(struct gk20a_fence *, long timeout); diff --git a/drivers/gpu/nvgpu/gk20a/sync_gk20a.h b/drivers/gpu/nvgpu/gk20a/sync_gk20a.h deleted file mode 100644 index ffdfaec38..000000000 --- a/drivers/gpu/nvgpu/gk20a/sync_gk20a.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * drivers/video/tegra/host/gk20a/sync_gk20a.h - * - * GK20A Sync Framework Integration - * - * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifndef _GK20A_SYNC_H_ -#define _GK20A_SYNC_H_ - -struct sync_timeline; -struct sync_fence; -struct sync_pt; -struct nvgpu_semaphore; -struct fence; - -#ifdef CONFIG_SYNC -struct sync_timeline *gk20a_sync_timeline_create(const char *name); -void gk20a_sync_timeline_destroy(struct sync_timeline *); -void gk20a_sync_timeline_signal(struct sync_timeline *); -struct sync_fence *gk20a_sync_fence_create( - struct channel_gk20a *c, - struct nvgpu_semaphore *, - const char *fmt, ...); -struct sync_fence *gk20a_sync_fence_fdget(int fd); -struct nvgpu_semaphore *gk20a_sync_pt_sema(struct sync_pt *spt); -#else -static inline void gk20a_sync_timeline_destroy(struct sync_timeline *obj) {} -static inline void gk20a_sync_timeline_signal(struct sync_timeline *obj) {} -static inline struct sync_fence *gk20a_sync_fence_fdget(int fd) -{ - return NULL; -} -static inline struct sync_timeline *gk20a_sync_timeline_create( - const char *name) { - return NULL; -} -#endif - -#endif