home | help
IBV_ALLO...NT_DOMAIN(3)  Libibverbs Programmer's Manual  IBV_ALLO...NT_DOMAIN(3)

NAME
     ibv_alloc_parent_domain(),  ibv_dealloc_pd()  - allocate and deallocate the
     parent domain object

SYNOPSIS
     #include <infiniband/verbs.h>

     struct ibv_pd *ibv_alloc_parent_domain(struct ibv_context *context, struct ibv_parent_domain_init_attr *attr);

DESCRIPTION
     ibv_alloc_parent_domain() allocates a parent domain object for the RDMA de-
     vice context context.

     The parent domain object extends the normal protection  domain  with  addi-
     tional objects, such as a thread domain.

     A	parent	domain is completely interchangeable with the struct ibv_pd used
     to create it, and can be used as an input argument to any function  accept-
     ing a struct ibv_pd.

     The  behavior  of each verb may be different if the verb is passed a parent
     domain struct ibv_pd that contains a struct ibv_td pointer.   For	instance
     the  verb	may  choose  to  share	resources between objects using the same
     thread domain. The exact behavior is provider dependent.

     The attr argument specifies the following:

     enum ibv_parent_domain_init_attr_mask {
	     IBV_PARENT_DOMAIN_INIT_ATTR_ALLOCATORS = 1 << 0,
	     IBV_PARENT_DOMAIN_INIT_ATTR_PD_CONTEXT = 1 << 1,
	     IBV_PARENT_DOMAIN_INIT_ATTR_ALLOW_CC_UNPROTECTED_ALLOC = 1 << 2,
     };

     struct ibv_parent_domain_init_attr {
	     struct ibv_pd *pd; /* reference to a protection domain, can't be NULL */
	     struct ibv_td *td; /* reference to a thread domain, or NULL */
	     uint32_t comp_mask;
	     void *(*alloc)(struct ibv_pd *pd, void *pd_context, size_t size,
			    size_t alignment, uint64_t resource_type);
	     void (*free)(struct ibv_pd *pd, void *pd_context, void *ptr,
			  uint64_t resource_type);
	     void *pd_context;
     };

     ibv_dealloc_pd() will deallocate the parent domain as  its  exposed  as  an
     ibv_pd  pd.   All	resources  created  with the parent domain should be de-
     stroyed prior to deallocating the parent domain.

ARGUMENTS
     pd Reference to the protection domain that this parent domain uses.

     td An optional thread domain that the parent domain uses.

     comp_mask Bit-mask of optional fields  in	the  ibv_parent_domain_init_attr
     struct.

     IBV_PARENT_DOMAIN_INIT_ATTR_ALLOW_CC_UNPROTECTED_ALLOC  When  set, allows a
     provider to allocate unprotected/shared memory for provider-managed buffers
     when running in a Confidential Computing (CoCo) guest on a device that  re-
     ports  IBV_DEVICE_CC_DMA_BOUNCE.	If the device does not report this flag,
     providers may continue to use plain memory. Applications opt  in  and  then
     allocate	 memory   through   ibv_alloc_buf()   and   register   it   with
     ibv_reg_buf_mr() or ibv_reg_mr_ex() with IBV_REG_MR_MASK_BUF.

     alloc Custom memory allocation function for this  parent  domain.	Provider
     memory  allocations  will	use this function to allocate the needed memory.
     The allocation function is passed the parent domain pd and the  user-speci-
     fied  context  pd_context.  In addition, the callback receives the size and
     the alignment of the  requested  buffer,  as  well  a  vendor-specific  re-
     source_type , which is derived from the rdma_driver_id enum (upper 32 bits)
     and  a  vendor specific resource code.  The function returns the pointer to
     the allocated buffer, or NULL to designate an error.  It  may  also  return
     IBV_ALLOCATOR_USE_DEFAULT	asking	the  callee to allocate the buffer using
     the default allocator.

     The callback makes sure the allocated buffer is initialized with zeros.  It
     is  also  the responsibility of the callback to make sure the memory cannot
     be COWed, e.g. by using madvise(MADV_DONTFORK) or by  allocating  anonymous
     shared memory.

     free Callback to free memory buffers that were allocated using a successful
     alloc().

     pd_context  A  pointer  for  additional user-specific data to be associated
     with this parent domain. The pointer is passed back to the custom allocator
     functions.

RETURN VALUE
     ibv_alloc_parent_domain() returns a pointer to the allocated struct  ibv_pd
     object,  or NULL if the request fails (and sets errno to indicate the fail-
     ure reason).

SEE ALSO
     ibv_alloc_parent_domain(3),  ibv_dealloc_pd(3),  ibv_alloc_pd(3),	 ibv_al-
     loc_td(3)

AUTHORS
     Alex Rosenbaum <alexr@mellanox.com>

     Yishai Hadas <yishaih@mellanox.com>

libibverbs			   2017-11-06		 IBV_ALLO...NT_DOMAIN(3)

home | help