smmu_mapping_add()

Add a memory mapping to or remove a memory mapping from a SMMU object

Synopsis:

#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);

Arguments:

sop
A pointer to the SMMU object to be modified with new mappings.
flags
Flags that determine the permissions of memory regions mapped to SMMU objects (see smmu_mapping_flags).
pid
For future use.
num_entries
The number of mappings to add to or remove from the SMMU object.
entries
An array with the mapping entries to add to or remove from the SMMU object.
target
Set to 0 (zero). Ignored unless SMF_TARGET is set. Currently only the QNX Hypervisor should set SMF_TARGET (see smmu_mapping_flags).

Library:

libsmmu.a

Description:

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).

Note:

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.

Returns:

-1
Failure: errno is set.
≥0
Success.