Hi, This patch-set provides a fix for libcxl github issue#20 "libcxl doesn't handle a mmio read of 0xfffffff... (all 1's) correctly" at https://github.com/ibm-capi/libcxl/issues/20.
The issue arises as libcxl uses mmio read values from problem-state-area(PSA) to determine if the card had fenced or not. When it reads a value of 0xFFs (all 1) it assumes that the card has fenced and returns an error for the mmio read. Unfortunately 0xFFs can be a valid value in PSA of some some AFUs and in such cases libcxl incorrectly assumes the card to be fenced and indicate and error to the caller. To fix this issue, the patch-set provides direct and read-only access of the afu descriptor to libcxl via a binary sysfs attribute named 'afu_desc'. Libcxl can mmap this attribute to process address space and if an mmio read returns 0xFFs it tries reading contents of afu_desc at an offset whose contents != ~0x0ULL. If the card is fenced read of the same offset will have contents == ~0x0ULL in which case libcxl can indicate an error to the caller about the fenced card else the read of 0xFFs is a valid read. There are three patchset in this series: - First patch refactors the function cxl_pci_afu_err_buffer() and moves its implementation to 'native.c'. It also moves the core logic of the function to a new function __aligned_memcpy(). - Second patch introduces a new sysfs attribute named afu_desc to be used by libcxl to read raw contents of afu descriptor. - Third patch provides native implementations for new cxl backend-ops introduced in the previous patch. Most importantly it implements the afu_desc_mmap backend-op thats mmaps the afu descriptor to a given vma. Additional related changes apart from this patch-set: - Corresponding libcxl changes are posted as a pull request#25 "libcxl: Check afu link when read from PSA mmio return all FFs" at https://github.com/ibm-capi/libcxl/pull/25 - Patch "kernfs: Check KERNFS_HAS_RELEASE before calling kernfs_release_file()" which fixes a kernel oops occurring while removing a bin_attribute from sysfs at https://patchwork.ozlabs.org/patch/738536/. Vaibhav Jain (3): cxl: Re-factor cxl_pci_afu_read_err_buffer() cxl: Introduce afu_desc sysfs attribute cxl: Provide user-space access to afu descriptor on bare metal Documentation/ABI/testing/sysfs-class-cxl | 9 ++++ drivers/misc/cxl/cxl.h | 15 ++++-- drivers/misc/cxl/native.c | 89 ++++++++++++++++++++++++++++++- drivers/misc/cxl/pci.c | 47 ++-------------- drivers/misc/cxl/sysfs.c | 45 ++++++++++++++++ 5 files changed, 157 insertions(+), 48 deletions(-) -- 2.9.3