Files
linux-nv-oot/drivers/misc/nvscic2c-pcie/iova-mngr.h
dbadgaiyan 4adc5c8fb4 drivers: misc: add nvscic2c-pcie in OOT
nvscic2c enables xfer between two SoC connected over PCIe.
nvscic2c already available with K5.10

Major changes in nvscic2c-pcie for K5.15:
 Integrate with upstream PCIe endpoint function changes.

 Allocate new IOVA domain to be used for
 empty IOVA allocation.
 This IOVA range would be used in iommu_map() to map
 physical backing with IOMMU domain attached in PCIe device.

 Migrate from nvhost to host1x and tegra-drm interfaces.

Bug 3739487
Jira C2C-826
Jira C2C-830

Change-Id: Ic4d8ac680921807fb17247855ca7037623681cb7
Signed-off-by: dbadgaiyan <dbadgaiyan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2810806
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-by: Arihant Jejani <ajejani@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-12-15 20:52:33 -08:00

73 lines
1.9 KiB
C

/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (c) 2021-2022, NVIDIA CORPORATION. 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 __IOVA_MNGR_H__
#define __IOVA_MNGR_H__
#include <linux/types.h>
/*
* iova_mngr_block_reserve
*
* Reserves a block from the free IOVA regions. Once reserved, the block
* is marked reserved and appended in the reserved list. Use
* iova_mngr_block_get_address to fetch the address of the block reserved.
*/
int
iova_mngr_block_reserve(void *mngr_handle, size_t size,
u64 *address, size_t *offset,
void **block_handle);
/*
* iova_mngr_block_release
*
* Release an already reserved IOVA block/chunk by the caller back to
* free list.
*/
int
iova_mngr_block_release(void *mngr_handle, void **block_handle);
/*
* iova_mngr_print
*
* DEBUG only.
*
* Helper function to print all the reserved and free blocks with
* their names, size and start address.
*/
void iova_mngr_print(void *handle);
/*
* iova_mngr_init
*
* Initialises the IOVA space manager with the base address + size
* provided. IOVA manager would use two lists for book-keeping reserved
* memory blocks and free memory blocks.
*
* When initialised all of the IOVA region: base_address + size is free.
*/
int
iova_mngr_init(char *name, u64 base_address, size_t size, void **mngr_handle);
/*
* iova_mngr_deinit
*
* deinitialize the IOVA space manager. Any blocks unreturned from the client
* (caller) shall become dangling.
*/
void
iova_mngr_deinit(void **handle);
#endif //__IOVA_MNGR_H__