Add a memory mapping to or remove a memory mapping from a SMMU object
#include <smmu.h> int smmu_mapping_add(struct smmu_object *sop, unsigned flags, pid_t pid, unsigned num_entries, const struct smmu_map_entry *entries, _Uint64t target);
The smmu_mapping_add() function adds or removes memory regions that DMA devices are allowed to access. Any DMA device attached to the SMMU object modified by this function will get access to the newly added memory region or regions, in addition to the memory regions already specified in the startup configuration (see Configuring smmuman in the smmuman chapter).
To remove memory region mappings, call smmu_mapping_add() without specifying any of the SMF_READ, SMF_WRITE, or SMF_EXEC permissions for the flags argument (i.e., the flags argument set to SMF_NONE; see smmu_mapping_flags).
The smmuman service doesn't impose page alignment for the starting address and the length of the allowed memory region. Such restrictions are dictated by the hardware requirements and implemented in the architecture-specific and board-specific support libraries (smmu-*.so).
With the currently supported IOMMU/SMMUs, these libraries round the starting address down and the length up to 4K page boundaries. Future IOMMU/SMMU hardware support code may implement support for different hardware requirements.