Commit 7a93d5c3 authored by Rob Clark's avatar Rob Clark

drm/msm/gpu: add submit flag to hint which buffers should be dumped

To lower CPU  overhead, future userspace will be switching to pinning
iova and avoiding the use of relocs, and only include cmds table entries
for IB1 level cmdstream (but not IB2 or state-groups).

This leaves the kernel unsure what to dump for rd/hangrd cmdstream
dumping.  So add a MSM_SUBMIT_BO_DUMP flag so userspace can indicate
buffers that contain cmdstream (or are otherwise important to dump).
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent 1df4289d
...@@ -114,8 +114,11 @@ static int submit_lookup_objects(struct msm_gem_submit *submit, ...@@ -114,8 +114,11 @@ static int submit_lookup_objects(struct msm_gem_submit *submit,
pagefault_disable(); pagefault_disable();
} }
/* at least one of READ and/or WRITE flags should be set: */
#define MANDATORY_FLAGS (MSM_SUBMIT_BO_READ | MSM_SUBMIT_BO_WRITE)
if ((submit_bo.flags & ~MSM_SUBMIT_BO_FLAGS) || if ((submit_bo.flags & ~MSM_SUBMIT_BO_FLAGS) ||
!(submit_bo.flags & MSM_SUBMIT_BO_FLAGS)) { !(submit_bo.flags & MANDATORY_FLAGS)) {
DRM_ERROR("invalid flags: %x\n", submit_bo.flags); DRM_ERROR("invalid flags: %x\n", submit_bo.flags);
ret = -EINVAL; ret = -EINVAL;
goto out_unlock; goto out_unlock;
......
...@@ -345,6 +345,12 @@ static void snapshot_buf(struct msm_rd_state *rd, ...@@ -345,6 +345,12 @@ static void snapshot_buf(struct msm_rd_state *rd,
msm_gem_put_vaddr(&obj->base); msm_gem_put_vaddr(&obj->base);
} }
static bool
should_dump(struct msm_gem_submit *submit, int idx)
{
return rd_full || (submit->bos[idx].flags & MSM_SUBMIT_BO_DUMP);
}
/* called under struct_mutex */ /* called under struct_mutex */
void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit, void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit,
const char *fmt, ...) const char *fmt, ...)
...@@ -386,15 +392,16 @@ void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit, ...@@ -386,15 +392,16 @@ void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit,
rd_write_section(rd, RD_CMD, msg, ALIGN(n, 4)); rd_write_section(rd, RD_CMD, msg, ALIGN(n, 4));
for (i = 0; rd_full && i < submit->nr_bos; i++) for (i = 0; i < submit->nr_bos; i++)
snapshot_buf(rd, submit, i, 0, 0); if (should_dump(submit, i))
snapshot_buf(rd, submit, i, 0, 0);
for (i = 0; i < submit->nr_cmds; i++) { for (i = 0; i < submit->nr_cmds; i++) {
uint64_t iova = submit->cmd[i].iova; uint64_t iova = submit->cmd[i].iova;
uint32_t szd = submit->cmd[i].size; /* in dwords */ uint32_t szd = submit->cmd[i].size; /* in dwords */
/* snapshot cmdstream bo's (if we haven't already): */ /* snapshot cmdstream bo's (if we haven't already): */
if (!rd_full) { if (!should_dump(submit, i)) {
snapshot_buf(rd, submit, submit->cmd[i].idx, snapshot_buf(rd, submit, submit->cmd[i].idx,
submit->cmd[i].iova, szd * 4); submit->cmd[i].iova, szd * 4);
} }
......
...@@ -188,8 +188,11 @@ struct drm_msm_gem_submit_cmd { ...@@ -188,8 +188,11 @@ struct drm_msm_gem_submit_cmd {
*/ */
#define MSM_SUBMIT_BO_READ 0x0001 #define MSM_SUBMIT_BO_READ 0x0001
#define MSM_SUBMIT_BO_WRITE 0x0002 #define MSM_SUBMIT_BO_WRITE 0x0002
#define MSM_SUBMIT_BO_DUMP 0x0004
#define MSM_SUBMIT_BO_FLAGS (MSM_SUBMIT_BO_READ | MSM_SUBMIT_BO_WRITE) #define MSM_SUBMIT_BO_FLAGS (MSM_SUBMIT_BO_READ | \
MSM_SUBMIT_BO_WRITE | \
MSM_SUBMIT_BO_DUMP)
struct drm_msm_gem_submit_bo { struct drm_msm_gem_submit_bo {
__u32 flags; /* in, mask of MSM_SUBMIT_BO_x */ __u32 flags; /* in, mask of MSM_SUBMIT_BO_x */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment