gpu: nvgpu: PMU debug init update

Moved allocation/free of debug buffer required for PMU RTOS
debug messages dump to PMU debug unit & will be called as
part of sw_setup/deinit stage of PMU.

JIRA NVGPU-1972

Change-Id: I4ac5f8d464548e7771fcd2a17998ff4028ea928b
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2110153
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ramesh Mylavarapu <rmylavarapu@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Mahantesh Kumbar
2019-04-26 10:40:34 +05:30
committed by mobile promotions
parent 63ea167052
commit d19be32f91
3 changed files with 31 additions and 3 deletions

View File

@@ -180,10 +180,9 @@ static int nvgpu_init_pmu_setup_sw(struct gk20a *g)
}
}
err = nvgpu_dma_alloc_map(vm, GK20A_PMU_TRACE_BUFSIZE,
&pmu->trace_buf);
/* alloc shared buffer to read PMU-RTOS debug message */
err = nvgpu_pmu_debug_init(g, pmu);
if (err != 0) {
nvgpu_err(g, "failed to allocate pmu trace buffer\n");
goto err_free_super_surface;
}
@@ -337,6 +336,7 @@ static void nvgpu_remove_pmu_support(struct nvgpu_pmu *pmu)
nvgpu_pmu_super_surface_deinit(g, pmu, pmu->super_surface);
}
nvgpu_pmu_debug_deinit(g, pmu);
nvgpu_pmu_lsfm_deinit(g, pmu, pmu->lsfm);
nvgpu_pmu_pg_deinit(g, pmu, pmu->pg);

View File

@@ -23,6 +23,7 @@
#include <nvgpu/pmu.h>
#include <nvgpu/gk20a.h>
#include <nvgpu/pmu/fw.h>
#include <nvgpu/dma.h>
bool nvgpu_find_hex_in_string(char *strings, struct gk20a *g, u32 *hex_pos)
{
@@ -111,3 +112,28 @@ void nvgpu_pmu_dump_falcon_stats(struct nvgpu_pmu *pmu)
/* PMU may crash due to FECS crash. Dump FECS status */
g->ops.gr.falcon.dump_stats(g);
}
int nvgpu_pmu_debug_init(struct gk20a *g, struct nvgpu_pmu *pmu)
{
struct mm_gk20a *mm = &g->mm;
struct vm_gk20a *vm = mm->pmu.vm;
int err = 0;
err = nvgpu_dma_alloc_map(vm, GK20A_PMU_TRACE_BUFSIZE,
&pmu->trace_buf);
if (err != 0) {
nvgpu_err(g, "failed to allocate pmu trace buffer\n");
}
return err;
}
void nvgpu_pmu_debug_deinit(struct gk20a *g, struct nvgpu_pmu *pmu)
{
struct mm_gk20a *mm = &g->mm;
struct vm_gk20a *vm = mm->pmu.vm;
if (nvgpu_mem_is_valid(&pmu->trace_buf)) {
nvgpu_dma_unmap_free(vm, &pmu->trace_buf);
}
}

View File

@@ -204,6 +204,8 @@ int nvgpu_pmu_reset(struct gk20a *g);
/* PMU debug */
void nvgpu_pmu_dump_falcon_stats(struct nvgpu_pmu *pmu);
bool nvgpu_find_hex_in_string(char *strings, struct gk20a *g, u32 *hex_pos);
int nvgpu_pmu_debug_init(struct gk20a *g, struct nvgpu_pmu *pmu);
void nvgpu_pmu_debug_deinit(struct gk20a *g, struct nvgpu_pmu *pmu);
struct gk20a *gk20a_from_pmu(struct nvgpu_pmu *pmu);