Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Alex Elder <elder@linaro.org>
To: davem@davemloft.net, kuba@kernel.org
Cc: bjorn.andersson@linaro.org, evgreen@chromium.org,
	cpratapa@codeaurora.org, subashab@codeaurora.org,
	elder@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH net-next 5/5] net: ipa: don't suspend endpoints if setup not complete
Date: Tue, 27 Jul 2021 16:19:33 -0500	[thread overview]
Message-ID: <20210727211933.926593-6-elder@linaro.org> (raw)
In-Reply-To: <20210727211933.926593-1-elder@linaro.org>

Until we complete the setup stage of initialization, GSI is not
initialized and therefore endpoints aren't usable.  So avoid
suspending endpoints during system suspend unless setup is complete.

Clear the setup_complete flag at the top of ipa_teardown() to
reflect the fact that things are no longer in setup state.

Get rid of a misplaced (and superfluous) comment.

Signed-off-by: Alex Elder <elder@linaro.org>
---
 drivers/net/ipa/ipa_main.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c
index 67aba68e6e3b4..2e728d4914c82 100644
--- a/drivers/net/ipa/ipa_main.c
+++ b/drivers/net/ipa/ipa_main.c
@@ -194,6 +194,9 @@ static void ipa_teardown(struct ipa *ipa)
 	struct ipa_endpoint *exception_endpoint;
 	struct ipa_endpoint *command_endpoint;
 
+	/* We're going to tear everything down, as if setup never completed */
+	ipa->setup_complete = false;
+
 	ipa_qmi_teardown(ipa);
 	ipa_endpoint_default_route_clear(ipa);
 	exception_endpoint = ipa->name_map[IPA_ENDPOINT_AP_LAN_RX];
@@ -885,13 +888,11 @@ static int ipa_suspend(struct device *dev)
 {
 	struct ipa *ipa = dev_get_drvdata(dev);
 
-	/* When a suspended RX endpoint has a packet ready to receive, we
-	 * get an IPA SUSPEND interrupt.  We trigger a system resume in
-	 * that case, but only on the first such interrupt since suspend.
-	 */
-	__clear_bit(IPA_FLAG_RESUMED, ipa->flags);
-
-	ipa_endpoint_suspend(ipa);
+	/* Endpoints aren't usable until setup is complete */
+	if (ipa->setup_complete) {
+		__clear_bit(IPA_FLAG_RESUMED, ipa->flags);
+		ipa_endpoint_suspend(ipa);
+	}
 
 	ipa_clock_put(ipa);
 
@@ -917,7 +918,9 @@ static int ipa_resume(struct device *dev)
 	 */
 	ipa_clock_get(ipa);
 
-	ipa_endpoint_resume(ipa);
+	/* Endpoints aren't usable until setup is complete */
+	if (ipa->setup_complete)
+		ipa_endpoint_resume(ipa);
 
 	return 0;
 }
-- 
2.27.0


  parent reply	other threads:[~2021-07-27 21:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27 21:19 [PATCH net-next 0/5] net: ipa: add clock references Alex Elder
2021-07-27 21:19 ` [PATCH net-next 1/5] net: ipa: get clock in ipa_probe() Alex Elder
2021-07-27 21:19 ` [PATCH net-next 2/5] net: ipa: get another clock for ipa_setup() Alex Elder
2021-07-27 21:19 ` [PATCH net-next 3/5] net: ipa: add clock reference for remoteproc SSR Alex Elder
2021-07-27 21:19 ` [PATCH net-next 4/5] net: ipa: add a clock reference for netdev operations Alex Elder
2021-07-27 21:19 ` Alex Elder [this message]
2021-07-27 23:10 ` [PATCH net-next 0/5] net: ipa: add clock references patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210727211933.926593-6-elder@linaro.org \
    --to=elder@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=cpratapa@codeaurora.org \
    --cc=davem@davemloft.net \
    --cc=elder@kernel.org \
    --cc=evgreen@chromium.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=subashab@codeaurora.org \
    --subject='Re: [PATCH net-next 5/5] net: ipa: don'\''t suspend endpoints if setup not complete' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).