09 Aug, 2016

1 commit

  • This patch fixes a regression introduced by commit b810253bd934 ("cxl:
    Add mechanism for delivering AFU driver specific events").

    It changes the type u8 to __u8 in the uapi header cxl.h, because the
    former is a kernel internal type, and may not be defined in userland
    build environments, in particular when cross-compiling libcxl on x86_64
    linux machines (RHEL6.7 and Ubuntu 16.04).

    This patch also changes the size of the field data_size, and makes it
    constant, to support 32-bit userland applications running on big-endian
    ppc64 kernels transparently.

    mpe: This is an ABI change, however the ABI was only added during the
    4.8 merge window so has never been part of a released kernel - therefore
    we give ourselves permission to change it.

    Fixes: b810253bd934 ("cxl: Add mechanism for delivering AFU driver specific events")
    Signed-off-by: Philippe Bergheaud
    Reviewed-by: Frederic Barrat
    Signed-off-by: Michael Ellerman

    Philippe Bergheaud
     

28 Jun, 2016

1 commit

  • This adds an afu_driver_ops structure with fetch_event() and
    event_delivered() callbacks. An AFU driver such as cxlflash can fill
    this out and associate it with a context to enable passing custom AFU
    specific events to userspace.

    This also adds a new kernel API function cxl_context_pending_events(),
    that the AFU driver can use to notify the cxl driver that new specific
    events are ready to be delivered, and wake up anyone waiting on the
    context wait queue.

    The current count of AFU driver specific events is stored in the field
    afu_driver_events of the context structure.

    The cxl driver checks the afu_driver_events count during poll, select,
    read, etc. calls to check if an AFU driver specific event is pending,
    and calls fetch_event() to obtain and deliver that event. This way, the
    cxl driver takes care of all the usual locking semantics around these
    calls and handles all the generic cxl events, so that the AFU driver
    only needs to worry about it's own events.

    fetch_event() return a struct cxl_event_afu_driver_reserved, allocated
    by the AFU driver, and filled in with the specific event information and
    size. Total event size (header + data) should not be greater than
    CXL_READ_MIN_SIZE (4K).

    Th cxl driver prepends an appropriate cxl event header, copies the event
    to userspace, and finally calls event_delivered() to return the status of
    the operation to the AFU driver. The event is identified by the context
    and cxl_event_afu_driver_reserved pointers.

    Since AFU drivers provide their own means for userspace to obtain the
    AFU file descriptor (i.e. cxlflash uses an ioctl on their scsi file
    descriptor to obtain the AFU file descriptor) and the generic cxl driver
    will never use this event, the ABI of the event is up to each individual
    AFU driver.

    Signed-off-by: Philippe Bergheaud
    Signed-off-by: Michael Ellerman

    Philippe Bergheaud
     

09 Mar, 2016

1 commit

  • The new flash.c file contains the logic to flash a new image on the
    adapter, through a hcall. It is an iterative process, with chunks of
    data of 1M at a time. There are also 2 phases: write and verify. The
    flash operation itself is driven from a user-land tool.
    Once flashing is successful, an rtas call is made to update the device
    tree with the new properties values for the adapter and the AFU(s)

    Add a new char device for the adapter, so that the flash tool can
    access the card, even if there is no valid AFU on it.

    Co-authored-by: Frederic Barrat
    Signed-off-by: Frederic Barrat
    Signed-off-by: Christophe Lombard
    Reviewed-by: Manoj Kumar
    Acked-by: Ian Munsie
    Signed-off-by: Michael Ellerman

    Christophe Lombard
     

18 Aug, 2015

1 commit

  • userspace programs using cxl currently have to use two strategies for
    dealing with MMIO errors simultaneously. They have to check every read
    for a return of all Fs in case the adapter has gone away and the kernel
    has not yet noticed, and they have to deal with SIGBUS in case the
    kernel has already noticed, invalidated the mapping and marked the
    context as failed.

    In order to simplify things, this patch adds an alternative approach
    where the kernel will return a page filled with Fs instead of delivering
    a SIGBUS. This allows userspace to only need to deal with one of these
    two error paths, and is intended for use in libraries that use cxl
    transparently and may not be able to safely install a signal handler.

    This approach will only work if certain constraints are met. Namely, if
    the application is both reading and writing to an address in the problem
    state area it cannot assume that a non-FF read is OK, as it may just be
    reading out a value it has previously written. Further - since only one
    page is used per context a write to a given offset would be visible when
    reading the same offset from a different page in the mapping (this only
    applies within a single context, not between contexts).

    An application could deal with this by e.g. making sure it also reads
    from a read-only offset after any reads to a read/write offset.

    Due to these constraints, this functionality must be explicitly
    requested by userspace when starting the context by passing in the
    CXL_START_WORK_ERR_FF flag.

    Signed-off-by: Ian Munsie
    Acked-by: Michael Neuling
    Signed-off-by: Michael Ellerman

    Ian Munsie
     

03 Jun, 2015

1 commit

  • Given a file descriptor on an afu device, libcxl currently uses the
    major/minor number obtained from fstat on the fd to construct path to
    the afu's sysfs directory. However it is possible that rather than using
    one of the device in /dev/cxl, a kernel driver creates its own device
    which export generic cxl interface to the userspace. This causes
    problems with libcxl as it tries to use a wrong major/minor number to
    construct the sysfs path and fail.

    So this patch introduces a new ioctl called CXL_IOCTL_GET_AFU_ID on the
    afu file descriptor to fetch the cxl_afu_id struct that holds the
    card/offset-id and mode information. These info is then used by libcxl to
    construct the correct path to the afu sysfs directory.

    Testing:
    - Build against pseries be/le configs
    - Testing with corresponding libcxl changes to verify that it constructs
    right sysfs path to the afu.

    Signed-off-by: Vaibhav Jain
    Acked-by: Ian Munsie
    Signed-off-by: Michael Ellerman

    Vaibhav Jain
     

08 Oct, 2014

2 commits

  • This documentation gives an overview of the hardware architecture, userspace
    APIs via /dev/cxl/afuM.N and the syfs files. It also adds a MAINTAINERS file
    entry for cxl.

    Signed-off-by: Ian Munsie
    Signed-off-by: Michael Neuling
    Signed-off-by: Michael Ellerman

    Ian Munsie
     
  • This adds a header file for use by userspace programs wanting to interact with
    the kernel cxl driver. It defines structs and magic numbers required for
    userspace to interact with devices in /dev/cxl/afuM.N.

    Further documentation on this interface is added in a subsequent patch in
    Documentation/powerpc/cxl.txt.

    It also adds this new userspace header file to Kbuild so it's exported when
    doing "make headers_installs".

    Signed-off-by: Ian Munsie
    Signed-off-by: Michael Neuling
    Signed-off-by: Michael Ellerman

    Ian Munsie