gpu: nvgpu: add profiler apis for resource reservation

Add two new functions to reserve/release PM resources :
nvgpu_prof_ioctl_reserve_pm_resource()
nvgpu_prof_ioctl_release_pm_resource()

Add ctxsw field to struct nvgpu_profiler_object to store per-resource
context switch enable flag.

Force resource reservation release while unbinding the context from
profiler object or while closing the profiler object. Add this code
in nvgpu_profiler_unbind_context() since both above paths will call
this function.

Bug 2510974
Jira NVGPU-5360

Change-Id: If334148e8df86360fba4162d1611187f3f04d01b
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2389654
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Deepak Nibade
2020-05-18 15:36:46 +05:30
committed by Alex Waterman
parent 7e99a68e34
commit 330cc7d0e5
4 changed files with 123 additions and 4 deletions

View File

@@ -1525,10 +1525,8 @@ struct nvgpu_profiler_bind_context_args {
__u32 reserved;
};
enum {
NVGPU_PROFILER_PM_RESOURCE_ARG_HWPM_LEGACY,
NVGPU_PROFILER_PM_RESOURCE_ARG_SMPC,
};
#define NVGPU_PROFILER_PM_RESOURCE_ARG_HWPM_LEGACY 0U
#define NVGPU_PROFILER_PM_RESOURCE_ARG_SMPC 1U
struct nvgpu_profiler_reserve_pm_resource_args {
__u32 resource; /* in: NVGPU_PROFILER_PM_RESOURCE_ARG_* resource to be reserved */