Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/msm: rd dumping prep for sparse mappings

Similar to the previous commit, add support for dumping partial
mappings.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
Tested-by: Antonino Maniscalco <antomani103@gmail.com>
Reviewed-by: Antonino Maniscalco <antomani103@gmail.com>
Patchwork: https://patchwork.freedesktop.org/patch/661514/

authored by

Rob Clark and committed by
Rob Clark
4570dbb8 757cff73

+17 -31
-10
drivers/gpu/drm/msm/msm_gem.h
··· 403 403 404 404 void msm_submit_retire(struct msm_gem_submit *submit); 405 405 406 - /* helper to determine of a buffer in submit should be dumped, used for both 407 - * devcoredump and debugfs cmdstream dumping: 408 - */ 409 - static inline bool 410 - should_dump(struct msm_gem_submit *submit, int idx) 411 - { 412 - extern bool rd_full; 413 - return rd_full || (submit->bos[idx].flags & MSM_SUBMIT_BO_DUMP); 414 - } 415 - 416 406 #endif /* __MSM_GEM_H__ */
+17 -21
drivers/gpu/drm/msm/msm_rd.c
··· 308 308 priv->hangrd = NULL; 309 309 } 310 310 311 - static void snapshot_buf(struct msm_rd_state *rd, 312 - struct msm_gem_submit *submit, int idx, 313 - uint64_t iova, uint32_t size, bool full) 311 + static void snapshot_buf(struct msm_rd_state *rd, struct drm_gem_object *obj, 312 + uint64_t iova, bool full, size_t offset, size_t size) 314 313 { 315 - struct drm_gem_object *obj = submit->bos[idx].obj; 316 - unsigned offset = 0; 317 314 const char *buf; 318 - 319 - if (iova) { 320 - offset = iova - submit->bos[idx].iova; 321 - } else { 322 - iova = submit->bos[idx].iova; 323 - size = obj->size; 324 - } 325 315 326 316 /* 327 317 * Always write the GPUADDR header so can get a complete list of all the ··· 321 331 (uint32_t[3]){ iova, size, iova >> 32 }, 12); 322 332 323 333 if (!full) 324 - return; 325 - 326 - /* But only dump the contents of buffers marked READ */ 327 - if (!(submit->bos[idx].flags & MSM_SUBMIT_BO_READ)) 328 334 return; 329 335 330 336 buf = msm_gem_get_vaddr_active(obj); ··· 338 352 void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit, 339 353 const char *fmt, ...) 340 354 { 355 + extern bool rd_full; 341 356 struct task_struct *task; 342 357 char msg[256]; 343 358 int i, n; ··· 372 385 373 386 rd_write_section(rd, RD_CMD, msg, ALIGN(n, 4)); 374 387 375 - for (i = 0; i < submit->nr_bos; i++) 376 - snapshot_buf(rd, submit, i, 0, 0, should_dump(submit, i)); 388 + for (i = 0; i < submit->nr_bos; i++) { 389 + struct drm_gem_object *obj = submit->bos[i].obj; 390 + bool dump = rd_full || (submit->bos[i].flags & MSM_SUBMIT_BO_DUMP); 391 + 392 + snapshot_buf(rd, obj, submit->bos[i].iova, dump, 0, obj->size); 393 + } 377 394 378 395 for (i = 0; i < submit->nr_cmds; i++) { 379 396 uint32_t szd = submit->cmd[i].size; /* in dwords */ 397 + int idx = submit->cmd[i].idx; 398 + bool dump = rd_full || (submit->bos[idx].flags & MSM_SUBMIT_BO_DUMP); 380 399 381 400 /* snapshot cmdstream bo's (if we haven't already): */ 382 - if (!should_dump(submit, i)) { 383 - snapshot_buf(rd, submit, submit->cmd[i].idx, 384 - submit->cmd[i].iova, szd * 4, true); 401 + if (!dump) { 402 + struct drm_gem_object *obj = submit->bos[idx].obj; 403 + size_t offset = submit->cmd[i].iova - submit->bos[idx].iova; 404 + 405 + snapshot_buf(rd, obj, submit->cmd[i].iova, true, 406 + offset, szd * 4); 385 407 } 386 408 } 387 409