Files
linux-hwpm/os/linux/mem_mgmt_utils.h
Vedashree Vidwans fb84554a97 tegra: hwpm: add missing ref to iosys-map.h
dma_bf_map is renamed to iosys_map for kernels > 5.18.
- Update mem_bytes map function to use iosys_map for kernel versions
greater than 5.18.
- Add missing reference to iosys-map.h to include iosys_map definition.

Bug 3733730

Change-Id: I37f981dd8b2aa0154d783c35a645ab8d3d9faa3b
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2784481
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Rohit Khanna <rokhanna@nvidia.com>
Reviewed-by: Shanker Donthineni <sdonthineni@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-10-04 05:19:06 -07:00

76 lines
2.3 KiB
C

/*
* 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_OS_LINUX_MEM_MGMT_UTILS_H
#define TEGRA_HWPM_OS_LINUX_MEM_MGMT_UTILS_H
#include <linux/types.h>
#if defined(CONFIG_TEGRA_HWPM_OOT)
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
#include <linux/iosys-map.h>
#else
#include <linux/dma-buf-map.h>
#endif
#endif
/* This macro is copy of TEGRA_SOC_HWPM_MEM_BYTES_INVALID */
#define TEGRA_HWPM_MEM_BYTES_INVALID 0xffffffff
struct tegra_soc_hwpm;
struct tegra_soc_hwpm_alloc_pma_stream;
struct tegra_soc_hwpm_update_get_put;
struct sg_table;
struct dma_buf;
struct dma_buf_attachment;
struct tegra_soc_hwpm_update_get_put;
struct tegra_hwpm_mem_mgmt {
struct sg_table *stream_sgt;
struct sg_table *mem_bytes_sgt;
struct dma_buf *stream_dma_buf;
struct dma_buf_attachment *stream_attach;
u64 stream_buf_size;
u64 stream_buf_va;
struct dma_buf *mem_bytes_dma_buf;
struct dma_buf_attachment *mem_bytes_attach;
u64 mem_bytes_buf_va;
void *mem_bytes_kernel;
#if defined(CONFIG_TEGRA_HWPM_OOT)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
struct iosys_map mem_bytes_map;
#else
struct dma_buf_map mem_bytes_map;
#endif
#endif
};
struct tegra_hwpm_allowlist_map {
u64 full_alist_size;
u64 num_pages;
struct page **pages;
void *full_alist_map;
};
int tegra_hwpm_map_stream_buffer(struct tegra_soc_hwpm *hwpm,
struct tegra_soc_hwpm_alloc_pma_stream *alloc_pma_stream);
int tegra_hwpm_clear_mem_pipeline(struct tegra_soc_hwpm *hwpm);
int tegra_hwpm_update_mem_bytes(struct tegra_soc_hwpm *hwpm,
struct tegra_soc_hwpm_update_get_put *update_get_put);
int tegra_hwpm_map_update_allowlist(struct tegra_soc_hwpm *hwpm,
void *ioctl_struct);
void tegra_hwpm_release_alist_map(struct tegra_soc_hwpm *hwpm);
void tegra_hwpm_release_mem_mgmt(struct tegra_soc_hwpm *hwpm);
#endif /* TEGRA_HWPM_OS_LINUX_MEM_MGMT_UTILS_H */