smmu_obj_create()

Updated: April 19, 2023

Create a SMMU object to which devices and their memory mappings can be added

Synopsis:

#include <smmu.h>

struct smmu_object *smmu_obj_create(unsigned flags);

Arguments:

flags
Always set this argument to SOCF_NONE (see smmu_obj_create_flags).

Library:

libsmmu.a

Description:

The smmu_obj_create() function creates a new SMMU object, to which the smmuman service can map memory regions with their access permissions, and attach devices.

All devices attached to a SMMU object share the same memory mappings and access permissions. Whenever you call a smmu_device_add_*() function to add a new device to a SMMU object, that device automatically receives the memory mappings and access permissions specified for that object.

Similarly, if you call smmu_mapping_add() to modify the memory mappings and/or access permissions associated with a SMMU object, your modifications will apply to all the devices attached to that object.

Thus, if your devices require access to different memory regions, or different access permissions to the same region or regions (e.g, one device needs to read, the other needs to write), you must create a SMMU object for each set of access permissions, then attach your devices to the appropriate objects.

Note:

Call smmu_obj_destroy() to destroy a SMMU object when you don't need it any more.

Destroy all SMMU objects you have created before calling smmu_fini() to terminate your connection to the smmuman service.

Returns:

NULL
Failure: errno is set.
non-NULL
Success: returns a pointer to the newly created SMMU object (smmu_object).