linux-kernel.vger.kernel.org archive mirror
 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 6/6] net: ipa: disable GSI interrupts while suspended
Date: Tue,  3 Aug 2021 09:01:03 -0500	[thread overview]
Message-ID: <20210803140103.1012697-7-elder@linaro.org> (raw)
In-Reply-To: <20210803140103.1012697-1-elder@linaro.org>

Introduce new functions gsi_suspend() and gsi_resume(), which will
disable the GSI interrupt handler after all endpoints are suspended
and re-enable it before endpoints are resumed.  This will ensure no
GSI interrupt handler will fire when the hardware is suspended.

Here's a little further explanation.  There are seven GSI interrupt
types, and most are disabled except when needed.
  - These two are not used (never enabled):
      GSI_INTER_EE_CH_CTRL
      GSI_INTER_EE_EV_CTRL
  - These two are only used to implement channel and event ring
    commands, and are only enabled while a command is underway:
      GSI_CH_CTRL
      GSI_EV_CTRL
  - The IEOB interrupt signals I/O completion.  It will not fire
    when a channel is stopped (or "suspended").
      GSI_IEOB
  - This interrupt is used to allocate or halt modem channels,
    and is only enabled while such a command is underway.
      GSI_GLOB_EE
    However it also is used to signal certain errors, and this could
    occur at any time.
  - The general interrupt signals general errors, and could occur at
    any time.
      GSI_GENERAL

The purpose for this change is to ensure no global or general
interrupts fire due to errors while the hardware is suspended.
We enable the clock on resume, and at that time we can "handle"
(at least report) these error conditions.

Signed-off-by: Alex Elder <elder@linaro.org>
---
 drivers/net/ipa/gsi.c      | 12 ++++++++++++
 drivers/net/ipa/gsi.h      | 12 ++++++++++++
 drivers/net/ipa/ipa_main.c |  5 ++++-
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c
index c555ccd778bb8..a2fcdb1abdb96 100644
--- a/drivers/net/ipa/gsi.c
+++ b/drivers/net/ipa/gsi.c
@@ -981,6 +981,18 @@ int gsi_channel_resume(struct gsi *gsi, u32 channel_id)
 	return __gsi_channel_start(channel, true);
 }
 
+/* Prevent all GSI interrupts while suspended */
+void gsi_suspend(struct gsi *gsi)
+{
+	disable_irq(gsi->irq);
+}
+
+/* Allow all GSI interrupts again when resuming */
+void gsi_resume(struct gsi *gsi)
+{
+	enable_irq(gsi->irq);
+}
+
 /**
  * gsi_channel_tx_queued() - Report queued TX transfers for a channel
  * @channel:	Channel for which to report
diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h
index 97163b58b4ebc..88b80dc3db79f 100644
--- a/drivers/net/ipa/gsi.h
+++ b/drivers/net/ipa/gsi.h
@@ -232,6 +232,18 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id);
  */
 void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool doorbell);
 
+/**
+ * gsi_suspend() - Prepare the GSI subsystem for suspend
+ * @gsi:	GSI pointer
+ */
+void gsi_suspend(struct gsi *gsi);
+
+/**
+ * gsi_resume() - Resume the GSI subsystem following suspend
+ * @gsi:	GSI pointer
+ */
+void gsi_resume(struct gsi *gsi);
+
 /**
  * gsi_channel_suspend() - Suspend a GSI channel
  * @gsi:	GSI pointer
diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c
index 2e728d4914c82..ae51109dea01b 100644
--- a/drivers/net/ipa/ipa_main.c
+++ b/drivers/net/ipa/ipa_main.c
@@ -892,6 +892,7 @@ static int ipa_suspend(struct device *dev)
 	if (ipa->setup_complete) {
 		__clear_bit(IPA_FLAG_RESUMED, ipa->flags);
 		ipa_endpoint_suspend(ipa);
+		gsi_suspend(&ipa->gsi);
 	}
 
 	ipa_clock_put(ipa);
@@ -919,8 +920,10 @@ static int ipa_resume(struct device *dev)
 	ipa_clock_get(ipa);
 
 	/* Endpoints aren't usable until setup is complete */
-	if (ipa->setup_complete)
+	if (ipa->setup_complete) {
+		gsi_resume(&ipa->gsi);
 		ipa_endpoint_resume(ipa);
+	}
 
 	return 0;
 }
-- 
2.27.0


  parent reply	other threads:[~2021-08-03 14:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03 14:00 [PATCH net-next 0/6] net: ipa: prepare GSI interrupts for runtime PM Alex Elder
2021-08-03 14:00 ` [PATCH net-next 1/6] net: ipa: use gsi->version for channel suspend/resume Alex Elder
2021-08-03 14:00 ` [PATCH net-next 2/6] net: ipa: move version check " Alex Elder
2021-08-03 14:01 ` [PATCH net-next 3/6] net: ipa: move some GSI setup functions Alex Elder
2021-08-03 14:01 ` [PATCH net-next 4/6] net: ipa: have gsi_irq_setup() return an error code Alex Elder
2021-08-03 14:01 ` [PATCH net-next 5/6] net: ipa: move gsi_irq_init() code into setup Alex Elder
2021-08-03 14:01 ` Alex Elder [this message]
2021-08-04  9:40 ` [PATCH net-next 0/6] net: ipa: prepare GSI interrupts for runtime PM 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=20210803140103.1012697-7-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 \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).