summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTuomas Tynkkynen <ttynkkynen@nvidia.com>2014-07-30 13:06:57 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:10:41 -0400
commite51f76f1c0f8fa4affb5fac538df12a83095721d (patch)
tree77e373bc612f23320bf997d603161caf57e31cd0
parentb3e023a8055d4346b30924a03a99286926e76a15 (diff)
gpu: nvgpu: Use noinline_for_stack to avoid GCOV build break
If code coverage is enabled on GCC 4.7, the kernel build fails in gk20a_init_kind_attr() since GCC decides to inline almost everything in this file into it, leading to a massive stack frame with over kilobyte's worth of temporary variables generated by gcov, leading to this error: kind_gk20a.c: In function 'gk20a_init_kind_attr': kind_gk20a.c:424:1: error: the frame size of 1232 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] (Just removing the inline keyword doesn't work, as GCC still decides to inline it, so noinline_for_stack is actually required.) Change-Id: I819fd2a5b20581f0ac60e1ee490899c977379151 Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com> Reviewed-on: http://git-master/r/448914 Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com> Tested-by: Juha Tukkinen <jtukkinen@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/gk20a/kind_gk20a.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/kind_gk20a.c b/drivers/gpu/nvgpu/gk20a/kind_gk20a.c
index b0a74056..b76fdfcf 100644
--- a/drivers/gpu/nvgpu/gk20a/kind_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/kind_gk20a.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * GK20A memory kind management 4 * GK20A memory kind management
5 * 5 *
6 * Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved. 6 * Copyright (c) 2011-2014, NVIDIA CORPORATION. All rights reserved.
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License, 9 * under the terms and conditions of the GNU General Public License,
@@ -19,6 +19,7 @@
19 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 19 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
20 */ 20 */
21#include <linux/bitops.h> 21#include <linux/bitops.h>
22#include <linux/compiler.h>
22 23
23#include "hw_gmmu_gk20a.h" 24#include "hw_gmmu_gk20a.h"
24#include "kind_gk20a.h" 25#include "kind_gk20a.h"
@@ -41,8 +42,14 @@ static inline bool gk20a_kind_work_creation(u8 k)
41 gk20a_kind_work_creation_host(k); 42 gk20a_kind_work_creation_host(k);
42} 43}
43 44
45/*
46 * Use noinline_for_stack for these huge functions, otherwise GCC 4.7 will
47 * blow up when building a coverage-enabled kernel. (error: the frame size of
48 * 1232 bytes is larger than 1024 bytes [-Werror=frame-larger-than=])
49 */
50
44/* note: taken from the !2cs_compression case */ 51/* note: taken from the !2cs_compression case */
45static inline bool gk20a_kind_supported(u8 k) 52static noinline_for_stack bool gk20a_kind_supported(u8 k)
46{ 53{
47 return gk20a_kind_work_creation(k) || 54 return gk20a_kind_work_creation(k) ||
48 (k == gmmu_pte_kind_invalid_v()) || 55 (k == gmmu_pte_kind_invalid_v()) ||
@@ -91,7 +98,7 @@ static inline bool gk20a_kind_supported(u8 k)
91 (k == gmmu_pte_kind_pitch_no_swizzle_v()); 98 (k == gmmu_pte_kind_pitch_no_swizzle_v());
92 } 99 }
93 100
94static inline bool gk20a_kind_z(u8 k) 101static noinline_for_stack bool gk20a_kind_z(u8 k)
95{ 102{
96 return (k >= gmmu_pte_kind_z16_v() && 103 return (k >= gmmu_pte_kind_z16_v() &&
97 k <= gmmu_pte_kind_v8z24_ms8_vc24_v()) || 104 k <= gmmu_pte_kind_v8z24_ms8_vc24_v()) ||
@@ -112,7 +119,7 @@ static inline bool gk20a_kind_z(u8 k)
112 k <= gmmu_pte_kind_xf32_x24s8_ms16_2cs_v())*/; 119 k <= gmmu_pte_kind_xf32_x24s8_ms16_2cs_v())*/;
113} 120}
114 121
115static inline bool gk20a_kind_c(u8 k) 122static noinline_for_stack bool gk20a_kind_c(u8 k)
116{ 123{
117 return gk20a_kind_work_creation(k) || 124 return gk20a_kind_work_creation(k) ||
118 (k == gmmu_pte_kind_pitch_v()) || 125 (k == gmmu_pte_kind_pitch_v()) ||
@@ -127,7 +134,7 @@ static inline bool gk20a_kind_c(u8 k)
127 k <= gmmu_pte_kind_pitch_no_swizzle_v()); 134 k <= gmmu_pte_kind_pitch_no_swizzle_v());
128} 135}
129 136
130static inline bool gk20a_kind_compressible(u8 k) 137static noinline_for_stack bool gk20a_kind_compressible(u8 k)
131{ 138{
132 return (k >= gmmu_pte_kind_z16_2c_v() && 139 return (k >= gmmu_pte_kind_z16_2c_v() &&
133 k <= gmmu_pte_kind_z16_ms16_4cz_v()) || 140 k <= gmmu_pte_kind_z16_ms16_4cz_v()) ||
@@ -165,7 +172,7 @@ static inline bool gk20a_kind_compressible(u8 k)
165 k <= gmmu_pte_kind_c128_ms8_ms16_2cr_v()); 172 k <= gmmu_pte_kind_c128_ms8_ms16_2cr_v());
166} 173}
167 174
168static inline bool gk20a_kind_zbc(u8 k) 175static noinline_for_stack bool gk20a_kind_zbc(u8 k)
169{ 176{
170 return (k >= gmmu_pte_kind_z16_2c_v() && 177 return (k >= gmmu_pte_kind_z16_2c_v() &&
171 k <= gmmu_pte_kind_z16_ms16_2c_v()) || 178 k <= gmmu_pte_kind_z16_ms16_2c_v()) ||