.\" Copyright 2015-2018 IBM Corp. .\" .TH CXL_AFU_ATTACH_WORK 3 2018-02-13 "LIBCXL 1.5" "CXL Programmer's Manual" .SH NAME cxl_afu_attach_work \- attach the calling process's memory to an open AFU .SH SYNOPSIS .B #include .PP .B "int cxl_afu_attach_work(struct cxl_afu_h" .BI * afu ", struct cxl_ioctl_start_work *" work ); .SH DESCRIPTION .BR cxl_afu_attach_work () attaches a context of .I afu to the current process, specifying various parameters via the .I work structure, and starts the AFU context. .PP 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. .PP Four parameters can be set in the .I work structure: .PP .BR 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. .PP .BR cxl_work_set_num_irqs () requests a number of userspace interrupts, in the range defined by .BR cxl_get_irqs_min () and .BR cxl_get_irqs_max (). A negative value specifies that .BR cxl_afu_attach_work () should allocate the minimum number of interrupts required by an AFU context, returned by .BR cxl_get_irqs_min (). .PP .BR 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. .PP .BR 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 .BR cxl_afu_host_thread_wait (). .SH RETURN VALUE On success, 0 is returned. On error, \-1 is returned and .I errno is set appropriately. .SH ERRORS .TP .B EINVAL Invalid argument value, or AFU not opened. .TP .B ENOMEM Not enough memory. .TP .B ENOSPC Not enough interrupts available. .SH SEE ALSO .BR cxl (3), .BR cxl_afu_attach (3), .BR cxl_afu_attach_full (3), .BR cxl_afu_fd_to_h (3), .BR cxl_afu_free (3), .BR cxl_afu_host_thread_wait(3), .BR cxl_afu_open_dev (3), .BR cxl_afu_opened (3), .BR cxl_get_irqs_max (3), .BR cxl_get_irqs_min (3), .BR cxl_get_prefault_mode (3), .BR cxl_mmio_map (3), .BR cxl_set_irqs_max (3), .BR cxl_set_mode (3), .BR cxl_set_prefault_mode (3), .BR cxl_work_alloc (3), .BR cxl_work_disable_wait (3), .BR cxl_work_enable_wait (3), .BR cxl_work_free (3), .BR cxl_work_get_amr (3), .BR cxl_work_get_num_irqs (3), .BR cxl_work_get_tid (3), .BR cxl_work_get_wed (3), .BR cxl_work_set_amr (3), .BR cxl_work_set_num_irqs (3), .BR cxl_work_set_wed (3)