• Stephan Gerhold's avatar
    soc: qcom: smsm: Fix missed interrupts if state changes while masked · e3d45719
    Stephan Gerhold authored
    The SMSM driver detects interrupt edges by tracking the last state
    it has seen (and has triggered the interrupt handler for). This works
    fine, but only if the interrupt does not change state while masked.
    
    For example, if an interrupt is unmasked while the state is HIGH,
    the stored last_value for that interrupt might still be LOW. Then,
    when the remote processor triggers smsm_intr() we assume that nothing
    has changed, even though the state might have changed from HIGH to LOW.
    
    Attempt to fix this by checking the current remote state before
    unmasking an IRQ. Use atomic operations to avoid the interrupt handler
    from interfering with the unmask function.
    
    This fixes modem crashes in some edge cases with the BAM-DMUX driver.
    Specifically, the BAM-DMUX interrupt handler is not called for the
    HIGH -> LOW smsm state transition if the BAM-DMUX driver is loaded
    (and therefore unmasks the interrupt) after the modem was already started:
    
    qcom-q6v5-mss 4080000.remoteproc: fatal error received: a2_task.c:3188:
      Assert FALSE failed: A2 DL PER deadlock timer expired waiting for Apps ACK
    
    Fixes: c97c4090 ("soc: qcom: smsm: Add driver for Qualcomm SMSM")
    Signed-off-by: default avatarStephan Gerhold <stephan@gerhold.net>
    Link: https://lore.kernel.org/r/20210712135703.324748-2-stephan@gerhold.netSigned-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
    e3d45719
smsm.c 16.7 KB