From fcc66f9b906cb00633dd5bdc94eee6482a4215d6 Mon Sep 17 00:00:00 2001 From: Thomas Fleury Date: Thu, 6 Jun 2019 15:47:40 -0700 Subject: [PATCH] gpu: nvgpu: Add doxygen documentation in pbdma.h Add doxygen documentations in pbdma.h and also take care of setting pbdma_id to invalid value in case of failure in nvgpu_pbdma_find_for_runlist. Jira NVGPU-3591 Change-Id: I7aa7d55442cc7585c08fd6a54411cb22bc06ba30 Signed-off-by: Thomas Fleury Reviewed-on: https://git-master.nvidia.com/r/2131913 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra GVS: Gerrit_Virtual_Submit Tested-by: Seema Khowala Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/fifo/pbdma.c | 4 +-- drivers/gpu/nvgpu/include/nvgpu/pbdma.h | 37 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/common/fifo/pbdma.c b/drivers/gpu/nvgpu/common/fifo/pbdma.c index ccc167dba..c1aecdc00 100644 --- a/drivers/gpu/nvgpu/common/fifo/pbdma.c +++ b/drivers/gpu/nvgpu/common/fifo/pbdma.c @@ -29,10 +29,10 @@ bool nvgpu_pbdma_find_for_runlist(struct gk20a *g, struct nvgpu_fifo *f = &g->fifo; bool found_pbdma_for_runlist = false; u32 runlist_bit; - u32 id; + u32 id = U32_MAX; runlist_bit = BIT32(runlist_id); - for (id = 0; id < f->num_pbdma; id++) { + for (id = 0U; id < f->num_pbdma; id++) { if ((f->pbdma_map[id] & runlist_bit) != 0U) { nvgpu_log_info(g, "gr info: pbdma_map[%d]=%d", id, f->pbdma_map[id]); diff --git a/drivers/gpu/nvgpu/include/nvgpu/pbdma.h b/drivers/gpu/nvgpu/include/nvgpu/pbdma.h index 16228e489..5d3c316bf 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/pbdma.h +++ b/drivers/gpu/nvgpu/include/nvgpu/pbdma.h @@ -23,10 +23,47 @@ #ifndef NVGPU_PBDMA_COMMON_H #define NVGPU_PBDMA_COMMON_H +/** + * @file + * + * Push-Buffer DMA + * + * PBDMA unit fetches pushbuffer data from memory, generates + * commands, called "methods", from the fetched data, executes some of the + * generated methods itself, and sends the remainder of the methods to engines. + */ struct gk20a; +/** + * nvgpu_pbdma_setup_sw - initialize PBDMA software context + * + * @param g Current GPU + * + * Gets number of PBDMAs and builds a map of runlists that will be serviced + * by those PBDMAs. Returns non-zero value in case of failure. + */ int nvgpu_pbdma_setup_sw(struct gk20a *g); + +/** + * nvgpu_pbdma_cleanup_sw - clean up PBDMA software context + * + * @param g Current GPU + * + * Cleans up PBDMA software context and related resources. + */ void nvgpu_pbdma_cleanup_sw(struct gk20a *g); + +/** + * nvgpu_pbdma_find_for_runlist - find PBDMA servicing the runlist + * + * @param g Current GPU + * @param runlist_id Runlist identifier + * @param pbdma_id Pointer to PBDMA identifier + * + * Finds the PBDMA which is servicing #runlist_id. + * Sets #pbdma_id to valid value and returns true in case PBDMA could be found. + * Sets #pbdma_id to U32_MAX and returns false in case PBDMA could not be found. + */ bool nvgpu_pbdma_find_for_runlist(struct gk20a *g, u32 runlist_id, u32 *pbdma_id);