From: Alex Elder <elder@linaro.org>
To: davem@davemloft.net, kuba@kernel.org
Cc: evgreen@chromium.org, subashab@codeaurora.org,
cpratapa@codeaurora.org, bjorn.andersson@linaro.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net-next 05/13] net: ipa: disable all GSI interrupt types initially
Date: Thu, 5 Nov 2020 12:13:59 -0600 [thread overview]
Message-ID: <20201105181407.8006-6-elder@linaro.org> (raw)
In-Reply-To: <20201105181407.8006-1-elder@linaro.org>
Introduce gsi_irq_setup() and gsi_irq_teardown() to disable all
GSI interrupts when first setting up GSI hardware, and to clean
things up when we're done.
Re-enable all GSI interrupt types in gsi_irq_enable(), but do
so only after each of the type-specific interrupt masks has
been configured. Similarly, disable all interrupt types in
gsi_irq_disable()--first--before zeroing out the type-specific
masks.
Signed-off-by: Alex Elder <elder@linaro.org>
---
drivers/net/ipa/gsi.c | 42 ++++++++++++++++++++++++++++++++----------
1 file changed, 32 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c
index da5204268df29..669d7496f8bdb 100644
--- a/drivers/net/ipa/gsi.c
+++ b/drivers/net/ipa/gsi.c
@@ -230,6 +230,18 @@ static u32 gsi_channel_id(struct gsi_channel *channel)
return channel - &channel->gsi->channel[0];
}
+/* Turn off all GSI interrupts initially */
+static void gsi_irq_setup(struct gsi *gsi)
+{
+ iowrite32(0, gsi->virt + GSI_CNTXT_TYPE_IRQ_MSK_OFFSET);
+}
+
+/* Turn off all GSI interrupts when we're all done */
+static void gsi_irq_teardown(struct gsi *gsi)
+{
+ iowrite32(0, gsi->virt + GSI_CNTXT_TYPE_IRQ_MSK_OFFSET);
+}
+
static void gsi_irq_ieob_enable(struct gsi *gsi, u32 evt_ring_id)
{
u32 val;
@@ -253,14 +265,6 @@ static void gsi_irq_enable(struct gsi *gsi)
{
u32 val;
- val = BIT(GSI_CH_CTRL);
- val |= BIT(GSI_EV_CTRL);
- val |= BIT(GSI_GLOB_EE);
- val |= BIT(GSI_IEOB);
- /* We don't use inter-EE channel or event control interrupts */
- val |= BIT(GSI_GENERAL);
- iowrite32(val, gsi->virt + GSI_CNTXT_TYPE_IRQ_MSK_OFFSET);
-
val = GENMASK(gsi->channel_count - 1, 0);
iowrite32(val, gsi->virt + GSI_CNTXT_SRC_CH_IRQ_MSK_OFFSET);
@@ -276,17 +280,27 @@ static void gsi_irq_enable(struct gsi *gsi)
/* Never enable GSI_BREAK_POINT */
val = GSI_CNTXT_GSI_IRQ_ALL & ~BREAK_POINT_FMASK;
iowrite32(val, gsi->virt + GSI_CNTXT_GSI_IRQ_EN_OFFSET);
+
+ /* Finally enable the interrupt types we use */
+ val = BIT(GSI_CH_CTRL);
+ val |= BIT(GSI_EV_CTRL);
+ val |= BIT(GSI_GLOB_EE);
+ val |= BIT(GSI_IEOB);
+ /* We don't use inter-EE channel or event interrupts */
+ val |= BIT(GSI_GENERAL);
+ iowrite32(val, gsi->virt + GSI_CNTXT_TYPE_IRQ_MSK_OFFSET);
}
/* Disable all GSI_interrupt types */
static void gsi_irq_disable(struct gsi *gsi)
{
+ iowrite32(0, gsi->virt + GSI_CNTXT_TYPE_IRQ_MSK_OFFSET);
+
iowrite32(0, gsi->virt + GSI_CNTXT_GSI_IRQ_EN_OFFSET);
iowrite32(0, gsi->virt + GSI_CNTXT_GLOB_IRQ_EN_OFFSET);
iowrite32(0, gsi->virt + GSI_CNTXT_SRC_IEOB_IRQ_MSK_OFFSET);
iowrite32(0, gsi->virt + GSI_CNTXT_SRC_EV_CH_IRQ_MSK_OFFSET);
iowrite32(0, gsi->virt + GSI_CNTXT_SRC_CH_IRQ_MSK_OFFSET);
- iowrite32(0, gsi->virt + GSI_CNTXT_TYPE_IRQ_MSK_OFFSET);
}
/* Return the virtual address associated with a ring index */
@@ -1683,6 +1697,7 @@ int gsi_setup(struct gsi *gsi)
{
struct device *dev = gsi->dev;
u32 val;
+ int ret;
/* Here is where we first touch the GSI hardware */
val = ioread32(gsi->virt + GSI_GSI_STATUS_OFFSET);
@@ -1691,6 +1706,8 @@ int gsi_setup(struct gsi *gsi)
return -EIO;
}
+ gsi_irq_setup(gsi);
+
val = ioread32(gsi->virt + GSI_GSI_HW_PARAM_2_OFFSET);
gsi->channel_count = u32_get_bits(val, NUM_CH_PER_EE_FMASK);
@@ -1723,13 +1740,18 @@ int gsi_setup(struct gsi *gsi)
/* Writing 1 indicates IRQ interrupts; 0 would be MSI */
iowrite32(1, gsi->virt + GSI_CNTXT_INTSET_OFFSET);
- return gsi_channel_setup(gsi);
+ ret = gsi_channel_setup(gsi);
+ if (ret)
+ gsi_irq_teardown(gsi);
+
+ return ret;
}
/* Inverse of gsi_setup() */
void gsi_teardown(struct gsi *gsi)
{
gsi_channel_teardown(gsi);
+ gsi_irq_teardown(gsi);
}
/* Initialize a channel's event ring */
--
2.20.1
next prev parent reply other threads:[~2020-11-05 18:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-05 18:13 [PATCH net-next 00/13] net: ipa: constrain GSI interrupts Alex Elder
2020-11-05 18:13 ` [PATCH net-next 01/13] net: ipa: refer to IPA versions, not GSI Alex Elder
2020-11-05 18:13 ` [PATCH net-next 02/13] net: ipa: request GSI IRQ later Alex Elder
2020-11-05 18:13 ` [PATCH net-next 03/13] net: ipa: rename gsi->event_enable_bitmap Alex Elder
2020-11-05 18:13 ` [PATCH net-next 04/13] net: ipa: define GSI interrupt types with an enum Alex Elder
2020-11-05 18:13 ` Alex Elder [this message]
2020-11-05 18:14 ` [PATCH net-next 06/13] net: ipa: cache last-saved GSI IRQ enabled type Alex Elder
2020-11-05 18:14 ` [PATCH net-next 07/13] net: ipa: only enable GSI channel control IRQs when needed Alex Elder
2020-11-05 18:14 ` [PATCH net-next 08/13] net: ipa: only enable GSI event " Alex Elder
2020-11-05 18:14 ` [PATCH net-next 09/13] net: ipa: only enable generic command completion IRQ " Alex Elder
2020-11-05 18:14 ` [PATCH net-next 10/13] net: ipa: only enable GSI IEOB IRQs " Alex Elder
2020-11-05 18:14 ` [PATCH net-next 11/13] net: ipa: explicitly disallow inter-EE interrupts Alex Elder
2020-11-05 18:14 ` [PATCH net-next 12/13] net: ipa: only enable GSI general IRQs when needed Alex Elder
2020-11-05 18:14 ` [PATCH net-next 13/13] net: ipa: pass a value to gsi_irq_type_update() Alex Elder
2020-11-07 23:50 ` [PATCH net-next 00/13] net: ipa: constrain GSI interrupts 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=20201105181407.8006-6-elder@linaro.org \
--to=elder@linaro.org \
--cc=bjorn.andersson@linaro.org \
--cc=cpratapa@codeaurora.org \
--cc=davem@davemloft.net \
--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