diff options
Diffstat (limited to 'drivers/gpu/nvgpu/include')
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/pmu.h | 25 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_cmn.h | 18 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/pmuif/nvgpu_gpmu_cmdif.h | 43 |
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 | |||
146 | typedef void (*pmu_callback)(struct gk20a *, struct pmu_msg *, void *, u32, | 160 | typedef void (*pmu_callback)(struct gk20a *, struct pmu_msg *, void *, u32, |
147 | u32); | 161 | u32); |
148 | 162 | ||
163 | struct pmu_rpc_desc { | ||
164 | void *prpc; | ||
165 | u16 size_rpc; | ||
166 | u16 size_scratch; | ||
167 | }; | ||
168 | |||
149 | struct pmu_payload { | 169 | struct 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 | ||
158 | struct pmu_ucode_desc { | 179 | struct pmu_ucode_desc { |
@@ -472,4 +493,8 @@ void nvgpu_pmu_dump_falcon_stats(struct nvgpu_pmu *pmu); | |||
472 | void nvgpu_pmu_dump_elpg_stats(struct nvgpu_pmu *pmu); | 493 | void nvgpu_pmu_dump_elpg_stats(struct nvgpu_pmu *pmu); |
473 | bool nvgpu_find_hex_in_string(char *strings, struct gk20a *g, u32 *hex_pos); | 494 | bool nvgpu_find_hex_in_string(char *strings, struct gk20a *g, u32 *hex_pos); |
474 | 495 | ||
496 | /* PMU RPC */ | ||
497 | int 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 | |||
133 | struct 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 | */ | ||
45 | struct 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 */ | ||
64 | struct 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 | |||
42 | struct pmu_cmd { | 83 | struct 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 | ||