summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMahantesh Kumbar <mkumbar@nvidia.com>2018-03-16 14:03:23 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-08-28 09:46:36 -0400
commit3e5e4804f9c2bf5b914012852b56dbbbc00f8253 (patch)
tree748dcdbd358e82cf9fe9b53c078dc64c910b97da
parent271456272d09d6c21728cc92bedc8ec6f7f48c8b (diff)
gpu: nvgpu: gv10x therm boardobj support
- Added support for below multiple therm sensor device & defined macros GPC_TSOSC GPC SCI HBM2_SITE HBM2_COMBINED - Added PMU interface for listed therm sensor device - Added nvgpu interface for listed therm sensor device - Added construct boardobj support for listed therm sensor device & called to update nvgpu interface. - Updated devinit_get_therm_device_table() to read sensor info from therm device table from vbios table & construct respective therm device boardobj using construct_therm_device_*() based on class_id param read from vbios table. - Updated RPC handler to handle THERM ack request - Updated gv100 therm ops "get_internal_sensor_limits" to point to gp106_get_internal_sensor_limits() Change-Id: I4b4ed501d0625cb8fc7b300c820622e40ae59fe6 Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1676785 Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Vaikundanathan S <vaikuns@nvidia.com> Tested-by: Vaikundanathan S <vaikuns@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>
-rw-r--r--drivers/gpu/nvgpu/common/pmu/pmu_ipc.c12
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/bios.h7
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuifthermsensor.h22
-rw-r--r--drivers/gpu/nvgpu/therm/thrmdev.c217
-rw-r--r--drivers/gpu/nvgpu/therm/thrmdev.h20
5 files changed, 249 insertions, 29 deletions
diff --git a/drivers/gpu/nvgpu/common/pmu/pmu_ipc.c b/drivers/gpu/nvgpu/common/pmu/pmu_ipc.c
index 68654a70..843a4551 100644
--- a/drivers/gpu/nvgpu/common/pmu/pmu_ipc.c
+++ b/drivers/gpu/nvgpu/common/pmu/pmu_ipc.c
@@ -841,8 +841,16 @@ static void pmu_rpc_handler(struct gk20a *g, struct pmu_msg *msg,
841 nvgpu_pmu_dbg(g, "reply PMU_UNIT_PERF"); 841 nvgpu_pmu_dbg(g, "reply PMU_UNIT_PERF");
842 break; 842 break;
843 case PMU_UNIT_THERM: 843 case PMU_UNIT_THERM:
844 nvgpu_pmu_dbg(g, "reply PMU_UNIT_THERM"); 844 switch (rpc.function) {
845 break; 845 case NV_PMU_RPC_ID_THERM_BOARD_OBJ_GRP_CMD:
846 nvgpu_pmu_dbg(g,
847 "reply NV_PMU_RPC_ID_THERM_BOARD_OBJ_GRP_CMD");
848 break;
849 default:
850 nvgpu_pmu_dbg(g, "reply PMU_UNIT_THERM");
851 break;
852 }
853 break;
846 /* TBD case will be added */ 854 /* TBD case will be added */
847 default: 855 default:
848 nvgpu_err(g, " Invalid RPC response, stats 0x%x", 856 nvgpu_err(g, " Invalid RPC response, stats 0x%x",
diff --git a/drivers/gpu/nvgpu/include/nvgpu/bios.h b/drivers/gpu/nvgpu/include/nvgpu/bios.h
index 0619fcb9..0323dce4 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/bios.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/bios.h
@@ -890,7 +890,12 @@ struct therm_device_1x_entry {
890 u8 flags; 890 u8 flags;
891} ; 891} ;
892 892
893#define NV_VBIOS_THERM_DEVICE_1X_ENTRY_CLASS_GPU 0x01 893#define NV_VBIOS_THERM_DEVICE_1X_ENTRY_CLASS_INVALID 0x00
894#define NV_VBIOS_THERM_DEVICE_1X_ENTRY_CLASS_GPU 0x01
895#define NV_VBIOS_THERM_DEVICE_1X_ENTRY_CLASS_GPU_GPC_TSOSC 0x02
896#define NV_VBIOS_THERM_DEVICE_1X_ENTRY_CLASS_GPU_GPC_SCI 0x03
897#define NV_VBIOS_THERM_DEVICE_1X_ENTRY_CLASS_HBM2_SITE 0x70
898#define NV_VBIOS_THERM_DEVICE_1X_ENTRY_CLASS_HBM2_COMBINED 0x71
894 899
895#define NV_VBIOS_THERM_DEVICE_1X_ENTRY_PARAM0_I2C_DEVICE_INDEX_MASK 0xFF 900#define NV_VBIOS_THERM_DEVICE_1X_ENTRY_PARAM0_I2C_DEVICE_INDEX_MASK 0xFF
896#define NV_VBIOS_THERM_DEVICE_1X_ENTRY_PARAM0_I2C_DEVICE_INDEX_SHIFT 0 901#define NV_VBIOS_THERM_DEVICE_1X_ENTRY_PARAM0_I2C_DEVICE_INDEX_SHIFT 0
diff --git a/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuifthermsensor.h b/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuifthermsensor.h
index 994cd5b7..8f2a8584 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuifthermsensor.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuifthermsensor.h
@@ -41,15 +41,37 @@ struct nv_pmu_therm_therm_device_boardobj_set {
41 struct nv_pmu_boardobj super; 41 struct nv_pmu_boardobj super;
42}; 42};
43 43
44struct nv_pmu_therm_therm_device_gpu_gpc_tsosc_boardobj_set {
45 struct nv_pmu_therm_therm_device_boardobj_set super;
46 u8 gpc_tsosc_idx;
47};
48
49struct nv_pmu_therm_therm_device_gpu_sci_boardobj_set {
50 struct nv_pmu_therm_therm_device_boardobj_set super;
51};
52
44struct nv_pmu_therm_therm_device_i2c_boardobj_set { 53struct nv_pmu_therm_therm_device_i2c_boardobj_set {
45 struct nv_pmu_therm_therm_device_boardobj_set super; 54 struct nv_pmu_therm_therm_device_boardobj_set super;
46 u8 i2c_dev_idx; 55 u8 i2c_dev_idx;
47}; 56};
48 57
58struct nv_pmu_therm_therm_device_hbm2_site_boardobj_set {
59 struct nv_pmu_therm_therm_device_boardobj_set super;
60 u8 site_idx;
61};
62
63struct nv_pmu_therm_therm_device_hbm2_combined_boardobj_set {
64 struct nv_pmu_therm_therm_device_boardobj_set super;
65};
66
49union nv_pmu_therm_therm_device_boardobj_set_union { 67union nv_pmu_therm_therm_device_boardobj_set_union {
50 struct nv_pmu_boardobj board_obj; 68 struct nv_pmu_boardobj board_obj;
51 struct nv_pmu_therm_therm_device_boardobj_set therm_device; 69 struct nv_pmu_therm_therm_device_boardobj_set therm_device;
70 struct nv_pmu_therm_therm_device_gpu_gpc_tsosc_boardobj_set gpu_gpc_tsosc;
71 struct nv_pmu_therm_therm_device_gpu_sci_boardobj_set gpu_sci;
52 struct nv_pmu_therm_therm_device_i2c_boardobj_set i2c; 72 struct nv_pmu_therm_therm_device_i2c_boardobj_set i2c;
73 struct nv_pmu_therm_therm_device_hbm2_site_boardobj_set hbm2_site;
74 struct nv_pmu_therm_therm_device_hbm2_combined_boardobj_set hbm2_combined;
53}; 75};
54 76
55NV_PMU_BOARDOBJ_GRP_SET_MAKE_E32(therm, therm_device); 77NV_PMU_BOARDOBJ_GRP_SET_MAKE_E32(therm, therm_device);
diff --git a/drivers/gpu/nvgpu/therm/thrmdev.c b/drivers/gpu/nvgpu/therm/thrmdev.c
index 7371ba25..aaf0a461 100644
--- a/drivers/gpu/nvgpu/therm/thrmdev.c
+++ b/drivers/gpu/nvgpu/therm/thrmdev.c
@@ -30,22 +30,6 @@
30#include "gp106/bios_gp106.h" 30#include "gp106/bios_gp106.h"
31#include "ctrl/ctrltherm.h" 31#include "ctrl/ctrltherm.h"
32 32
33static struct boardobj *construct_therm_device(struct gk20a *g,
34 void *pargs, u16 pargs_size, u8 type)
35{
36 struct boardobj *board_obj_ptr = NULL;
37 u32 status;
38
39 status = boardobj_construct_super(g, &board_obj_ptr,
40 pargs_size, pargs);
41 if (status)
42 return NULL;
43
44 nvgpu_log_info(g, " Done");
45
46 return board_obj_ptr;
47}
48
49static u32 _therm_device_pmudata_instget(struct gk20a *g, 33static u32 _therm_device_pmudata_instget(struct gk20a *g,
50 struct nv_pmu_boardobjgrp *pmuboardobjgrp, 34 struct nv_pmu_boardobjgrp *pmuboardobjgrp,
51 struct nv_pmu_boardobj **ppboardobjpmudata, 35 struct nv_pmu_boardobj **ppboardobjpmudata,
@@ -70,6 +54,168 @@ static u32 _therm_device_pmudata_instget(struct gk20a *g,
70 return 0; 54 return 0;
71} 55}
72 56
57static u32 construct_therm_device(struct gk20a *g,
58 struct boardobj **ppboardobj, u16 size, void *pargs)
59{
60 return boardobj_construct_super(g, ppboardobj, size, pargs);
61}
62
63static u32 construct_therm_device_gpu(struct gk20a *g,
64 struct boardobj **ppboardobj, u16 size, void *pargs)
65{
66 return construct_therm_device(g, ppboardobj, size, pargs);
67}
68
69static u32 construct_therm_device_gpu_sci(struct gk20a *g,
70 struct boardobj **ppboardobj, u16 size, void *pargs)
71{
72 return construct_therm_device(g, ppboardobj, size, pargs);
73}
74
75
76static u32 therm_device_pmu_data_init_gpu_gpc_tsosc(struct gk20a *g,
77 struct boardobj *pboard_obj, struct nv_pmu_boardobj *ppmudata)
78{
79 u32 status = 0;
80 struct therm_device_gpu_gpc_tsosc *pdev = NULL;
81 struct nv_pmu_therm_therm_device_gpu_gpc_tsosc_boardobj_set *pset;
82
83 status = boardobj_pmudatainit_super(g, pboard_obj, ppmudata);
84 if (status != 0) {
85 goto exit;
86 }
87
88 pdev = (struct therm_device_gpu_gpc_tsosc *)(void *)pboard_obj;
89 pset = (struct nv_pmu_therm_therm_device_gpu_gpc_tsosc_boardobj_set *)
90 (void*) ppmudata;
91
92 pset->gpc_tsosc_idx = pdev->gpc_tsosc_idx;
93
94exit:
95 return status;
96}
97
98static u32 construct_therm_device_gpu_tsosc(struct gk20a *g,
99 struct boardobj **ppboardobj, u16 size, void *pargs)
100{
101 struct therm_device_gpu_gpc_tsosc *pdev = NULL;
102 struct therm_device_gpu_gpc_tsosc *ptmp_dev =
103 (struct therm_device_gpu_gpc_tsosc *)pargs;
104 u32 status = 0;
105
106 status = construct_therm_device(g, ppboardobj, size, pargs);
107 if (status != 0) {
108 return status;
109 }
110
111 pdev = (struct therm_device_gpu_gpc_tsosc *)(void *)*ppboardobj;
112
113 pdev->super.super.pmudatainit =
114 therm_device_pmu_data_init_gpu_gpc_tsosc;
115
116 pdev->gpc_tsosc_idx = ptmp_dev->gpc_tsosc_idx;
117
118 return status;
119}
120
121static u32 therm_device_pmu_data_init_hbm2_site(struct gk20a *g,
122 struct boardobj *pboard_obj, struct nv_pmu_boardobj *ppmudata)
123{
124 u32 status = 0;
125 struct therm_device_hbm2_site *pdev = NULL;
126 struct nv_pmu_therm_therm_device_hbm2_site_boardobj_set *pset;
127
128 status = boardobj_pmudatainit_super(g, pboard_obj, ppmudata);
129 if (status != 0) {
130 goto exit;
131 }
132
133 pdev = (struct therm_device_hbm2_site *)(void *)pboard_obj;
134 pset = (struct nv_pmu_therm_therm_device_hbm2_site_boardobj_set *)
135 (void *)ppmudata;
136
137 pset->site_idx = pdev->site_idx;
138
139exit:
140 return status;
141}
142
143static u32 construct_therm_device_hbm2_site(struct gk20a *g,
144 struct boardobj **ppboardobj, u16 size, void *pargs)
145{
146 struct therm_device_hbm2_site *pdev = NULL;
147 struct therm_device_hbm2_site *ptmp_dev =
148 (struct therm_device_hbm2_site *)pargs;
149 u32 status = 0;
150
151 status = construct_therm_device(g, ppboardobj, size, pargs);
152 if (status != 0) {
153 return status;
154 }
155
156 pdev = (struct therm_device_hbm2_site *)(void *)*ppboardobj;
157
158 pdev->super.super.pmudatainit =
159 therm_device_pmu_data_init_hbm2_site;
160
161 pdev->site_idx = ptmp_dev->site_idx;
162
163 return status;
164}
165
166static u32 construct_therm_device_hbm2_combined(struct gk20a *g,
167 struct boardobj **ppboardobj, u16 size, void *pargs)
168{
169 return construct_therm_device(g, ppboardobj, size, pargs);
170}
171
172
173static struct boardobj *therm_device_construct(struct gk20a *g,
174 void *pargs)
175{
176 struct boardobj *board_obj_ptr = NULL;
177 u32 status = 0;
178
179 switch (BOARDOBJ_GET_TYPE(pargs)) {
180 case NV_VBIOS_THERM_DEVICE_1X_ENTRY_CLASS_GPU:
181 status = construct_therm_device_gpu(g, &board_obj_ptr,
182 sizeof(struct therm_device), pargs);
183 break;
184 case NV_VBIOS_THERM_DEVICE_1X_ENTRY_CLASS_GPU_GPC_SCI:
185 status = construct_therm_device_gpu_sci(g, &board_obj_ptr,
186 sizeof(struct therm_device_gpu_sci), pargs);
187 break;
188 case NV_VBIOS_THERM_DEVICE_1X_ENTRY_CLASS_GPU_GPC_TSOSC:
189 status = construct_therm_device_gpu_tsosc(g, &board_obj_ptr,
190 sizeof(struct therm_device_gpu_gpc_tsosc), pargs);
191 break;
192 case NV_VBIOS_THERM_DEVICE_1X_ENTRY_CLASS_HBM2_SITE:
193 status = construct_therm_device_hbm2_site(g, &board_obj_ptr,
194 sizeof(struct therm_device_hbm2_site), pargs);
195 break;
196 case NV_VBIOS_THERM_DEVICE_1X_ENTRY_CLASS_HBM2_COMBINED:
197 status = construct_therm_device_hbm2_combined(g, &board_obj_ptr,
198 sizeof(struct therm_device_hbm2_combined), pargs);
199 break;
200 default:
201 nvgpu_err(g,
202 "unsupported therm_device class - 0x%x",
203 BOARDOBJ_GET_TYPE(pargs));
204 break;
205 }
206
207 if(status) {
208 board_obj_ptr = NULL;
209 nvgpu_err(g,
210 "could not allocate memory for therm_device");
211 if (board_obj_ptr != NULL)
212 nvgpu_kfree(g, board_obj_ptr);
213 }
214
215
216 return board_obj_ptr;
217}
218
73static u32 devinit_get_therm_device_table(struct gk20a *g, 219static u32 devinit_get_therm_device_table(struct gk20a *g,
74 struct therm_devices *pthermdeviceobjs) 220 struct therm_devices *pthermdeviceobjs)
75{ 221{
@@ -81,10 +227,14 @@ static u32 devinit_get_therm_device_table(struct gk20a *g,
81 struct therm_device_1x_entry *therm_device_table_entry = NULL; 227 struct therm_device_1x_entry *therm_device_table_entry = NULL;
82 u32 index; 228 u32 index;
83 u32 obj_index = 0; 229 u32 obj_index = 0;
84 u16 therm_device_size = 0; 230 u8 class_id = 0;
85 union { 231 union {
86 struct boardobj boardobj; 232 struct boardobj boardobj;
87 struct therm_device therm_device; 233 struct therm_device therm_device;
234 struct therm_device_gpu_sci gpu_sci;
235 struct therm_device_gpu_gpc_tsosc gpu_gpc_tsosc;
236 struct therm_device_hbm2_site hbm2_site;
237 struct therm_device_hbm2_combined hbm2_combined;
88 } therm_device_data; 238 } therm_device_data;
89 239
90 nvgpu_log_info(g, " "); 240 nvgpu_log_info(g, " ");
@@ -120,17 +270,34 @@ static u32 devinit_get_therm_device_table(struct gk20a *g,
120 (curr_therm_device_table_ptr + 270 (curr_therm_device_table_ptr +
121 (therm_device_table_header.table_entry_size * index)); 271 (therm_device_table_header.table_entry_size * index));
122 272
123 if (therm_device_table_entry->class_id != 273 class_id = therm_device_table_entry->class_id;
124 NV_VBIOS_THERM_DEVICE_1X_ENTRY_CLASS_GPU) { 274
275 switch (class_id) {
276 case NV_VBIOS_THERM_DEVICE_1X_ENTRY_CLASS_INVALID:
125 continue; 277 continue;
278 break;
279 case NV_VBIOS_THERM_DEVICE_1X_ENTRY_CLASS_GPU:
280 case NV_VBIOS_THERM_DEVICE_1X_ENTRY_CLASS_GPU_GPC_SCI:
281 break;
282 case NV_VBIOS_THERM_DEVICE_1X_ENTRY_CLASS_GPU_GPC_TSOSC:
283 therm_device_data.gpu_gpc_tsosc.gpc_tsosc_idx =
284 therm_device_table_entry->param0;
285 break;
286 case NV_VBIOS_THERM_DEVICE_1X_ENTRY_CLASS_HBM2_SITE:
287 therm_device_data.hbm2_site.site_idx =
288 therm_device_table_entry->param0;
289 break;
290 case NV_VBIOS_THERM_DEVICE_1X_ENTRY_CLASS_HBM2_COMBINED:
291 break;
292 default:
293 nvgpu_err(g,
294 "Unknown thermal device class i - %x, class - %x",
295 index, class_id);
296 goto done;
126 } 297 }
127 298
128 therm_device_size = sizeof(struct therm_device); 299 therm_device_data.boardobj.type = class_id;
129 therm_device_data.boardobj.type = CTRL_THERMAL_THERM_DEVICE_CLASS_GPU; 300 boardobj = therm_device_construct(g, &therm_device_data);
130
131 boardobj = construct_therm_device(g, &therm_device_data,
132 therm_device_size, therm_device_data.boardobj.type);
133
134 if (!boardobj) { 301 if (!boardobj) {
135 nvgpu_err(g, 302 nvgpu_err(g,
136 "unable to create thermal device for %d type %d", 303 "unable to create thermal device for %d type %d",
diff --git a/drivers/gpu/nvgpu/therm/thrmdev.h b/drivers/gpu/nvgpu/therm/thrmdev.h
index 83ff5cbf..af349c88 100644
--- a/drivers/gpu/nvgpu/therm/thrmdev.h
+++ b/drivers/gpu/nvgpu/therm/thrmdev.h
@@ -32,7 +32,25 @@ struct therm_devices {
32}; 32};
33 33
34struct therm_device { 34struct therm_device {
35 struct therm_devices super; 35 struct boardobj super;
36};
37
38struct therm_device_gpu_sci {
39 struct therm_device super;
40};
41
42struct therm_device_gpu_gpc_tsosc {
43 struct therm_device super;
44 u8 gpc_tsosc_idx;
45};
46
47struct therm_device_hbm2_site {
48 struct therm_device super;
49 u8 site_idx;
50};
51
52struct therm_device_hbm2_combined {
53 struct therm_device super;
36}; 54};
37 55
38u32 therm_device_sw_setup(struct gk20a *g); 56u32 therm_device_sw_setup(struct gk20a *g);