tree: https://github.com/AsahiLinux/linux gpu/rust-wip head: b7b1866d75e6b48630820b15ccc67dc198f8666f commit: ca6671570b1bf82f6509557fcaeb4d3050728b75 [1738/2027] drm/apple: Split dcpep/iomfb out of dcp.c config: arm64-allyesconfig compiler: aarch64-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/AsahiLinux/linux/commit/ca6671570b1bf82f6509557fcaeb4d3050728b75 git remote add asahilinux https://github.com/AsahiLinux/linux git fetch --no-tags asahilinux gpu/rust-wip git checkout ca6671570b1bf82f6509557fcaeb4d3050728b75 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/gpu/drm/apple/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All warnings (new ones prefixed by >>): >> drivers/gpu/drm/apple/iomfb.c:129:24: warning: no previous prototype for 'dcp_get_cb_channel' [-Wmissing-prototypes] 129 | struct dcp_cb_channel *dcp_get_cb_channel(struct apple_dcp *dcp, | ^~~~~~~~~~~~~~~~~~ >> drivers/gpu/drm/apple/iomfb.c:192:6: warning: no previous prototype for 'dcp_push' [-Wmissing-prototypes] 192 | void dcp_push(struct apple_dcp *dcp, bool oob, enum dcpep_method method, | ^~~~~~~~ >> drivers/gpu/drm/apple/iomfb.c:322:6: warning: no previous prototype for 'dcp_ack' [-Wmissing-prototypes] 322 | void dcp_ack(struct apple_dcp *dcp, enum dcp_context_id context) | ^~~~~~~ >> drivers/gpu/drm/apple/iomfb.c:1274:17: warning: no previous prototype for 'drm_to_dcp_rect' [-Wmissing-prototypes] 1274 | struct dcp_rect drm_to_dcp_rect(struct drm_rect *rect) | ^~~~~~~~~~~~~~~ In file included from drivers/gpu/drm/apple/iomfb.c:23: drivers/gpu/drm/apple/dcp.h:49:18: warning: 'dcp_formats' defined but not used [-Wunused-const-variable=] 49 | static const u32 dcp_formats[] = { | ^~~~~~~~~~~ vim +/dcp_get_cb_channel +129 drivers/gpu/drm/apple/iomfb.c 127 128 /* Get a callback channel for a context */ > 129 struct dcp_cb_channel *dcp_get_cb_channel(struct apple_dcp *dcp, 130 enum dcp_context_id context) 131 { 132 switch (context) { 133 case DCP_CONTEXT_CB: 134 return &dcp->ch_cb; 135 case DCP_CONTEXT_OOBCB: 136 return &dcp->ch_oobcb; 137 case DCP_CONTEXT_ASYNC: 138 return &dcp->ch_async; 139 default: 140 return NULL; 141 } 142 } 143 144 /* Get the start of a packet: after the end of the previous packet */ 145 static u16 dcp_packet_start(struct dcp_call_channel *ch, u8 depth) 146 { 147 if (depth > 0) 148 return ch->end[depth - 1]; 149 else 150 return 0; 151 } 152 153 /* Pushes and pops the depth of the call stack with safety checks */ 154 static u8 dcp_push_depth(u8 *depth) 155 { 156 u8 ret = (*depth)++; 157 158 WARN_ON(ret >= DCP_MAX_CALL_DEPTH); 159 return ret; 160 } 161 162 static u8 dcp_pop_depth(u8 *depth) 163 { 164 WARN_ON((*depth) == 0); 165 166 return --(*depth); 167 } 168 169 #define DCP_METHOD(tag, name) [name] = { #name, tag } 170 171 const struct dcp_method_entry dcp_methods[dcpep_num_methods] = { 172 DCP_METHOD("A000", dcpep_late_init_signal), 173 DCP_METHOD("A029", dcpep_setup_video_limits), 174 DCP_METHOD("A034", dcpep_update_notify_clients_dcp), 175 DCP_METHOD("A357", dcpep_set_create_dfb), 176 DCP_METHOD("A401", dcpep_start_signal), 177 DCP_METHOD("A407", dcpep_swap_start), 178 DCP_METHOD("A408", dcpep_swap_submit), 179 DCP_METHOD("A410", dcpep_set_display_device), 180 DCP_METHOD("A411", dcpep_is_main_display), 181 DCP_METHOD("A412", dcpep_set_digital_out_mode), 182 DCP_METHOD("A439", dcpep_set_parameter_dcp), 183 DCP_METHOD("A443", dcpep_create_default_fb), 184 DCP_METHOD("A447", dcpep_enable_disable_video_power_savings), 185 DCP_METHOD("A454", dcpep_first_client_open), 186 DCP_METHOD("A460", dcpep_set_display_refresh_properties), 187 DCP_METHOD("A463", dcpep_flush_supports_power), 188 DCP_METHOD("A468", dcpep_set_power_state), 189 }; 190 191 /* Call a DCP function given by a tag */ > 192 void dcp_push(struct apple_dcp *dcp, bool oob, enum dcpep_method method, 193 u32 in_len, u32 out_len, void *data, dcp_callback_t cb, 194 void *cookie) 195 { 196 struct dcp_call_channel *ch = oob ? &dcp->ch_oobcmd : &dcp->ch_cmd; 197 enum dcp_context_id context = dcp_call_context(dcp, oob); 198 199 struct dcp_packet_header header = { 200 .in_len = in_len, 201 .out_len = out_len, 202 203 /* Tag is reversed due to endianness of the fourcc */ 204 .tag[0] = dcp_methods[method].tag[3], 205 .tag[1] = dcp_methods[method].tag[2], 206 .tag[2] = dcp_methods[method].tag[1], 207 .tag[3] = dcp_methods[method].tag[0], 208 }; 209 210 u8 depth = dcp_push_depth(&ch->depth); 211 u16 offset = dcp_packet_start(ch, depth); 212 213 void *out = dcp->shmem + dcp_tx_offset(context) + offset; 214 void *out_data = out + sizeof(header); 215 size_t data_len = sizeof(header) + in_len + out_len; 216 217 memcpy(out, &header, sizeof(header)); 218 219 if (in_len > 0) 220 memcpy(out_data, data, in_len); 221 222 dev_dbg(dcp->dev, "---> %s: context %u, offset %u, depth %u\n", 223 dcp_methods[method].name, context, offset, depth); 224 225 ch->callbacks[depth] = cb; 226 ch->cookies[depth] = cookie; 227 ch->output[depth] = out + sizeof(header) + in_len; 228 ch->end[depth] = offset + ALIGN(data_len, DCP_PACKET_ALIGNMENT); 229 230 apple_rtkit_send_message(dcp->rtk, IOMFB_ENDPOINT, 231 dcpep_msg(context, data_len, offset), NULL, 232 false); 233 } 234 235 #define DCP_THUNK_VOID(func, handle) \ 236 static void func(struct apple_dcp *dcp, bool oob, dcp_callback_t cb, \ 237 void *cookie) \ 238 { \ 239 dcp_push(dcp, oob, handle, 0, 0, NULL, cb, cookie); \ 240 } 241 242 #define DCP_THUNK_OUT(func, handle, T) \ 243 static void func(struct apple_dcp *dcp, bool oob, dcp_callback_t cb, \ 244 void *cookie) \ 245 { \ 246 dcp_push(dcp, oob, handle, 0, sizeof(T), NULL, cb, cookie); \ 247 } 248 249 #define DCP_THUNK_IN(func, handle, T) \ 250 static void func(struct apple_dcp *dcp, bool oob, T *data, \ 251 dcp_callback_t cb, void *cookie) \ 252 { \ 253 dcp_push(dcp, oob, handle, sizeof(T), 0, data, cb, cookie); \ 254 } 255 256 #define DCP_THUNK_INOUT(func, handle, T_in, T_out) \ 257 static void func(struct apple_dcp *dcp, bool oob, T_in *data, \ 258 dcp_callback_t cb, void *cookie) \ 259 { \ 260 dcp_push(dcp, oob, handle, sizeof(T_in), sizeof(T_out), data, \ 261 cb, cookie); \ 262 } 263 264 DCP_THUNK_INOUT(dcp_swap_submit, dcpep_swap_submit, struct dcp_swap_submit_req, 265 struct dcp_swap_submit_resp); 266 267 DCP_THUNK_INOUT(dcp_swap_start, dcpep_swap_start, struct dcp_swap_start_req, 268 struct dcp_swap_start_resp); 269 270 DCP_THUNK_INOUT(dcp_set_power_state, dcpep_set_power_state, 271 struct dcp_set_power_state_req, 272 struct dcp_set_power_state_resp); 273 274 DCP_THUNK_INOUT(dcp_set_digital_out_mode, dcpep_set_digital_out_mode, 275 struct dcp_set_digital_out_mode_req, u32); 276 277 DCP_THUNK_INOUT(dcp_set_display_device, dcpep_set_display_device, u32, u32); 278 279 DCP_THUNK_OUT(dcp_set_display_refresh_properties, 280 dcpep_set_display_refresh_properties, u32); 281 282 DCP_THUNK_OUT(dcp_late_init_signal, dcpep_late_init_signal, u32); 283 DCP_THUNK_IN(dcp_flush_supports_power, dcpep_flush_supports_power, u32); 284 DCP_THUNK_OUT(dcp_create_default_fb, dcpep_create_default_fb, u32); 285 DCP_THUNK_OUT(dcp_start_signal, dcpep_start_signal, u32); 286 DCP_THUNK_VOID(dcp_setup_video_limits, dcpep_setup_video_limits); 287 DCP_THUNK_VOID(dcp_set_create_dfb, dcpep_set_create_dfb); 288 DCP_THUNK_VOID(dcp_first_client_open, dcpep_first_client_open); 289 290 __attribute__((unused)) 291 DCP_THUNK_IN(dcp_update_notify_clients_dcp, dcpep_update_notify_clients_dcp, 292 struct dcp_update_notify_clients_dcp); 293 294 DCP_THUNK_INOUT(dcp_set_parameter_dcp, dcpep_set_parameter_dcp, 295 struct dcp_set_parameter_dcp, u32); 296 297 DCP_THUNK_INOUT(dcp_enable_disable_video_power_savings, 298 dcpep_enable_disable_video_power_savings, u32, int); 299 300 DCP_THUNK_OUT(dcp_is_main_display, dcpep_is_main_display, u32); 301 302 /* Parse a callback tag "D123" into the ID 123. Returns -EINVAL on failure. */ 303 static int dcp_parse_tag(char tag[4]) 304 { 305 u32 d[3]; 306 int i; 307 308 if (tag[3] != 'D') 309 return -EINVAL; 310 311 for (i = 0; i < 3; ++i) { 312 d[i] = (u32)(tag[i] - '0'); 313 314 if (d[i] > 9) 315 return -EINVAL; 316 } 317 318 return d[0] + (d[1] * 10) + (d[2] * 100); 319 } 320 321 /* Ack a callback from the DCP */ > 322 void dcp_ack(struct apple_dcp *dcp, enum dcp_context_id context) 323 { 324 struct dcp_cb_channel *ch = dcp_get_cb_channel(dcp, context); 325 326 dcp_pop_depth(&ch->depth); 327 apple_rtkit_send_message(dcp->rtk, IOMFB_ENDPOINT, dcpep_ack(context), 328 NULL, false); 329 } 330 -- 0-DAY CI Kernel Test Service https://01.org/lkp