summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include
diff options
context:
space:
mode:
authorMahantesh Kumbar <mkumbar@nvidia.com>2018-09-06 11:14:27 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-09-24 11:11:49 -0400
commit5d30a5cda37ca349b4d9cb7e1985c7a0849001b6 (patch)
tree89a37078480d7cec42d9a8c7bc869aae8bb28279 /drivers/gpu/nvgpu/include
parent7465926ccdcdad87c22c788fe04fc11961df53ba (diff)
gpu: nvgpu: ACR code refactor
-Created struct nvgpu_acr to hold acr module related member within single struct which are currently spread across multiple structs like nvgpu_pmu, pmu_ops & gk20a. -Created struct hs_flcn_bl struct to hold ACR HS bootloader specific members -Created struct hs_acr to hold ACR ucode specific members like bootloader data using struct hs_flcn_bl, acr type & falcon info on which ACR ucode need to run. -Created acr ops under struct nvgpu_acr to perform ACR specific operation, currently ACR ops were part PMU which caused to have always dependence on PMU even though ACR was not executing on PMU. -Added acr_remove_support ops which will be called as part of gk20a_remove_support() method, earlier acr cleanup was part of pmu remove_support method. -Created define for ACR types, -Ops acr_sw_init() function helps to set ACR properties statically for chip currently in execution & assign ops to point to needed functions as per chip. -Ops acr_sw_init execute at early as nvgpu_init_mm_support calls acr function to alloc blob space. -Created ops to fill bootloader descriptor & to patch WPR info to ACR uocde based on interfaces used to bootstrap ACR ucode. -Created function gm20b_bootstrap_hs_acr() function which is now common HAL for all chips to bootstrap ACR, earlier had 3 different function for gm20b/gp10b, gv11b & for all dgpu based on interface needed. -Removed duplicate code for falcon engine wherever common falcon code can be used. -Removed ACR code dependent on PMU & made changes to use from nvgpu_acr. JIRA NVGPU-1148 Change-Id: I39951d2fc9a0bb7ee6057e0fa06da78045d47590 Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1813231 GVS: Gerrit_Virtual_Submit Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com> Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/include')
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/acr/nvgpu_acr.h108
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/gk20a.h9
2 files changed, 95 insertions, 22 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/acr/nvgpu_acr.h b/drivers/gpu/nvgpu/include/nvgpu/acr/nvgpu_acr.h
index a9ed6e68..5fb26e1a 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/acr/nvgpu_acr.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/acr/nvgpu_acr.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"), 5 * copy of this software and associated documentation files (the "Software"),
@@ -23,6 +23,8 @@
23#ifndef __NVGPU_ACR_H__ 23#ifndef __NVGPU_ACR_H__
24#define __NVGPU_ACR_H__ 24#define __NVGPU_ACR_H__
25 25
26#include <nvgpu/falcon.h>
27
26#include "gk20a/mm_gk20a.h" 28#include "gk20a/mm_gk20a.h"
27 29
28#include "acr_lsfm.h" 30#include "acr_lsfm.h"
@@ -31,6 +33,13 @@
31#include "acr_objflcn.h" 33#include "acr_objflcn.h"
32 34
33struct nvgpu_firmware; 35struct nvgpu_firmware;
36struct gk20a;
37struct hs_acr_ops;
38struct hs_acr;
39struct nvgpu_acr;
40
41#define HSBIN_ACR_BL_UCODE_IMAGE "pmu_bl.bin"
42#define HSBIN_ACR_UCODE_IMAGE "acr_ucode.bin"
34 43
35#define MAX_SUPPORTED_LSFM 3 /*PMU, FECS, GPCCS*/ 44#define MAX_SUPPORTED_LSFM 3 /*PMU, FECS, GPCCS*/
36 45
@@ -77,29 +86,94 @@ struct wpr_carveout_info {
77 u64 size; 86 u64 size;
78}; 87};
79 88
80struct acr_desc { 89/* ACR interfaces */
81 struct nvgpu_mem ucode_blob; 90
82 struct nvgpu_mem wpr_dummy; 91struct hs_flcn_bl {
83 struct bin_hdr *bl_bin_hdr; 92 char *bl_fw_name;
84 struct hsflcn_bl_desc *pmu_hsbl_desc; 93 struct nvgpu_firmware *hs_bl_fw;
85 struct bin_hdr *hsbin_hdr; 94 struct hsflcn_bl_desc *hs_bl_desc;
86 struct acr_fw_header *fw_hdr; 95 struct bin_hdr *hs_bl_bin_hdr;
87 u32 pmu_args; 96 struct nvgpu_mem hs_bl_ucode;
97};
98
99struct hs_acr {
100 u32 acr_type;
101
102 /* HS bootloader to validate & load ACR ucode */
103 struct hs_flcn_bl acr_hs_bl;
104
105 /* ACR ucode */
106 char *acr_fw_name;
88 struct nvgpu_firmware *acr_fw; 107 struct nvgpu_firmware *acr_fw;
89 union{
90 struct flcn_acr_desc *acr_dmem_desc;
91 struct flcn_acr_desc_v1 *acr_dmem_desc_v1;
92 };
93 struct nvgpu_mem acr_ucode; 108 struct nvgpu_mem acr_ucode;
94 struct nvgpu_firmware *hsbl_fw; 109
95 struct nvgpu_mem hsbl_ucode;
96 union { 110 union {
97 struct flcn_bl_dmem_desc bl_dmem_desc; 111 struct flcn_bl_dmem_desc bl_dmem_desc;
98 struct flcn_bl_dmem_desc_v1 bl_dmem_desc_v1; 112 struct flcn_bl_dmem_desc_v1 bl_dmem_desc_v1;
99 }; 113 };
114
115 void *ptr_bl_dmem_desc;
116 u32 bl_dmem_desc_size;
117
118 union{
119 struct flcn_acr_desc *acr_dmem_desc;
120 struct flcn_acr_desc_v1 *acr_dmem_desc_v1;
121 };
122
123 /* Falcon used to execute ACR ucode */
124 struct nvgpu_falcon *acr_flcn;
125
126 int (*acr_flcn_setup_hw_and_bl_bootstrap)(struct gk20a *g,
127 struct hs_acr *acr_desc,
128 struct nvgpu_falcon_bl_info *bl_info);
129};
130
131#define ACR_DEFAULT 0U
132#define ACR_AHESASC 1U
133#define ACR_ASB 2U
134
135struct nvgpu_acr {
136 struct gk20a *g;
137
138 u32 bootstrap_owner;
139 u32 max_supported_lsfm;
140 u32 capabilities;
141
142 /*
143 * non-wpr space to hold LSF ucodes,
144 * ACR does copy ucode from non-wpr to wpr
145 */
146 struct nvgpu_mem ucode_blob;
147 /*
148 * Even though this mem_desc wouldn't be used,
149 * the wpr region needs to be reserved in the
150 * allocator in dGPU case.
151 */
152 struct nvgpu_mem wpr_dummy;
153
154 /* ACR member for different types of ucode */
155 /* For older dgpu/tegra ACR cuode */
156 struct hs_acr acr;
157 /* ACR load split feature support */
158 struct hs_acr acr_ahesasc;
159 struct hs_acr acr_asb;
160
161 u32 pmu_args;
100 struct nvgpu_firmware *pmu_fw; 162 struct nvgpu_firmware *pmu_fw;
101 struct nvgpu_firmware *pmu_desc; 163 struct nvgpu_firmware *pmu_desc;
102 u32 capabilities;
103};
104 164
165 int (*prepare_ucode_blob)(struct gk20a *g, struct nvgpu_acr *acr);
166 void (*get_wpr_info)(struct gk20a *g, struct wpr_carveout_info *inf);
167 int (*alloc_blob_space)(struct gk20a *g, size_t size,
168 struct nvgpu_mem *mem);
169 int (*patch_wpr_info_to_ucode)(struct gk20a *g, struct nvgpu_acr *acr,
170 struct hs_acr *acr_desc, bool is_recovery);
171 int (*acr_fill_bl_dmem_desc)(struct gk20a *g,
172 struct nvgpu_acr *acr, struct hs_acr *acr_desc,
173 u32 *acr_ucode_header);
174 int (*bootstrap_hs_acr)(struct gk20a *g, struct nvgpu_acr *acr,
175 struct hs_acr *acr_desc);
176
177 void (*remove_support)(struct nvgpu_acr *acr);
178};
105#endif /*__NVGPU_ACR_H__*/ 179#endif /*__NVGPU_ACR_H__*/
diff --git a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h
index 6f57fddc..892aa9af 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h
@@ -1054,9 +1054,6 @@ struct gpu_ops {
1054 bool (*is_engine_in_reset)(struct gk20a *g); 1054 bool (*is_engine_in_reset)(struct gk20a *g);
1055 bool (*is_lazy_bootstrap)(u32 falcon_id); 1055 bool (*is_lazy_bootstrap)(u32 falcon_id);
1056 bool (*is_priv_load)(u32 falcon_id); 1056 bool (*is_priv_load)(u32 falcon_id);
1057 void (*get_wpr)(struct gk20a *g, struct wpr_carveout_info *inf);
1058 int (*alloc_blob_space)(struct gk20a *g,
1059 size_t size, struct nvgpu_mem *mem);
1060 int (*pmu_populate_loader_cfg)(struct gk20a *g, 1057 int (*pmu_populate_loader_cfg)(struct gk20a *g,
1061 void *lsfm, u32 *p_bl_gen_desc_size); 1058 void *lsfm, u32 *p_bl_gen_desc_size);
1062 int (*flcn_populate_bl_dmem_desc)(struct gk20a *g, 1059 int (*flcn_populate_bl_dmem_desc)(struct gk20a *g,
@@ -1318,6 +1315,9 @@ struct gpu_ops {
1318 u32 (*get_nvhsclk_ctrl_swap_clk_nvl)(struct gk20a *g); 1315 u32 (*get_nvhsclk_ctrl_swap_clk_nvl)(struct gk20a *g);
1319 void (*set_nvhsclk_ctrl_swap_clk_nvl)(struct gk20a *g, u32 val); 1316 void (*set_nvhsclk_ctrl_swap_clk_nvl)(struct gk20a *g, u32 val);
1320 } top; 1317 } top;
1318 struct {
1319 void (*acr_sw_init)(struct gk20a *g, struct nvgpu_acr *acr);
1320 } acr;
1321 void (*semaphore_wakeup)(struct gk20a *g, bool post_events); 1321 void (*semaphore_wakeup)(struct gk20a *g, bool post_events);
1322}; 1322};
1323 1323
@@ -1429,7 +1429,7 @@ struct gk20a {
1429 struct sim_nvgpu *sim; 1429 struct sim_nvgpu *sim;
1430 struct mm_gk20a mm; 1430 struct mm_gk20a mm;
1431 struct nvgpu_pmu pmu; 1431 struct nvgpu_pmu pmu;
1432 struct acr_desc acr; 1432 struct nvgpu_acr acr;
1433 struct nvgpu_ecc ecc; 1433 struct nvgpu_ecc ecc;
1434 struct clk_pmupstate clk_pmu; 1434 struct clk_pmupstate clk_pmu;
1435 struct perf_pmupstate perf_pmu; 1435 struct perf_pmupstate perf_pmu;
@@ -1477,7 +1477,6 @@ struct gk20a {
1477 u32 disable_syncpoints; 1477 u32 disable_syncpoints;
1478 1478
1479 bool support_pmu; 1479 bool support_pmu;
1480 u32 bootstrap_owner;
1481 1480
1482 bool is_virtual; 1481 bool is_virtual;
1483 1482