xref: /freebsd/sys/dev/qat/qat_api/include/icp_sal_iommu.h (revision 094517119c62c23369d545a7475ae982d86330a3)
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright(c) 2007-2022 Intel Corporation */
3 /* $FreeBSD$ */
4 /**
5  ***************************************************************************
6  * @file icp_sal_iommu.h
7  *
8  * @ingroup SalUser
9  *
10  * Sal iommu wrapper functions.
11  *
12  ***************************************************************************/
13 
14 #ifndef ICP_SAL_IOMMU_H
15 #define ICP_SAL_IOMMU_H
16 
17 /*************************************************************************
18   * @ingroup Sal
19   * @description
20   *   Function returns page_size rounded size for iommu remapping
21   *
22   * @assumptions
23   *      None
24   * @sideEffects
25   *      None
26   * @reentrant
27   *      No
28   * @threadSafe
29   *      No
30   *
31   * @param[in] size           Minimum required size.
32   *
33   * @retval    page_size rounded size for iommu remapping.
34   *
35   *************************************************************************/
36 size_t icp_sal_iommu_get_remap_size(size_t size);
37 
38 /*************************************************************************
39   * @ingroup Sal
40   * @description
41   *   Function adds an entry into iommu remapping table
42   *
43   * @assumptions
44   *      None
45   * @sideEffects
46   *      None
47   * @reentrant
48   *      No
49   * @threadSafe
50   *      No
51   *
52   * @param[in] phaddr         Host physical address.
53   * @param[in] iova           Guest physical address.
54   * @param[in] size           Size of the remapped region.
55   *
56   * @retval CPA_STATUS_SUCCESS        No error
57   * @retval CPA_STATUS_FAIL           Operation failed
58   *
59   *************************************************************************/
60 CpaStatus icp_sal_iommu_map(Cpa64U phaddr, Cpa64U iova, size_t size);
61 
62 /*************************************************************************
63   * @ingroup Sal
64   * @description
65   *   Function removes an entry from iommu remapping table
66   *
67   * @assumptions
68   *      None
69   * @sideEffects
70   *      None
71   * @reentrant
72   *      No
73   * @threadSafe
74   *      No
75   *
76   * @param[in] iova           Guest physical address to be removed.
77   * @param[in] size           Size of the remapped region.
78   *
79   * @retval CPA_STATUS_SUCCESS        No error
80   * @retval CPA_STATUS_FAIL           Operation failed
81   *
82   *************************************************************************/
83 CpaStatus icp_sal_iommu_unmap(Cpa64U iova, size_t size);
84 #endif
85