Files
linux-nv-oot/drivers/misc/nvscic2c-pcie/iova-alloc.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

49 lines
1.5 KiB
C

/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (c) 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_ALLOC_H__
#define __IOVA_ALLOC_H__
#include <linux/device.h>
#include <linux/iova.h>
struct iova_alloc_domain_t;
/*
* iova_alloc_init
*
* With NvSciC2c usecase IOVA range needs to be allocated without
* physical backing. Existing DMA API framework does not allow this.
* Hence allocate new IOVA domain to allocate IOVA range.
*
* Allocate IOVA range using new IOVA domain.
* Use this IOVA range in iommu_map() with existing IOMMU domain.
*/
int
iova_alloc_init(struct device *dev, size_t size, dma_addr_t *dma_handle,
struct iova_alloc_domain_t **ivd_h);
/*
* iova_alloc_deinit
*
* Free IOVA range allocated using iova_alloc_init.
* Client needs to make sure that if physical mapping was created
* then it is released before calling iova_alloc_deinit.
* Release IOVA domain allocated in iova_alloc_init.
*/
void
iova_alloc_deinit(dma_addr_t dma_handle, size_t size,
struct iova_alloc_domain_t **ivd_h);
#endif //__IOVA_ALLOC_H__