]> git.ipfire.org Git - thirdparty/linux.git/commit
net: ipa: separate disabling setup from modem stop
authorAlex Elder <elder@linaro.org>
Tue, 23 Nov 2021 00:15:55 +0000 (18:15 -0600)
committerDavid S. Miller <davem@davemloft.net>
Tue, 23 Nov 2021 12:06:40 +0000 (12:06 +0000)
commit8afc7e471ad3c92a9c96adc62d1b67de77378bb6
treed4a21f80ee901c3ccf87cc8806e0ab46598129e4
parent33a153100bb3459479bd95d3259c2915b53fefa8
net: ipa: separate disabling setup from modem stop

The IPA setup_complete flag is set at the end of ipa_setup(), when
the setup phase of initialization has completed successfully.  This
occurs as part of driver probe processing, or (if "modem-init" is
specified in the DTS file) it is triggered by the "ipa-setup-ready"
SMP2P interrupt generated by the modem.

In the latter case, it's possible for driver shutdown (or remove) to
begin while setup processing is underway, and this can't be allowed.
The problem is that the setup_complete flag is not adequate to signal
that setup is underway.

If setup_complete is set, it will never be un-set, so that case is
not a problem.  But if setup_complete is false, there's a chance
setup is underway.

Because setup is triggered by an interrupt on a "modem-init" system,
there is a simple way to ensure the value of setup_complete is safe
to read.  The threaded handler--if it is executing--will complete as
part of a request to disable the "ipa-modem-ready" interrupt.  This
means that ipa_setup() (which is called from the handler) will run
to completion if it was underway, or will never be called otherwise.

The request to disable the "ipa-setup-ready" interrupt is currently
made within ipa_modem_stop().  Instead, disable the interrupt
outside that function in the two places it's called.  In the case of
ipa_remove(), this ensures the setup_complete flag is safe to read
before we read it.

Rename ipa_smp2p_disable() to be ipa_smp2p_irq_disable_setup(), to be
more specific about its effect.

Fixes: 530f9216a953 ("soc: qcom: ipa: AP/modem communications")
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ipa/ipa_main.c
drivers/net/ipa/ipa_modem.c
drivers/net/ipa/ipa_smp2p.c
drivers/net/ipa/ipa_smp2p.h