gpu: nvgpu: add profiler apis to manage PMA stream

Support new IOCTL to manage PMA stream meta data by adding below API
nvgpu_prof_ioctl_pma_stream_update_get_put()

Add nvgpu_perfbuf_update_get_put() to handle all the updates coming
from userspace and to pass all required information.

Add gops.perf.update_get_put() to handle all HW accesses required in
perf HW unit.

Add gops.perf.bind_mem_bytes_buffer_addr() to bind the available bytes
buffer while binding HWPM streamout.

Bug 2510974
Jira NVGPU-5360

Change-Id: Ibacc2299b845e47776babc081759dfc4afde34fe
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2406484
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Antony Clince Alex <aalex@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Deepak Nibade
2020-08-06 11:34:34 +05:30
committed by Alex Waterman
parent 5844151a93
commit 221475f753
11 changed files with 159 additions and 0 deletions

View File

@@ -648,6 +648,45 @@ static int nvgpu_prof_ioctl_exec_reg_ops(struct nvgpu_profiler_object_priv *priv
return err;
}
static int nvgpu_prof_ioctl_pma_stream_update_get_put(struct nvgpu_profiler_object *prof,
struct nvgpu_profiler_pma_stream_update_get_put_args *args)
{
bool update_bytes_available = args->flags &
NVGPU_PROFILER_PMA_STREAM_UPDATE_GET_PUT_ARG_FLAG_UPDATE_AVAILABLE_BYTES;
bool wait = args->flags &
NVGPU_PROFILER_PMA_STREAM_UPDATE_GET_PUT_ARG_FLAG_WAIT_FOR_UPDATE;
bool update_put_ptr = args->flags &
NVGPU_PROFILER_PMA_STREAM_UPDATE_GET_PUT_ARG_FLAG_RETURN_PUT_PTR;
struct gk20a *g = prof->g;
bool overflowed;
int err;
nvgpu_log(g, gpu_dbg_prof,
"Update PMA stream request %u: flags = 0x%x bytes_consumed=%llu",
prof->prof_handle, args->flags, args->bytes_consumed);
err = nvgpu_perfbuf_update_get_put(prof->g, args->bytes_consumed,
update_bytes_available ? &args->bytes_available : NULL,
prof->pma_bytes_available_buffer_cpuva, wait,
update_put_ptr ? &args->put_ptr : NULL,
&overflowed);
if (err != 0) {
return err;
}
if (overflowed) {
args->flags |=
NVGPU_PROFILER_PMA_STREAM_UPDATE_GET_PUT_ARG_FLAG_OVERFLOW_TRIGGERED;
}
nvgpu_log(g, gpu_dbg_prof,
"Update PMA stream request %u complete: flags = 0x%x"
"bytes_available=%llu put_ptr=%llu",
prof->prof_handle, args->flags, args->bytes_available, args->put_ptr);
return 0;
}
long nvgpu_prof_fops_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg)
{
@@ -720,6 +759,11 @@ long nvgpu_prof_fops_ioctl(struct file *filp, unsigned int cmd,
(struct nvgpu_profiler_exec_reg_ops_args *)buf);
break;
case NVGPU_PROFILER_IOCTL_PMA_STREAM_UPDATE_GET_PUT:
err = nvgpu_prof_ioctl_pma_stream_update_get_put(prof,
(struct nvgpu_profiler_pma_stream_update_get_put_args *)buf);
break;
default:
nvgpu_err(g, "unrecognized profiler ioctl cmd: 0x%x", cmd);
err = -ENOTTY;