• Omer Shpigelman's avatar
    habanalabs: add signal/wait to CS IOCTL operations · b75f2250
    Omer Shpigelman authored
    Add the following two operations to the CS IOCTL:
    
    Signal:
    
    The signal operation is basically a command submission, that is created by
    the driver upon user request. It will be implemented using a dedicated PQE
    that will increment a specific SOB. There will be a new flag:
    HL_CS_FLAGS_SIGNAL. When the user set this flag in the CS IOCTL structure,
    the driver will execute a dedicated code path that will prepare this
    special PQE and submit it. The user only needs to provide a queue index on
    which to put the signal.
    
    Wait:
    
    The wait operation is also a command submission that is created by the
    driver upon user request. It will be implemented using a dedicated PQE that
    will contain packets of "ARM a monitor" + FENCE packet. There will be a new
    flag: HL_CS_FLAGS_WAIT. When the user set this flag in the CS structure,
    the driver will execute a dedicated code path that will prepare this
    special PQE and submit it.
    
    The user needs to provide the following parameters:
    1. queue ID
    2. an array of signal_seq numbers and the number of signals to wait on
       (the length of signal_seq_arr).
    
    The IOCTL will return the CS sequence number of the wait it put on the
    queue ID.
    
    Currently, the code supports signal_seq_nr==1. But this API definition will
    allow us to put a single PQE that waits on multiple signals.
    
    To correctly configure the monitor and fence, the driver will need to
    retrieve the specified signal CS object that contains the relevant SOB and
    its expected value. In case the signal CS has already been completed, there
    is no point of adding a wait operation. In this case, the driver will
    return to the user *without* putting anything on the PQ. The return code
    should reflect to the user that the signal was completed, as we won't
    return a CS sequence number for this wait.
    Signed-off-by: default avatarOmer Shpigelman <oshpigelman@habana.ai>
    Reviewed-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
    Signed-off-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
    b75f2250
command_submission.c 28.6 KB