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