mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
For SMC mode, userspace is expected to use local indexing for accessing GPC/FBP specific perf registers where local indexing refers to indexes localized to a given SMC instance. H/W however expects logical id based indexing for these registers. Currently, nvgpu driver maintains a mapping between local <-> logical/physical ids of the GPCs for SMC specific configurations/instances. These register accesses are performed by the Debugger/Profiler interfaces and uses regops for read/writes. In their current state, regops simply validates register addresses and performs the required operation on them. These registers are currently indexed using local ids and there is a need to convert them to use logical ids for supporting SMC modes. For non-SMC case local ids are equivalent to logical ids and hence the conversion would have no effect on them. Following changes are added to facilitate the above conversion from local ids to logical ids in the regops path. 1) nvgpu_profiler_allowlist_range_search is modified to update a nvgpu_pm_resource_register_range_map entry instead of just the type. 2) added two APIs, one meant for profiler V2 based interfaces and the other for legacy profiler interface. The logic for legacy profiler interface extends into the more generic profiler V2 logic to help retain future compatibility. These APIs are added just after the validation stage for nvgpu_exec_regops. 3) The above APIs return an error if the local ids exceed the number of GPCs/FBPs for a particular instance. Bug 200712091 Signed-off-by: Debarshi Dutta <ddutta@nvidia.com> Change-Id: I060c2408a798f2f4e058aba266fa1ea9cebc2682 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2644956 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: Antony Clince Alex <aalex@nvidia.com> Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> GVS: Gerrit_Virtual_Submit