summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include
diff options
context:
space:
mode:
authorMahantesh Kumbar <mkumbar@nvidia.com>2017-12-07 11:38:10 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2018-01-19 02:39:56 -0500
commita57258e9b18f2f336457165391572bc477371e94 (patch)
tree1e5bde4c3a6ced447adfe0baeadb6e986ebfe819 /drivers/gpu/nvgpu/include
parentbadfffe3ef3f5901a5ebd819d25310b3b17c31eb (diff)
gpu: nvgpu: RPC interface support
- Created nv_pmu_rpc_cmd & nv_pmu_rpc_msg struct, & added member rpc under pmu_cmd & pmu_msg - Created RPC header interface - Created RPC desc struct & added as member to pmu payload - Defined PMU_RPC_EXECUTE() to convert different RPC request to make generic RPC call. - nvgpu_pmu_rpc_execute() function to execute RPC request by creating required RPC payload & send request to PMU to execute. - nvgpu_pmu_rpc_execute() function as default callback handler for RPC if caller not provided callback - Modified nvgpu_pmu_rpc_execute() function to include check of RPC payload parameter. - Modified nvgpu_pmu_cmd_post() function to handle RPC payload request. JIRA GPUT19X-137 Change-Id: Iac140eb6b98d6bae06a089e71c96f15068fe7e7b Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com> Signed-off-by: seshendra Gadagottu <sgadagottu@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1613266 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> GVS: Gerrit_Virtual_Submit Tested-by: Deepak Goyal <dgoyal@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/pmu.h25
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_cmn.h18
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/pmuif/nvgpu_gpmu_cmdif.h43
3 files changed, 86 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/pmu.h b/drivers/gpu/nvgpu/include/nvgpu/pmu.h
index c0ceca61..cd7e1879 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/pmu.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/pmu.h
@@ -143,9 +143,29 @@ enum {
143#define APCTRL_POWER_BREAKEVEN_DEFAULT_US (2000) 143#define APCTRL_POWER_BREAKEVEN_DEFAULT_US (2000)
144#define APCTRL_CYCLES_PER_SAMPLE_MAX_DEFAULT (200) 144#define APCTRL_CYCLES_PER_SAMPLE_MAX_DEFAULT (200)
145 145
146/* RPC */
147#define PMU_RPC_EXECUTE(_stat, _pmu, _unit, _func, _prpc, _size)\
148 do { \
149 memset(&((_prpc)->hdr), 0, sizeof((_prpc)->hdr));\
150 \
151 (_prpc)->hdr.unit_id = PMU_UNIT_##_unit; \
152 (_prpc)->hdr.function = NV_PMU_RPC_ID_##_unit##_##_func;\
153 (_prpc)->hdr.flags = 0x0; \
154 \
155 _stat = nvgpu_pmu_rpc_execute(_pmu, &((_prpc)->hdr), \
156 (sizeof(*(_prpc)) - sizeof((_prpc)->scratch)),\
157 (_size), NULL, NULL); \
158 } while (0)
159
146typedef void (*pmu_callback)(struct gk20a *, struct pmu_msg *, void *, u32, 160typedef void (*pmu_callback)(struct gk20a *, struct pmu_msg *, void *, u32,
147 u32); 161 u32);
148 162
163struct pmu_rpc_desc {
164 void *prpc;
165 u16 size_rpc;
166 u16 size_scratch;
167};
168
149struct pmu_payload { 169struct pmu_payload {
150 struct { 170 struct {
151 void *buf; 171 void *buf;
@@ -153,6 +173,7 @@ struct pmu_payload {
153 u32 size; 173 u32 size;
154 u32 fb_size; 174 u32 fb_size;
155 } in, out; 175 } in, out;
176 struct pmu_rpc_desc rpc;
156}; 177};
157 178
158struct pmu_ucode_desc { 179struct pmu_ucode_desc {
@@ -472,4 +493,8 @@ void nvgpu_pmu_dump_falcon_stats(struct nvgpu_pmu *pmu);
472void nvgpu_pmu_dump_elpg_stats(struct nvgpu_pmu *pmu); 493void nvgpu_pmu_dump_elpg_stats(struct nvgpu_pmu *pmu);
473bool nvgpu_find_hex_in_string(char *strings, struct gk20a *g, u32 *hex_pos); 494bool nvgpu_find_hex_in_string(char *strings, struct gk20a *g, u32 *hex_pos);
474 495
496/* PMU RPC */
497int nvgpu_pmu_rpc_execute(struct nvgpu_pmu *pmu, struct nv_pmu_rpc_header *rpc,
498 u16 size_rpc, u16 size_scratch, pmu_callback callback, void *cb_param);
499
475#endif /* __NVGPU_PMU_H__ */ 500#endif /* __NVGPU_PMU_H__ */
diff --git a/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_cmn.h b/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_cmn.h
index f39e7b6c..2284289e 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_cmn.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_cmn.h
@@ -127,4 +127,22 @@ union name##_aligned { \
127 (PMU_FB_COPY_RW_ALIGNMENT))]; \ 127 (PMU_FB_COPY_RW_ALIGNMENT))]; \
128} 128}
129 129
130/* RPC (Remote Procedure Call) header structure */
131#define NV_PMU_RPC_FLAGS_TYPE_SYNC 0x00000000
132
133struct nv_pmu_rpc_header {
134 /* Identifies the unit servicing requested RPC*/
135 u8 unit_id;
136 /* Identifies the requested RPC (within the unit)*/
137 u8 function;
138 /* RPC call flags (@see PMU_RPC_FLAGS) */
139 u8 flags;
140 /* Falcon's status code to describe failures*/
141 u8 flcn_status;
142 /* RPC's total exec. time (measured on nvgpu driver side)*/
143 u32 exec_time_nv_ns;
144 /* RPC's actual exec. time (measured on PMU side)*/
145 u32 exec_time_pmu_ns;
146};
147
130#endif /* _GPMUIFCMN_H_*/ 148#endif /* _GPMUIFCMN_H_*/
diff --git a/drivers/gpu/nvgpu/include/nvgpu/pmuif/nvgpu_gpmu_cmdif.h b/drivers/gpu/nvgpu/include/nvgpu/pmuif/nvgpu_gpmu_cmdif.h
index fea6326a..208644d7 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/pmuif/nvgpu_gpmu_cmdif.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/pmuif/nvgpu_gpmu_cmdif.h
@@ -39,6 +39,47 @@
39#include "gpmuifthermsensor.h" 39#include "gpmuifthermsensor.h"
40#include "gpmuifseq.h" 40#include "gpmuifseq.h"
41 41
42/*
43 * Command requesting execution of the RPC (Remote Procedure Call)
44 */
45struct nv_pmu_rpc_cmd {
46 /* Must be set to @ref NV_PMU_RPC_CMD_ID */
47 u8 cmd_type;
48 /* RPC call flags (@see PMU_RPC_FLAGS) */
49 u8 flags;
50 /* Size of RPC structure allocated
51 * within NV managed DMEM heap
52 */
53 u16 rpc_dmem_size;
54 /*
55 * DMEM pointer of RPC structure allocated
56 * within RM managed DMEM heap.
57 */
58 u32 rpc_dmem_ptr;
59};
60
61#define NV_PMU_RPC_CMD_ID 0x80
62
63/* Message carrying the result of the RPC execution */
64struct nv_pmu_rpc_msg {
65 /* Must be set to @ref NV_PMU_RPC_MSG_ID */
66 u8 msg_type;
67 /* RPC call flags (@see PMU_RPC_FLAGS)*/
68 u8 flags;
69 /*
70 * Size of RPC structure allocated
71 * within NV managed DMEM heap.
72 */
73 u16 rpc_dmem_size;
74 /*
75 * DMEM pointer of RPC structure allocated
76 * within NV managed DMEM heap.
77 */
78 u32 rpc_dmem_ptr;
79};
80
81#define NV_PMU_RPC_MSG_ID 0x80
82
42struct pmu_cmd { 83struct pmu_cmd {
43 struct pmu_hdr hdr; 84 struct pmu_hdr hdr;
44 union { 85 union {
@@ -52,6 +93,7 @@ struct pmu_cmd {
52 struct nv_pmu_clk_cmd clk; 93 struct nv_pmu_clk_cmd clk;
53 struct nv_pmu_pmgr_cmd pmgr; 94 struct nv_pmu_pmgr_cmd pmgr;
54 struct nv_pmu_therm_cmd therm; 95 struct nv_pmu_therm_cmd therm;
96 struct nv_pmu_rpc_cmd rpc;
55 } cmd; 97 } cmd;
56}; 98};
57 99
@@ -69,6 +111,7 @@ struct pmu_msg {
69 struct nv_pmu_clk_msg clk; 111 struct nv_pmu_clk_msg clk;
70 struct nv_pmu_pmgr_msg pmgr; 112 struct nv_pmu_pmgr_msg pmgr;
71 struct nv_pmu_therm_msg therm; 113 struct nv_pmu_therm_msg therm;
114 struct nv_pmu_rpc_msg rpc;
72 } msg; 115 } msg;
73}; 116};
74 117