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

@@ -371,8 +371,7 @@ struct tegra_soc_hwpm_chip {
struct hwpm_ip_aperture *perfmux);
int (*disable_mem_mgmt)(struct tegra_soc_hwpm *hwpm);
int (*enable_mem_mgmt)(struct tegra_soc_hwpm *hwpm,
struct tegra_soc_hwpm_alloc_pma_stream *alloc_pma_stream);
int (*enable_mem_mgmt)(struct tegra_soc_hwpm *hwpm);
int (*invalidate_mem_config)(struct tegra_soc_hwpm *hwpm);
int (*stream_mem_bytes)(struct tegra_soc_hwpm *hwpm);
int (*disable_pma_streaming)(struct tegra_soc_hwpm *hwpm);
@@ -395,9 +394,11 @@ struct tegra_soc_hwpm_chip {
void (*release_sw_setup)(struct tegra_soc_hwpm *hwpm);
};
struct allowlist;
extern struct platform_device *tegra_soc_hwpm_pdev;
extern const struct file_operations tegra_soc_hwpm_ops;
struct allowlist;
struct tegra_hwpm_mem_mgmt;
struct tegra_hwpm_allowlist_map;
/* Driver struct */
struct tegra_soc_hwpm {
@@ -422,18 +423,12 @@ struct tegra_soc_hwpm {
struct reset_control *hwpm_rst;
/* Memory Management */
struct dma_buf *stream_dma_buf;
struct dma_buf_attachment *stream_attach;
struct sg_table *stream_sgt;
struct dma_buf *mem_bytes_dma_buf;
struct dma_buf_attachment *mem_bytes_attach;
struct sg_table *mem_bytes_sgt;
void *mem_bytes_kernel;
struct tegra_hwpm_mem_mgmt *mem_mgmt;
struct tegra_hwpm_allowlist_map *alist_map;
/* SW State */
bool bind_completed;
bool device_opened;
u64 full_alist_size;
atomic_t hwpm_in_use;

View File

@@ -0,0 +1,21 @@
/*
* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*/
#ifndef TEGRA_HWPM_MEM_MGMT_H
#define TEGRA_HWPM_MEM_MGMT_H
#ifdef __KERNEL__
#include <os/linux/mem_mgmt_utils.h>
#endif
#endif /* TEGRA_HWPM_MEM_MGMT_H */