summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/nvgpu_common.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2016-09-20 11:48:16 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2016-10-09 16:03:35 -0400
commit697fe17dd612769633f8c93e37b65cc51966d7e7 (patch)
treecbf09661d91c10ca9149f40661aab119a7850302 /drivers/gpu/nvgpu/nvgpu_common.c
parent4cff26cd5b0096eeb26114cf36df8e2cb91821a8 (diff)
gpu: nvgpu: Suppress error msg from VBIOS overlay
Suppress error message when nvgpu tries to load VBIOS overlay, but one is not found. This situation is normal. This is done by moving gk20a_request_firmware() to be nvgpu generic function nvgpu_request_firmware(), and adding a NO_WARN flag to it. Introduce also a NO_SOC flag to suppress attempt to load firmware from SoC specific directory in addition to the chip specific directory. Use it for dGPU firmware files. Bug 200236777 Change-Id: I0294d3308f029a6a6d3c2effa579d5f69a91e418 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1223840 (cherry picked from commit cca44c3f010f15918cdd2259c15170ba1917828a) Reviewed-on: http://git-master/r/1233353 GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/gpu/nvgpu/nvgpu_common.c')
-rw-r--r--drivers/gpu/nvgpu/nvgpu_common.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/nvgpu_common.c b/drivers/gpu/nvgpu/nvgpu_common.c
index bdc07e50..fac818a2 100644
--- a/drivers/gpu/nvgpu/nvgpu_common.c
+++ b/drivers/gpu/nvgpu/nvgpu_common.c
@@ -15,9 +15,11 @@
15 */ 15 */
16 16
17#include <linux/dma-mapping.h> 17#include <linux/dma-mapping.h>
18#include <linux/firmware.h>
18 19
19#include "gk20a/gk20a_scale.h" 20#include "gk20a/gk20a_scale.h"
20#include "gk20a/gk20a.h" 21#include "gk20a/gk20a.h"
22#include "nvgpu_common.h"
21 23
22#define EMC3D_DEFAULT_RATIO 750 24#define EMC3D_DEFAULT_RATIO 750
23 25
@@ -152,3 +154,68 @@ int nvgpu_probe(struct gk20a *g,
152 154
153 return 0; 155 return 0;
154} 156}
157
158static const struct firmware *do_request_firmware(struct device *dev,
159 const char *prefix, const char *fw_name, int flags)
160{
161 const struct firmware *fw;
162 char *fw_path = NULL;
163 int path_len, err;
164
165 if (prefix) {
166 path_len = strlen(prefix) + strlen(fw_name);
167 path_len += 2; /* for the path separator and zero terminator*/
168
169 fw_path = kzalloc(sizeof(*fw_path) * path_len, GFP_KERNEL);
170 if (!fw_path)
171 return NULL;
172
173 sprintf(fw_path, "%s/%s", prefix, fw_name);
174 fw_name = fw_path;
175 }
176
177#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
178 err = request_firmware(&fw, fw_name, dev);
179#else
180 if (flags & NVGPU_REQUEST_FIRMWARE_NO_WARN)
181 err = request_firmware_direct(&fw, fw_name, dev);
182 else
183 err = request_firmware(&fw, fw_name, dev);
184#endif
185
186 kfree(fw_path);
187 if (err)
188 return NULL;
189 return fw;
190}
191
192/* This is a simple wrapper around request_firmware that takes 'fw_name' and
193 * applies an IP specific relative path prefix to it. The caller is
194 * responsible for calling release_firmware later. */
195const struct firmware *nvgpu_request_firmware(struct gk20a *g,
196 const char *fw_name,
197 int flags)
198{
199 struct device *dev = g->dev;
200 const struct firmware *fw;
201
202 /* current->fs is NULL when calling from SYS_EXIT.
203 Add a check here to prevent crash in request_firmware */
204 if (!current->fs || !fw_name)
205 return NULL;
206
207 BUG_ON(!g->ops.name);
208 fw = do_request_firmware(dev, g->ops.name, fw_name, flags);
209
210#ifdef CONFIG_TEGRA_GK20A
211 /* TO BE REMOVED - Support loading from legacy SOC specific path. */
212 if (!fw && !(flags & NVGPU_REQUEST_FIRMWARE_NO_SOC)) {
213 struct gk20a_platform *platform = gk20a_get_platform(dev);
214 fw = do_request_firmware(dev,
215 platform->soc_name, fw_name, flags);
216 }
217#endif
218
219 return fw;
220}
221