smmu_device_add_mmio()

Add an MMIO device to a SMMU object, or remove it

Synopsis:

#include <smmu.h>

int smmu_device_add_mmio(struct smmu_object *const sop,
                                _Uint64t const phys,
                                unsigned const len);

Arguments:

sop
Pointer to the SMMU object to which the device will be attached, or NULL to remove the device from any SMMU objects owned by the current client.
phys
The physical address of the device to be attached to or removed from a SMMU object.
len
The number of bytes for device registers.

Library:

libsmmu.a

Description:

The smmu_device_add_mmio() function is a convenience function. It calls smmu_device_add_generic() to add a Memory-Mapped I/O (MMIO) device to a SMMU object.

To remove an MMIO device from SMMU objects, call this function with the sop argument set to NULL.

Returns:

-1
Failure: errno is set.
EBUSY
Failure when attempting to add to a SMMU object a DMA device that is owned by another smmuman client.
ENOENT

Failure: when attempting to:

  • add a device – the smmuman service doesn't know which IOMMU/SMMU unit controls the device being added
  • remove a device – the smmuman client making the call doesn't own the SMMU object to which the device is attached
0
Success
+1
Success, but the client must call smmu_mapping_add() to reissue the memory mappings for this object (see Preferred sequence for adding memory mappings and devices for more information about why memory mappings may need to be reissued).