gpu: nvgpu: add profiler api to execute regops

Implement new API nvgpu_prof_ioctl_exec_reg_ops() to support regops on
new profiler objects.

Add two new staging buffers to hold regops copied from userspace, and
to convert and execute regops in common code.
Buffers are allocated and released along with the profiler object.

New API will implements this :
-  copy regops data in chunks of 4K from userspace
- store them in staging buffer
- convert the new regop struct into common regop struct and also
  copy the content into second staging buffer
- trigger gops.regops.exec_regops() with second staging buffer as
  operation pointer
- convert common regop struct back into new regop struct and copy
  back to userspace

Export bunch of helper functions from ioctl_dbg.h. e.g.
nvgpu_get_regops_op_values_common()

Update regop execution code to skip regop execution if regop status
is not valid. This is only possible when userspace requests for
CONTINUE_ON_ERROR mode.

Add more documentation to some of the fields in UAPI header.

Note that maximum atomic operations reported by new API are same
as legacy API and are incorrect. This will be fixed up in upcoming
patches.

Bug 2510974
Jira NVGPU-5360

Change-Id: I9f82052b22143aec33f6e778c0784386744b699e
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2394208
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Deepak Nibade
2020-07-29 13:20:38 +05:30
committed by Alex Waterman
parent a439d3767d
commit 2012a6b558
6 changed files with 276 additions and 13 deletions

View File

@@ -579,7 +579,7 @@ static int dbg_unbind_all_channels_gk20a(struct dbg_session_gk20a *dbg_s)
* Convert common regops op values of the form of NVGPU_DBG_REG_OP_*
* into linux regops op values of the form of NVGPU_DBG_GPU_REG_OP_*
*/
static u32 nvgpu_get_regops_op_values_linux(u32 regops_op)
u32 nvgpu_get_regops_op_values_linux(u32 regops_op)
{
switch (regops_op) {
case REGOP(READ_32):
@@ -603,7 +603,7 @@ static u32 nvgpu_get_regops_op_values_linux(u32 regops_op)
* Convert linux regops op values of the form of NVGPU_DBG_GPU_REG_OP_*
* into common regops op values of the form of NVGPU_DBG_REG_OP_*
*/
static u32 nvgpu_get_regops_op_values_common(u32 regops_op)
u32 nvgpu_get_regops_op_values_common(u32 regops_op)
{
switch (regops_op) {
case REGOP_LINUX(READ_32):
@@ -679,7 +679,7 @@ static u32 nvgpu_get_regops_type_values_common(u32 regops_type)
* Convert common regops status values of the form of NVGPU_DBG_REG_OP_STATUS_*
* into linux regops type values of the form of NVGPU_DBG_GPU_REG_OP_STATUS_*
*/
static u32 nvgpu_get_regops_status_values_linux(u32 regops_status)
u32 nvgpu_get_regops_status_values_linux(u32 regops_status)
{
switch (regops_status) {
case REGOP(STATUS_SUCCESS):
@@ -703,7 +703,7 @@ static u32 nvgpu_get_regops_status_values_linux(u32 regops_status)
* Convert linux regops status values of the form of NVGPU_DBG_GPU_REG_OP_STATUS_*
* into common regops type values of the form of NVGPU_DBG_REG_OP_STATUS_*
*/
static u32 nvgpu_get_regops_status_values_common(u32 regops_status)
u32 nvgpu_get_regops_status_values_common(u32 regops_status)
{
switch (regops_status) {
case REGOP_LINUX(STATUS_SUCCESS):