• Omer Shpigelman's avatar
    habanalabs: handle the h/w sync object · b0b5d925
    Omer Shpigelman authored
    Define a structure representing the h/w sync object (SOB).
    
    a SOB can contain up to 2^15 values. Each signal CS will increment the SOB
    by 1, so after some time we will reach the maximum number the SOB can
    represent. When that happens, the driver needs to move to a different SOB
    for the signal operation.
    
    A SOB can be in 1 of 4 states:
    
    1. Working state with value < 2^15
    
    2. We reached a value of 2^15, but the signal operations weren't completed
    yet OR there are pending waits on this signal. For the next submission, the
    driver will move to another SOB.
    
    3. ALL the signal operations on the SOB have finished AND there are no more
    pending waits on the SOB AND we reached a value of 2^15 (This basically
    means the refcnt of the SOB is 0 - see explanation below). When that
    happens, the driver can clear the SOB by simply doing WREG32 0 to it and
    set the refcnt back to 1.
    
    4. The SOB is cleared and can be used next time by the driver when it needs
    to reuse an SOB.
    
    Per SOB, the driver will maintain a single refcnt, that will be initialized
    to 1. When a signal or wait operation on this SOB is submitted to the PQ,
    the refcnt will be incremented. When a signal or wait operation on this SOB
    completes, the refcnt will be decremented. After the submission of the
    signal operation that increments the SOB to a value of 2^15, the refcnt is
    also decremented.
    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>
    b0b5d925
hw_queue.c 23.1 KB