Scroll to navigation

CXL_AFU_ATTACH_WORK(3) CXL Programmer's Manual CXL_AFU_ATTACH_WORK(3)

NAME

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

SYNOPSIS

#include <libcxl.h>

int cxl_afu_attach_work(struct cxl_afu_h *afu, struct cxl_ioctl_start_work *work);

DESCRIPTION

cxl_afu_attach_work() attaches a context of afu to the current process, specifying various parameters via the work structure, 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.

Four parameters can be set in the work structure:

cxl_work_set_wed() sets the work element descriptor, 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.

cxl_work_set_num_irqs() requests a number of userspace interrupts, in the range defined by cxl_get_irqs_min() and cxl_get_irqs_max(). A negative value specifies that cxl_afu_attach_work() should allocate the minimum number of interrupts required by an AFU context, returned by cxl_get_irqs_min().

cxl_work_set_amr() sets the authority mask register (same as the powerpc AMR). A null value indicates that the authority mask register should not be set.

cxl_work_enable_wait() indicates that the thread that will attach an AFU context requires to be able to wait and be notified by the AFU with cxl_afu_host_thread_wait().

RETURN VALUE

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

ERRORS

Invalid argument value, or AFU not opened.
Not enough memory.
Not enough interrupts available.

SEE ALSO

cxl(3), cxl_afu_attach(3), cxl_afu_attach_full(3), cxl_afu_fd_to_h(3), cxl_afu_free(3), cxl_afu_host_thread_wait(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_irqs_max(3), cxl_set_mode(3), cxl_set_prefault_mode(3), cxl_work_alloc(3), cxl_work_disable_wait(3), cxl_work_enable_wait(3), cxl_work_free(3), cxl_work_get_amr(3), cxl_work_get_num_irqs(3), cxl_work_get_tid(3), cxl_work_get_wed(3), cxl_work_set_amr(3), cxl_work_set_num_irqs(3), cxl_work_set_wed(3)

2018-02-13 LIBCXL 1.5