• Dave Jiang's avatar
    dmaengine: idxd: process batch descriptor completion record faults · 2442b747
    Dave Jiang authored
    Add event log processing for faulting of user batch descriptor completion
    record.
    
    When encountering an event log entry for a page fault on a completion
    record, the driver is expected to do the following:
    1. If the "first error in batch" bit in event log entry error info is
    set, discard any previously recorded errors associated with the
    "batch identifier".
    2. Fix the page fault according to the fault address in the event log. If
    successful, write the completion record to the fault address in user space.
    3. If an error is encountered while writing the completion record and it is
    associated to a descriptor in the batch, the driver associates the error
    with the batch identifier of the event log entry and tracks it until the
    event log entry for the corresponding batch desc is encountered.
    
    While processing an event log entry for a batch descriptor with error
    indicating that one or more descs in the batch had event log entries,
    the driver will do the following before writing the batch completion
    record:
    1. If the status field of the completion record is 0x1, the driver will
    change it to error code 0x5 (one or more operations in batch completed
    with status not successful) and changes the result field to 1.
    2. If the status is error code 0x6 (page fault on batch descriptor list
    address), change the result field to 1.
    3. If status is any other value, the completion record is not changed.
    4. Clear the recorded error in preparation for next batch with same batch
    identifier.
    
    The result field is for user software to determine whether to set the
    "Batch Error" flag bit in the descriptor for continuation of partial
    batch descriptor completion. See DSA spec 2.0 for additional information.
    
    If no error has been recorded for the batch, the batch completion record is
    written to user space as is.
    Tested-by: default avatarTony Zhu <tony.zhu@intel.com>
    Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
    Co-developed-by: default avatarFenghua Yu <fenghua.yu@intel.com>
    Signed-off-by: default avatarFenghua Yu <fenghua.yu@intel.com>
    Link: https://lore.kernel.org/r/20230407203143.2189681-12-fenghua.yu@intel.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
    2442b747
init.c 21.3 KB