diff options
author | Oded Gabbay <oded.gabbay@gmail.com> | 2019-02-16 00:39:24 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-02-18 09:46:46 +0100 |
commit | c216477363a37a7d0a388315a2eb6c1bd965bdb8 (patch) | |
tree | 908c21b4d3e5b7b1ac735f08a3bce586262d6030 /drivers/misc/habanalabs/command_submission.c | |
parent | d8dd7b0a81cc192ef5d30ec76ed6f6d35a1a7cf5 (diff) | |
download | linux-c216477363a37a7d0a388315a2eb6c1bd965bdb8.tar.bz2 |
habanalabs: add debugfs support
This patch adds debugfs support to the driver. It allows the user-space to
display information that is contained in the internal structures of the
driver, such as:
- active command submissions
- active user virtual memory mappings
- number of allocated command buffers
It also enables the user to perform reads and writes through Goya's PCI
bars.
Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/habanalabs/command_submission.c')
-rw-r--r-- | drivers/misc/habanalabs/command_submission.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/misc/habanalabs/command_submission.c b/drivers/misc/habanalabs/command_submission.c index ae68b97e428d..25ad9d805cfa 100644 --- a/drivers/misc/habanalabs/command_submission.c +++ b/drivers/misc/habanalabs/command_submission.c @@ -149,6 +149,8 @@ static void free_job(struct hl_device *hdev, struct hl_cs_job *job) list_del(&job->cs_node); spin_unlock(&cs->job_lock); + hl_debugfs_remove_job(hdev, job); + if (job->ext_queue) cs_put(cs); @@ -212,6 +214,12 @@ static void cs_do_release(struct kref *ref) } } + /* + * Must be called before hl_ctx_put because inside we use ctx to get + * the device + */ + hl_debugfs_remove_cs(cs); + hl_ctx_put(cs->ctx); if (cs->timedout) @@ -480,6 +488,8 @@ static int _hl_cs_ioctl(struct hl_fpriv *hpriv, void __user *chunks, *cs_seq = cs->sequence; + hl_debugfs_add_cs(cs); + /* Validate ALL the CS chunks before submitting the CS */ for (i = 0, parse_cnt = 0 ; i < num_chunks ; i++, parse_cnt++) { struct hl_cs_chunk *chunk = &cs_chunk_array[i]; @@ -528,6 +538,8 @@ static int _hl_cs_ioctl(struct hl_fpriv *hpriv, void __user *chunks, if (job->ext_queue) cs_get(cs); + hl_debugfs_add_job(hdev, job); + rc = cs_parser(hpriv, job); if (rc) { dev_err(hdev->dev, |