CXL_AFU_ATTACH(3)

NAME
cxl_afu_attach - attach the calling process's memory to an open AFU

SYNOPSIS
#include <libcxl.h>

int cxl_afu_attach(struct cxl_afu_h *afu, __u64 wed);

DESCRIPTION
cxl_afu_attach() attaches a context of afu to the current process, specifies wed as the initial work element descriptor, and starts the AFU context.

On success, all memory mapped into this process is accessible to the AFU context using the same effective addresses. No additional calls are required to map/unmap memory. The AFU memory context will be updated as userspace allocates and frees memory.

The work element descriptor is a 64-bit argument defined by the AFU. Typically this is an effective address pointing to an AFU specific structure describing what work to perform.

The minimum number of userspace interrupts required by the AFU will be allocated. This value is returned by cxl_get_irqs_min().

RETURN VALUE
On success, 0 is returned. On error, -1 is returned and errno is set appropriately.

ERRORS

EINVAL
    Invalid argument value, or AFU not opened.

ENOMEM
    Not enough memory.

ENOSPC
    Not enough interrupts available.

SEE ALSO
cxl(3), cxl_afu_attach_full(3), cxl_afu_attach_work(3), cxl_afu_fd_to_h(3), cxl_afu_free(3), cxl_afu_open_dev(3), cxl_afu_opened(3), cxl_get_irqs_max(3), cxl_get_irqs_min(3), cxl_get_prefault_mode(3), cxl_mmio_map(3), cxl_set_mode(3), cxl_set_prefault_mode(3)