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>
This commit is contained in:
Vedashree Vidwans
2022-06-15 22:08:47 -07:00
committed by mobile promotions
parent 378bd9bb1c
commit 486ec4a24c
13 changed files with 256 additions and 147 deletions

View File

@@ -15,13 +15,14 @@
#include <tegra_hwpm_log.h>
#include <tegra_hwpm_kmem.h>
#include <tegra_hwpm_common.h>
#include <tegra_hwpm_mem_mgmt.h>
#include <tegra_hwpm_static_analysis.h>
int tegra_hwpm_get_allowlist_size(struct tegra_soc_hwpm *hwpm)
{
int ret = 0;
hwpm->full_alist_size = 0ULL;
hwpm->alist_map->full_alist_size = 0ULL;
tegra_hwpm_fn(hwpm, " ");
@@ -51,11 +52,12 @@ int tegra_hwpm_combine_alist(struct tegra_soc_hwpm *hwpm, u64 *alist)
return err;
}
/* Check size of full alist with hwpm->full_alist_size*/
if (func_args.full_alist_idx != hwpm->full_alist_size) {
/* Check size of full alist with hwpm->alist_map->full_alist_size*/
if (func_args.full_alist_idx != hwpm->alist_map->full_alist_size) {
tegra_hwpm_err(hwpm, "full_alist_size 0x%llx doesn't match "
"max full_alist_idx 0x%llx",
hwpm->full_alist_size, func_args.full_alist_idx);
hwpm->alist_map->full_alist_size,
func_args.full_alist_idx);
err = -EINVAL;
}

View File

@@ -12,6 +12,7 @@
*/
#include <tegra_hwpm_static_analysis.h>
#include <tegra_hwpm_mem_mgmt.h>
#include <tegra_hwpm_aperture.h>
#include <tegra_hwpm_common.h>
#include <tegra_hwpm_kmem.h>
@@ -269,8 +270,10 @@ static int tegra_hwpm_func_single_element(struct tegra_soc_hwpm *hwpm,
return 0;
}
if (element->alist) {
hwpm->full_alist_size = tegra_hwpm_safe_add_u64(
hwpm->full_alist_size, element->alist_size);
hwpm->alist_map->full_alist_size =
tegra_hwpm_safe_add_u64(
hwpm->alist_map->full_alist_size,
element->alist_size);
} else {
tegra_hwpm_err(hwpm, "IP %d"
" element type %d static_idx %d NULL alist",

View File

@@ -11,12 +11,13 @@
* more details.
*/
#include <tegra_hwpm_mem_mgmt.h>
#include <tegra_hwpm_common.h>
#include <tegra_hwpm_kmem.h>
#include <tegra_hwpm_log.h>
#include <tegra_hwpm_io.h>
#include <tegra_hwpm_ip.h>
#include <tegra_hwpm.h>
#include <tegra_hwpm_common.h>
#include <hal/t234/t234_init.h>
#ifdef CONFIG_TEGRA_NEXT1_HWPM
@@ -139,7 +140,7 @@ int tegra_hwpm_setup_sw(struct tegra_soc_hwpm *hwpm)
/* Initialize SW state */
hwpm->bind_completed = false;
hwpm->full_alist_size = 0;
hwpm->alist_map->full_alist_size = 0;
return 0;
}