• Richard Genoud's avatar
    remoteproc: k3-r5: Fix IPC-only mode detection · a8631f6d
    Richard Genoud authored
    ret variable was used to test reset status, get from
    reset_control_status() call. But this variable was overwritten by
    ti_sci_proc_get_status() a few lines bellow.
    And as ti_sci_proc_get_status() returns 0 or a negative value (in this
    latter case, followed by a return), the expression !ret was always true,
    
    Clearly, this was not what was intended:
    In the comment above it's said that "requires both local and module
    resets to be deasserted"; if reset_control_status() returns 0 it means
    that the reset line is deasserted.
    So, it's pretty clear that the return value of reset_control_status()
    was intended to be used instead of ti_sci_proc_get_status() return
    value.
    
    This could lead in an incorrect IPC-only mode detection if reset line is
    asserted (so reset_control_status() return > 0) and c_state != 0 and
    halted == 0.
    In this case, the old code would have detected an IPC-only mode instead
    of a mismatched mode.
    
    Fixes: 1168af40 ("remoteproc: k3-r5: Add support for IPC-only mode for all R5Fs")
    Signed-off-by: default avatarRichard Genoud <richard.genoud@bootlin.com>
    Reviewed-by: default avatarHari Nagalla <hnagalla@ti.com>
    Link: https://lore.kernel.org/r/20240621150058.319524-2-richard.genoud@bootlin.comSigned-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
    a8631f6d
ti_k3_r5_remoteproc.c 55.4 KB