CXL_MMIO_MAP(3)

NAME
cxl_mmio_map - map the per-process Problem State Area of an AFU to memory

SYNOPSIS
#include <libcxl.h>

int cxl_mmio_map(struct cxl_afu_h *afu, __u32 flag);

DESCRIPTION
cxl_mmio_map() maps the per-process Problem State Area of afu to the current process memory, and declares AFU endianness according to flag. The size and contents of this area are specific each AFU. The size can be discovered with cxl_get_mmio_size().

In AFU directed mode, master contexts are allowed to map all of the MMIO space and slave contexts are allowed to only map the per process MMIO space associated with the context. In dedicated process mode the entire MMIO space can always be mapped.

The possible values of flag are:

CXL_MMIO_BIG_ENDIAN
    AFU data is big-endian

CXL_MMIO_LITTLE_ENDIAN
    AFU data is little-endian

CXL_MMIO_HOST_ENDIAN
    AFU uses the same endianness as host.

Subsequent cxl_mmio_read32(), cxl_mmio_read64(), cxl_mmio_write32() and cxl_mmio_write64() will honor flag and swap bytes on behalf of the application when required. Only 32 and 64-bit accesses are supported by POWER8 and POWER9.

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

ERRORS

EINVAL
    Invalid argument value, or AFU does not support MMIO space.

EIO AFU context is not attached.

ENODEV
    AFU not opened, or missing flags.

ENOMEM
    Insufficient memory.

FILES

/dev/cxl/afu<i>.<j>d
    AFU device in dedicated process mode.

/dev/cxl/afu<i>.<j>m
    AFU device in AFU directed mode, master context.

/dev/cxl/afu<i>.<j>s
    AFU device in AFU directed mode, slave context.

SEE ALSO
cxl(3), cxl_afu_attach(3), cxl_afu_attach_full(3), cxl_afu_attach_work(3), cxl_get_mmio_size(3), cxl_mmio_ptr(3), cxl_mmio_read32(3), cxl_mmio_read64(3), cxl_mmio_unmap(3), cxl_mmio_write32(3), cxl_mmio_write64(3), mmap(3)