mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 02:22:34 +03:00
With recent rework in nvgpu most of the <uapi/linux/nvgpu.h> includes are not needed so remove them Remove use of NVGPU_DBG_GPU_REG_OP_* in gk20a/gr_gk20a.c and use common definition instead Remove use of NVGPU_ALLOC_GPFIFO_FLAGS_REPLAYABLE_FAULTS_ENABLE in gp10b/fifo_gp10b.c by defining new common flag NVGPU_GPFIFO_FLAGS_REPLAYABLE_FAULTS_ENABLE and then parsing it in API nvgpu_gpfifo_user_flags_to_common_flags() Jira NVGPU-363 Change-Id: I8e653275ea3f443f24be7284d54f2115636aba3f Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1606108 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
98 lines
3.0 KiB
C
98 lines
3.0 KiB
C
/*
|
|
* Tegra GV11B GPU Debugger/Profiler Driver
|
|
*
|
|
* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
* to deal in the Software without restriction, including without limitation
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
* DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
#include <nvgpu/log.h>
|
|
#include "gk20a/gk20a.h"
|
|
#include <nvgpu/hw/gv11b/hw_perf_gv11b.h>
|
|
|
|
int gv11b_perfbuf_enable_locked(struct gk20a *g, u64 offset, u32 size)
|
|
{
|
|
struct mm_gk20a *mm = &g->mm;
|
|
u32 virt_addr_lo;
|
|
u32 virt_addr_hi;
|
|
u32 inst_pa_page;
|
|
int err;
|
|
|
|
gk20a_dbg(gpu_dbg_fn | gpu_dbg_gpu_dbg, "");
|
|
err = gk20a_busy(g);
|
|
if (err) {
|
|
nvgpu_err(g, "failed to poweron");
|
|
return err;
|
|
}
|
|
|
|
err = gk20a_alloc_inst_block(g, &mm->perfbuf.inst_block);
|
|
if (err)
|
|
return err;
|
|
|
|
g->ops.mm.init_inst_block(&mm->perfbuf.inst_block, mm->perfbuf.vm, 0);
|
|
|
|
virt_addr_lo = u64_lo32(offset);
|
|
virt_addr_hi = u64_hi32(offset);
|
|
|
|
gk20a_writel(g, perf_pmasys_outbase_r(), virt_addr_lo);
|
|
gk20a_writel(g, perf_pmasys_outbaseupper_r(),
|
|
perf_pmasys_outbaseupper_ptr_f(virt_addr_hi));
|
|
gk20a_writel(g, perf_pmasys_outsize_r(), size);
|
|
|
|
/* this field is aligned to 4K */
|
|
inst_pa_page = nvgpu_inst_block_addr(g, &mm->perfbuf.inst_block) >> 12;
|
|
|
|
gk20a_writel(g, perf_pmasys_mem_block_r(),
|
|
perf_pmasys_mem_block_base_f(inst_pa_page) |
|
|
perf_pmasys_mem_block_valid_true_f() |
|
|
nvgpu_aperture_mask(g, &mm->perfbuf.inst_block,
|
|
+ perf_pmasys_mem_block_target_sys_ncoh_f(),
|
|
+ perf_pmasys_mem_block_target_lfb_f()));
|
|
|
|
gk20a_idle(g);
|
|
return 0;
|
|
}
|
|
|
|
/* must be called with dbg_sessions_lock held */
|
|
int gv11b_perfbuf_disable_locked(struct gk20a *g)
|
|
{
|
|
int err;
|
|
|
|
gk20a_dbg(gpu_dbg_fn | gpu_dbg_gpu_dbg, "");
|
|
err = gk20a_busy(g);
|
|
if (err) {
|
|
nvgpu_err(g, "failed to poweron");
|
|
return err;
|
|
}
|
|
|
|
gk20a_writel(g, perf_pmasys_outbase_r(), 0);
|
|
gk20a_writel(g, perf_pmasys_outbaseupper_r(),
|
|
perf_pmasys_outbaseupper_ptr_f(0));
|
|
gk20a_writel(g, perf_pmasys_outsize_r(), 0);
|
|
|
|
gk20a_writel(g, perf_pmasys_mem_block_r(),
|
|
perf_pmasys_mem_block_base_f(0) |
|
|
perf_pmasys_mem_block_valid_false_f() |
|
|
perf_pmasys_mem_block_target_f(0));
|
|
|
|
gk20a_idle(g);
|
|
|
|
return 0;
|
|
}
|