summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gm20b/acr_gm20b.h
diff options
context:
space:
mode:
authorMahantesh Kumbar <mkumbar@nvidia.com>2017-02-14 12:17:29 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-02-23 04:04:48 -0500
commit9c68af58a9d2542e33ced54bdabc35b18f589475 (patch)
tree321bb98244543612f88314d83ec60570f176a008 /drivers/gpu/nvgpu/gm20b/acr_gm20b.h
parent8cdb91c527ce19ce67ddc0e231e8c93a552a93a4 (diff)
gpu: nvgpu: ACR interface headers reorganization
-Moved ACR interface headers from acr_gm20b.h/acr_gp106.h to Its specific header files under “drivers/gpu/nvgpu/include/nvgpu/acr/” Folder. - nvgpu_acr.h - Top-level header-file which include ACR interfaces headers & defines required to communicate with ACR, including this header file is good to get access into ACR interface & made changes accordingly, -Deleted acr.h & acr_t18x.h as not required anymore & removed its include from dependent files. Jira NVGPU-19 Change-Id: Ie404043cfe1ab32404eb63a43831f470d8436324 Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com> Reviewed-on: http://git-master/r/1304748 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gm20b/acr_gm20b.h')
-rw-r--r--drivers/gpu/nvgpu/gm20b/acr_gm20b.h370
1 files changed, 1 insertions, 369 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/acr_gm20b.h b/drivers/gpu/nvgpu/gm20b/acr_gm20b.h
index fb61e366..84478611 100644
--- a/drivers/gpu/nvgpu/gm20b/acr_gm20b.h
+++ b/drivers/gpu/nvgpu/gm20b/acr_gm20b.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * GM20B ACR 2 * GM20B ACR
3 * 3 *
4 * Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -15,15 +15,6 @@
15 15
16#ifndef __ACR_GM20B_H_ 16#ifndef __ACR_GM20B_H_
17#define __ACR_GM20B_H_ 17#define __ACR_GM20B_H_
18#include "gk20a/gk20a.h"
19#include "mm_gm20b.h"
20
21/*Defines*/
22#define ACR_COMPLETION_TIMEOUT_MS 10000 /*in msec */
23
24/*chip specific defines*/
25#define MAX_SUPPORTED_LSFM 3 /*PMU, FECS, GPCCS*/
26#define LSF_UCODE_DATA_ALIGNMENT 4096
27 18
28#define GM20B_PMU_UCODE_IMAGE "gpmu_ucode_image.bin" 19#define GM20B_PMU_UCODE_IMAGE "gpmu_ucode_image.bin"
29#define GM20B_PMU_UCODE_DESC "gpmu_ucode_desc.bin" 20#define GM20B_PMU_UCODE_DESC "gpmu_ucode_desc.bin"
@@ -33,365 +24,6 @@
33#define GM20B_FECS_UCODE_SIG "fecs_sig.bin" 24#define GM20B_FECS_UCODE_SIG "fecs_sig.bin"
34#define T18x_GPCCS_UCODE_SIG "gpccs_sig.bin" 25#define T18x_GPCCS_UCODE_SIG "gpccs_sig.bin"
35 26
36#define LSFM_DISABLE_MASK_NONE (0x00000000) /*Disable all LS falcons*/
37#define LSFM_DISABLE_MASK_ALL (0xFFFFFFFF) /*Enable all LS falcons*/
38
39#define PMU_SECURE_MODE (0x1)
40#define PMU_LSFM_MANAGED (0x2)
41
42/*ACR load related*/
43/*!
44 * Supporting maximum of 2 regions.
45 * This is needed to pre-allocate space in DMEM
46 */
47#define T210_FLCN_ACR_MAX_REGIONS (2)
48#define LSF_BOOTSTRAP_OWNER_RESERVED_DMEM_SIZE (0x200)
49
50/*!
51 * Falcon Id Defines
52 * Defines a common Light Secure Falcon identifier.
53 */
54#define LSF_FALCON_ID_PMU (0)
55#define LSF_FALCON_ID_RESERVED (1)
56#define LSF_FALCON_ID_FECS (2)
57#define LSF_FALCON_ID_GPCCS (3)
58#define LSF_FALCON_ID_END (11)
59#define LSF_FALCON_ID_INVALID (0xFFFFFFFF)
60
61/*!
62 * Bootstrap Owner Defines
63 */
64#define LSF_BOOTSTRAP_OWNER_DEFAULT (LSF_FALCON_ID_PMU)
65
66/*!
67 * Image Status Defines
68 */
69#define LSF_IMAGE_STATUS_NONE (0)
70#define LSF_IMAGE_STATUS_COPY (1)
71#define LSF_IMAGE_STATUS_VALIDATION_CODE_FAILED (2)
72#define LSF_IMAGE_STATUS_VALIDATION_DATA_FAILED (3)
73#define LSF_IMAGE_STATUS_VALIDATION_DONE (4)
74#define LSF_IMAGE_STATUS_VALIDATION_SKIPPED (5)
75#define LSF_IMAGE_STATUS_BOOTSTRAP_READY (6)
76
77/*LSB header related defines*/
78#define NV_FLCN_ACR_LSF_FLAG_LOAD_CODE_AT_0_FALSE 0
79#define NV_FLCN_ACR_LSF_FLAG_LOAD_CODE_AT_0_TRUE 1
80#define NV_FLCN_ACR_LSF_FLAG_DMACTL_REQ_CTX_FALSE 0
81#define NV_FLCN_ACR_LSF_FLAG_DMACTL_REQ_CTX_TRUE 4
82#define NV_FLCN_ACR_LSF_FLAG_FORCE_PRIV_LOAD_TRUE 8
83#define NV_FLCN_ACR_LSF_FLAG_FORCE_PRIV_LOAD_FALSE 0
84
85/*!
86 * Light Secure WPR Content Alignments
87 */
88#define LSF_LSB_HEADER_ALIGNMENT 256
89#define LSF_BL_DATA_ALIGNMENT 256
90#define LSF_BL_DATA_SIZE_ALIGNMENT 256
91#define LSF_BL_CODE_SIZE_ALIGNMENT 256
92
93/*!
94 * Falcon UCODE header index.
95 */
96#define FLCN_NL_UCODE_HDR_OS_CODE_OFF_IND (0)
97#define FLCN_NL_UCODE_HDR_OS_CODE_SIZE_IND (1)
98#define FLCN_NL_UCODE_HDR_OS_DATA_OFF_IND (2)
99#define FLCN_NL_UCODE_HDR_OS_DATA_SIZE_IND (3)
100#define FLCN_NL_UCODE_HDR_NUM_APPS_IND (4)
101/*!
102 * There are total N number of Apps with code and offset defined in UCODE header
103 * This macro provides the CODE and DATA offset and size of Ath application.
104 */
105#define FLCN_NL_UCODE_HDR_APP_CODE_START_IND (5)
106#define FLCN_NL_UCODE_HDR_APP_CODE_OFF_IND(N, A) \
107 (FLCN_NL_UCODE_HDR_APP_CODE_START_IND + (A*2))
108#define FLCN_NL_UCODE_HDR_APP_CODE_SIZE_IND(N, A) \
109 (FLCN_NL_UCODE_HDR_APP_CODE_START_IND + (A*2) + 1)
110#define FLCN_NL_UCODE_HDR_APP_CODE_END_IND(N) \
111 (FLCN_NL_UCODE_HDR_APP_CODE_START_IND + (N*2) - 1)
112
113#define FLCN_NL_UCODE_HDR_APP_DATA_START_IND(N) \
114 (FLCN_NL_UCODE_HDR_APP_CODE_END_IND(N) + 1)
115#define FLCN_NL_UCODE_HDR_APP_DATA_OFF_IND(N, A) \
116 (FLCN_NL_UCODE_HDR_APP_DATA_START_IND(N) + (A*2))
117#define FLCN_NL_UCODE_HDR_APP_DATA_SIZE_IND(N, A) \
118 (FLCN_NL_UCODE_HDR_APP_DATA_START_IND(N) + (A*2) + 1)
119#define FLCN_NL_UCODE_HDR_APP_DATA_END_IND(N) \
120 (FLCN_NL_UCODE_HDR_APP_DATA_START_IND(N) + (N*2) - 1)
121
122#define FLCN_NL_UCODE_HDR_OS_OVL_OFF_IND(N) \
123 (FLCN_NL_UCODE_HDR_APP_DATA_END_IND(N) + 1)
124#define FLCN_NL_UCODE_HDR_OS_OVL_SIZE_IND(N) \
125 (FLCN_NL_UCODE_HDR_APP_DATA_END_IND(N) + 2)
126
127enum acr_capabilities {
128 ACR_LRF_TEX_LTC_DRAM_PRIV_MASK_ENABLE_LS_OVERRIDE = (0x00000001),
129};
130
131/*Externs*/
132
133/*Structs*/
134
135/*!
136 * Light Secure Falcon Ucode Description Defines
137 * This stucture is prelim and may change as the ucode signing flow evolves.
138 */
139struct lsf_ucode_desc {
140 u8 prd_keys[2][16];
141 u8 dbg_keys[2][16];
142 u32 b_prd_present;
143 u32 b_dbg_present;
144 u32 falcon_id;
145};
146
147/*!
148 * Light Secure WPR Header
149 * Defines state allowing Light Secure Falcon bootstrapping.
150 *
151 * falcon_id - LS falcon ID
152 * lsb_offset - Offset into WPR region holding LSB header
153 * bootstrap_owner - Bootstrap OWNER (either PMU or SEC2)
154 * lazy_bootstrap - Skip bootstrapping by ACR
155 * status - Bootstrapping status
156 */
157struct lsf_wpr_header {
158 u32 falcon_id;
159 u32 lsb_offset;
160 u32 bootstrap_owner;
161 u32 lazy_bootstrap;
162 u32 status;
163};
164
165struct lsf_lsb_header {
166 struct lsf_ucode_desc signature;
167 u32 ucode_off;
168 u32 ucode_size;
169 u32 data_size;
170 u32 bl_code_size;
171 u32 bl_imem_off;
172 u32 bl_data_off;
173 u32 bl_data_size;
174 u32 app_code_off;
175 u32 app_code_size;
176 u32 app_data_off;
177 u32 app_data_size;
178 u32 flags;
179};
180
181/*!
182 * Structure used by the boot-loader to load the rest of the code. This has
183 * to be filled by host and copied into DMEM at offset provided in the
184 * hsflcn_bl_desc.bl_desc_dmem_load_off.
185 *
186 * signature - 16B signature for secure code. 0s if no secure code
187 * ctx_dma - CtxDma to be used by BL while loading code/data
188 * code_dma_base - 256B aligned Physical FB Address where code is located
189 * non_sec_code_off - Offset from code_dma_base where the nonSecure code is
190 * located. The offset must be multiple of 256 to help perf
191 * non_sec_code_size - The size of the nonSecure code part.
192 * sec_code_size - Offset from code_dma_base where the secure code is
193 * located. The offset must be multiple of 256 to help perf
194 * code_entry_point - Code entry point which will be invoked by BL after
195 * code is loaded.
196 * data_dma_base - 256B aligned Physical FB Address where data is located.
197 * data_size - Size of data block. Should be multiple of 256B
198 */
199struct flcn_bl_dmem_desc {
200 u32 reserved[4]; /*Should be the first element..*/
201 u32 signature[4]; /*Should be the first element..*/
202 u32 ctx_dma;
203 u32 code_dma_base;
204 u32 non_sec_code_off;
205 u32 non_sec_code_size;
206 u32 sec_code_off;
207 u32 sec_code_size;
208 u32 code_entry_point;
209 u32 data_dma_base;
210 u32 data_size;
211 u32 code_dma_base1;
212 u32 data_dma_base1;
213};
214
215/*!
216 * Legacy structure used by the current PMU/DPU bootloader.
217 */
218struct loader_config {
219 u32 dma_idx;
220 u32 code_dma_base; /*<! upper 32-bits of 40-bit dma address*/
221 u32 code_size_total;
222 u32 code_size_to_load;
223 u32 code_entry_point;
224 u32 data_dma_base; /*<! upper 32-bits of 40-bit dma address*/
225 u32 data_size; /*<! initialized data of the application */
226 u32 overlay_dma_base; /*<! upper 32-bits of the 40-bit dma address*/
227 u32 argc;
228 u32 argv;
229 u16 code_dma_base1; /*<! upper 7 bits of 47-bit dma address*/
230 u16 data_dma_base1; /*<! upper 7 bits of 47-bit dma address*/
231 u16 overlay_dma_base1; /*<! upper 7 bits of the 47-bit dma address*/
232};
233
234/*!
235 * Union of all supported structures used by bootloaders.
236 */
237union flcn_bl_generic_desc {
238 struct flcn_bl_dmem_desc bl_dmem_desc;
239 struct loader_config loader_cfg;
240};
241
242struct flcn_ucode_img {
243 u32 *header; /*only some falcons have header*/
244 u32 *data;
245 struct pmu_ucode_desc *desc; /*only some falcons have descriptor*/
246 u32 data_size;
247 void *fw_ver; /*NV2080_CTRL_GPU_GET_FIRMWARE_VERSION_PARAMS struct*/
248 u8 load_entire_os_data; /* load the whole osData section at boot time.*/
249 struct lsf_ucode_desc *lsf_desc; /* NULL if not a light secure falcon.*/
250 u8 free_res_allocs;/*True if there a resources to freed by the client.*/
251 u32 flcn_inst;
252};
253
254/*!
255 * LSFM Managed Ucode Image
256 * next : Next image the list, NULL if last.
257 * wpr_header : WPR header for this ucode image
258 * lsb_header : LSB header for this ucode image
259 * bl_gen_desc : Bootloader generic desc structure for this ucode image
260 * bl_gen_desc_size : Sizeof bootloader desc structure for this ucode image
261 * full_ucode_size : Surface size required for final ucode image
262 * ucode_img : Ucode image info
263 */
264struct lsfm_managed_ucode_img {
265 struct lsfm_managed_ucode_img *next;
266 struct lsf_wpr_header wpr_header;
267 struct lsf_lsb_header lsb_header;
268 union flcn_bl_generic_desc bl_gen_desc;
269 u32 bl_gen_desc_size;
270 u32 full_ucode_size;
271 struct flcn_ucode_img ucode_img;
272};
273
274struct ls_flcn_mgr {
275 u16 managed_flcn_cnt;
276 u32 wpr_size;
277 u32 disable_mask;
278 struct lsfm_managed_ucode_img *ucode_img_list;
279 void *wpr_client_req_state;/*PACR_CLIENT_REQUEST_STATE originally*/
280};
281
282/*ACR related structs*/
283/*!
284 * start_addr - Starting address of region
285 * end_addr - Ending address of region
286 * region_id - Region ID
287 * read_mask - Read Mask
288 * write_mask - WriteMask
289 * client_mask - Bit map of all clients currently using this region
290 */
291struct flcn_acr_region_prop {
292 u32 start_addr;
293 u32 end_addr;
294 u32 region_id;
295 u32 read_mask;
296 u32 write_mask;
297 u32 client_mask;
298};
299
300/*!
301 * no_regions - Number of regions used.
302 * region_props - Region properties
303 */
304struct flcn_acr_regions {
305 u32 no_regions;
306 struct flcn_acr_region_prop region_props[T210_FLCN_ACR_MAX_REGIONS];
307};
308
309/*!
310 * reserved_dmem-When the bootstrap owner has done bootstrapping other falcons,
311 * and need to switch into LS mode, it needs to have its own
312 * actual DMEM image copied into DMEM as part of LS setup. If
313 * ACR desc is at location 0, it will definitely get overwritten
314 * causing data corruption. Hence we are reserving 0x200 bytes
315 * to give room for any loading data. NOTE: This has to be the
316 * first member always
317 * signature - Signature of ACR ucode.
318 * wpr_region_id - Region ID holding the WPR header and its details
319 * wpr_offset - Offset from the WPR region holding the wpr header
320 * regions - Region descriptors
321 * nonwpr_ucode_blob_start -stores non-WPR start where kernel stores ucode blob
322 * nonwpr_ucode_blob_end -stores non-WPR end where kernel stores ucode blob
323 */
324struct flcn_acr_desc {
325 union {
326 u32 reserved_dmem[(LSF_BOOTSTRAP_OWNER_RESERVED_DMEM_SIZE/4)];
327 u32 signatures[4];
328 } ucode_reserved_space;
329 /*Always 1st*/
330 u32 wpr_region_id;
331 u32 wpr_offset;
332 u32 mmu_mem_range;
333 struct flcn_acr_regions regions;
334 u32 nonwpr_ucode_blob_size;
335 u64 nonwpr_ucode_blob_start;
336};
337
338/*!
339 * The header used by RM to figure out code and data sections of bootloader.
340 *
341 * bl_code_off - Offset of code section in the image
342 * bl_code_size - Size of code section in the image
343 * bl_data_off - Offset of data section in the image
344 * bl_data_size - Size of data section in the image
345 */
346struct hsflcn_bl_img_hdr {
347 u32 bl_code_off;
348 u32 bl_code_size;
349 u32 bl_data_off;
350 u32 bl_data_size;
351};
352
353/*!
354 * The descriptor used by RM to figure out the requirements of boot loader.
355 *
356 * bl_start_tag - Starting tag of bootloader
357 * bl_desc_dmem_load_off - Dmem offset where _def_rm_flcn_bl_dmem_desc
358 to be loaded
359 * bl_img_hdr - Description of the image
360 */
361struct hsflcn_bl_desc {
362 u32 bl_start_tag;
363 u32 bl_desc_dmem_load_off;
364 struct hsflcn_bl_img_hdr bl_img_hdr;
365};
366
367struct bin_hdr {
368 u32 bin_magic; /* 0x10de */
369 u32 bin_ver; /* versioning of bin format */
370 u32 bin_size; /* entire image size including this header */
371 u32 header_offset; /* Header offset of executable binary metadata,
372 start @ offset- 0x100 */
373 u32 data_offset; /* Start of executable binary data, start @
374 offset- 0x200 */
375 u32 data_size; /* Size ofexecutable binary */
376};
377
378struct acr_fw_header {
379 u32 sig_dbg_offset;
380 u32 sig_dbg_size;
381 u32 sig_prod_offset;
382 u32 sig_prod_size;
383 u32 patch_loc;
384 u32 patch_sig;
385 u32 hdr_offset; /*this header points to acr_ucode_header_t210_load*/
386 u32 hdr_size; /*size of above header*/
387};
388
389struct wpr_carveout_info {
390 u64 wpr_base;
391 u64 nonwpr_base;
392 u64 size;
393};
394
395void gm20b_init_secure_pmu(struct gpu_ops *gops); 27void gm20b_init_secure_pmu(struct gpu_ops *gops);
396int prepare_ucode_blob(struct gk20a *g); 28int prepare_ucode_blob(struct gk20a *g);
397int gm20b_pmu_setup_sw(struct gk20a *g); 29int gm20b_pmu_setup_sw(struct gk20a *g);