• Tomer Tayar's avatar
    habanalabs: add support for graceful hard reset · a88a6f5f
    Tomer Tayar authored
    Calling hl_device_reset() for a hard reset will lead to a quite
    immediate device reset and to killing user process.
    For resets that follow errors, it disables the option to debug the
    errors on both the device side and the user application side.
    
    This patch adds a 'graceful hard reset' option and a new
    hl_device_cond_reset() function.
    Under some conditions, mainly if there is no user process or if he is
    not registered to driver notifications, this function will execute hard
    reset as usual.
    Otherwise, the reset will be postponed and a notification will be sent
    to user, to let him perform post-error actions and then to release the
    device, after which reset will take place.
    
    If device is not released by user in some defined time, a watchdog work
    will execute the reset in any case.
    Signed-off-by: default avatarTomer Tayar <ttayar@habana.ai>
    Reviewed-by: default avatarOded Gabbay <ogabbay@kernel.org>
    Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
    a88a6f5f
device.c 66.2 KB