Commit Graph

6 Commits

Author SHA1 Message Date
Vedashree Vidwans
14d527e97a tegra: hwpm: fix reported coverity violations
- Declare and initialize timeout and mem_bytes_kernel_u32 variables.
- alist_map NULL pointer check is done after alist_map structure
references. Modify update_allowlist ioctl and release alist_map
functions to check alist_map NULL pointer before it's use.
- Checking if unsigned _IOC_NR(cmd) is less than zero has no effect.
Remove this check.
- Correct printf format specifier for mem_bytes_addr.

Bug 3461002

Change-Id: I79a97942e667c173d112bcaafb14ddcb8dd7d47f
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2765676
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-08-29 05:16:22 -07:00
Vedashree Vidwans
486ec4a24c tegra: hwpm: create memory buffer structures
Stream and allowlist buffers are allocated by the user as dma buffers
and mapped in virtual address space by the driver. The DMA and mapping
functions are linux specific. Hence create memory management and
allowlist linux structures. Add these linux memory structure pointers in
the tegra_hwpm parent structure.

Jira THWPM-60

Change-Id: I2526f2bab835df4c5a922b0b375c22a6247aad30
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2729664
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-08-20 23:29:24 -07:00
Vedashree Vidwans
378bd9bb1c tegra: hwpm: move linux specific code to os folder
To make HWPM driver OS agnostic, remove linux specific includes from
common and chip specific files.
- Move IP register list related logic to os linux folder.
- tegra_hwpm_get_floorsweep_info() and tegra_hwpm_get_resource_info()
refer to linux specific UAPI structures. Relocate these functions to os
folder.
- Use tegra_hwpm_ip_ops structure in HWPM driver internal logic. Move
or rewrite functions using tegra_soc_hwpm_ip_ops.

Jira THWPM-59

Change-Id: I1dd1e088d59fdc44923d2b6502bb0cf350ce57a6
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2729471
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-08-20 23:29:18 -07:00
Vedashree Vidwans
221e73d921 tegra: hwpm: move mem_buf functions to os folder
PMA memory buffer functions use linux specific APIs for dma management.
In an effort to make HWPM driver OS agnostic, move the memory buffer
functions to os/linux path.

Jira THWPM-59

Change-Id: I3dbf577921faed579bbd9de3231b26a9acad28ba
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2738154
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-08-12 15:50:40 -07:00
Vedashree Vidwans
37dc9132f2 tegra: hwpm: add wrapper for kmem functions
APIs from kmem such as kzalloc, kcalloc and kfree are linux specific.
Add wrapper for these API calls and replace direct API usage in the
code.

Jira THWPM-59

Change-Id: I9cbd033756d1b6bc5a3781496dcb19508ba8f850
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2738153
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-08-12 15:50:33 -07:00
Vedashree Vidwans
4f1e352286 tegra: hwpm: rename source files
Shorten source file names by removing "tegra_hwpm" prefix. This will
make understanding the code more legible.

Jira THWPM-58

Change-Id: I39aac11c9f2a763a254b0605f9d96a7b0f372992
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2729469
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-08-12 15:50:20 -07:00