From e49c5a5cce0cd85d8526a201d4a8bbbb29d5a8d6 Mon Sep 17 00:00:00 2001 From: ajesh Date: Mon, 14 Dec 2020 09:03:57 +0300 Subject: [PATCH] gpu: nvgpu: move macros under NON_FUSA flag Move macros in posix unit that are not used by safety code under NON_FUSA flag. Jira NVGPU-6253 Change-Id: If4227b4a5d8c35652e324e0cf5276293e29fa3f2 Signed-off-by: ajesh Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2459298 (cherry picked from commit 86c1b4ca98f9ff7104a1c2e6ce5512a44aafa832) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2461111 GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions Reviewed-by: Rajesh Devaraj Reviewed-by: Vaibhav Kachore Reviewed-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/posix/bug.h | 2 ++ drivers/gpu/nvgpu/include/nvgpu/posix/thread.h | 2 ++ drivers/gpu/nvgpu/include/nvgpu/posix/utils.h | 3 +++ 3 files changed, 7 insertions(+) diff --git a/drivers/gpu/nvgpu/include/nvgpu/posix/bug.h b/drivers/gpu/nvgpu/include/nvgpu/posix/bug.h index 00c46168e..06d166576 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/posix/bug.h +++ b/drivers/gpu/nvgpu/include/nvgpu/posix/bug.h @@ -50,6 +50,7 @@ #define WARN_ON(cond) \ ((void) nvgpu_posix_warn(cond, "")) +#ifdef CONFIG_NVGPU_NON_FUSA /** Define for issuing warning once on condition with message. */ #define WARN_ONCE(cond, msg, arg...) \ ({static bool warn_once_warned = false; \ @@ -59,6 +60,7 @@ } \ cond; }) +#endif /** * @brief Dumps the stack. diff --git a/drivers/gpu/nvgpu/include/nvgpu/posix/thread.h b/drivers/gpu/nvgpu/include/nvgpu/posix/thread.h index 535e034db..e8ff6e0a5 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/posix/thread.h +++ b/drivers/gpu/nvgpu/include/nvgpu/posix/thread.h @@ -60,6 +60,7 @@ #define nvgpu_thread_cleanup_pop_do_not_invoke() \ pthread_cleanup_pop((bool)0) +#ifdef CONFIG_NVGPU_NON_FUSA /** * Returns the PID of the calling process. */ @@ -69,6 +70,7 @@ * Returns the Id of the calling thread. */ #define nvgpu_gettid pthread_self +#endif /** * Handles passing an nvgpu thread function into a posix thread. diff --git a/drivers/gpu/nvgpu/include/nvgpu/posix/utils.h b/drivers/gpu/nvgpu/include/nvgpu/posix/utils.h index ec89f1630..91029fa1b 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/posix/utils.h +++ b/drivers/gpu/nvgpu/include/nvgpu/posix/utils.h @@ -136,6 +136,7 @@ /** Round up division for unsigned long long. */ #define DIV_ROUND_UP_ULL DIV_ROUND_UP +#ifdef CONFIG_NVGPU_NON_FUSA /** * Divide positive or negative dividend by positive or negative divisor * and round to closest integer. @@ -151,6 +152,8 @@ (((val) - ((div) / 2)) / (div)); \ } \ ) +#endif + /* * Joys of userspace: usually division just works since the compiler can link * against external division functions implicitly.