One of the IPA's two IRQs fires when data on a suspended channel is
available (to request that the channel--or system--be resumed to
recieve the pending data). This interrupt also handles a few
conditions signaled by the embedded microcontroller.
For this "IPA interrupt", the current code requires a handler to be
dynamically registered for each interrupt condition. Any condition
that has no registered handler is quietly ignored. This design is
derived from the downstream IPA driver implementation.
There isn't any need for this complexity. Even in the downstream
code, only four of the available 30 or so IPA interrupt conditions
are ever handled. So these handlers can pretty easily just be
called directly in the main IRQ handler function.
This series simplifies the interrupt handling code by having the
small number of IPA interrupt handlers be called directly, rather
than having them be registered dynamically.
Version 2 just adds a missing forward-reference, as suggested by
Caleb.
-Alex
Alex Elder (6):
net: ipa: introduce a common microcontroller interrupt handler
net: ipa: introduce ipa_interrupt_enable()
net: ipa: enable IPA interrupt handlers separate from registration
net: ipa: register IPA interrupt handlers directly
net: ipa: kill ipa_interrupt_add()
net: ipa: don't maintain IPA interrupt handler array
drivers/net/ipa/ipa_interrupt.c | 103 ++++++++++++++------------------
drivers/net/ipa/ipa_interrupt.h | 48 +++++----------
drivers/net/ipa/ipa_power.c | 19 ++----
drivers/net/ipa/ipa_power.h | 12 ++++
drivers/net/ipa/ipa_uc.c | 21 +++++--
drivers/net/ipa/ipa_uc.h | 8 +++
6 files changed, 99 insertions(+), 112 deletions(-)
--
2.34.1
Create new function ipa_interrupt_enable() to encapsulate enabling
one of the IPA interrupt types. Introduce ipa_interrupt_disable()
to reverse that operation. Add a helper function to factor out the
common register update used by both.
Use these in ipa_interrupt_add() and ipa_interrupt_remove().
Signed-off-by: Alex Elder <[email protected]>
---
drivers/net/ipa/ipa_interrupt.c | 41 ++++++++++++++++++++-------------
1 file changed, 25 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrupt.c
index a49f66efacb87..7b7388c14806f 100644
--- a/drivers/net/ipa/ipa_interrupt.c
+++ b/drivers/net/ipa/ipa_interrupt.c
@@ -127,6 +127,29 @@ static irqreturn_t ipa_isr_thread(int irq, void *dev_id)
return IRQ_HANDLED;
}
+static void ipa_interrupt_enabled_update(struct ipa *ipa)
+{
+ const struct ipa_reg *reg = ipa_reg(ipa, IPA_IRQ_EN);
+
+ iowrite32(ipa->interrupt->enabled, ipa->reg_virt + ipa_reg_offset(reg));
+}
+
+/* Enable an IPA interrupt type */
+static void ipa_interrupt_enable(struct ipa *ipa, enum ipa_irq_id ipa_irq)
+{
+ /* Update the IPA interrupt mask to enable it */
+ ipa->interrupt->enabled |= BIT(ipa_irq);
+ ipa_interrupt_enabled_update(ipa);
+}
+
+/* Disable an IPA interrupt type */
+static void ipa_interrupt_disable(struct ipa *ipa, enum ipa_irq_id ipa_irq)
+{
+ /* Update the IPA interrupt mask to disable it */
+ ipa->interrupt->enabled &= ~BIT(ipa_irq);
+ ipa_interrupt_enabled_update(ipa);
+}
+
/* Common function used to enable/disable TX_SUSPEND for an endpoint */
static void ipa_interrupt_suspend_control(struct ipa_interrupt *interrupt,
u32 endpoint_id, bool enable)
@@ -205,36 +228,22 @@ void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt)
void ipa_interrupt_add(struct ipa_interrupt *interrupt,
enum ipa_irq_id ipa_irq, ipa_irq_handler_t handler)
{
- struct ipa *ipa = interrupt->ipa;
- const struct ipa_reg *reg;
-
if (WARN_ON(ipa_irq >= IPA_IRQ_COUNT))
return;
interrupt->handler[ipa_irq] = handler;
- /* Update the IPA interrupt mask to enable it */
- interrupt->enabled |= BIT(ipa_irq);
-
- reg = ipa_reg(ipa, IPA_IRQ_EN);
- iowrite32(interrupt->enabled, ipa->reg_virt + ipa_reg_offset(reg));
+ ipa_interrupt_enable(interrupt->ipa, ipa_irq);
}
/* Remove the handler for an IPA interrupt type */
void
ipa_interrupt_remove(struct ipa_interrupt *interrupt, enum ipa_irq_id ipa_irq)
{
- struct ipa *ipa = interrupt->ipa;
- const struct ipa_reg *reg;
-
if (WARN_ON(ipa_irq >= IPA_IRQ_COUNT))
return;
- /* Update the IPA interrupt mask to disable it */
- interrupt->enabled &= ~BIT(ipa_irq);
-
- reg = ipa_reg(ipa, IPA_IRQ_EN);
- iowrite32(interrupt->enabled, ipa->reg_virt + ipa_reg_offset(reg));
+ ipa_interrupt_disable(interrupt->ipa, ipa_irq);
interrupt->handler[ipa_irq] = NULL;
}
--
2.34.1
Hello:
This series was applied to netdev/net-next.git (master)
by Jakub Kicinski <[email protected]>:
On Wed, 4 Jan 2023 11:52:27 -0600 you wrote:
> One of the IPA's two IRQs fires when data on a suspended channel is
> available (to request that the channel--or system--be resumed to
> recieve the pending data). This interrupt also handles a few
> conditions signaled by the embedded microcontroller.
>
> For this "IPA interrupt", the current code requires a handler to be
> dynamically registered for each interrupt condition. Any condition
> that has no registered handler is quietly ignored. This design is
> derived from the downstream IPA driver implementation.
>
> [...]
Here is the summary with links:
- [net-next,v2,1/6] net: ipa: introduce a common microcontroller interrupt handler
https://git.kernel.org/netdev/net-next/c/e5709b7c1ede
- [net-next,v2,2/6] net: ipa: introduce ipa_interrupt_enable()
https://git.kernel.org/netdev/net-next/c/8e461e1f092b
- [net-next,v2,3/6] net: ipa: enable IPA interrupt handlers separate from registration
https://git.kernel.org/netdev/net-next/c/d50ed3558719
- [net-next,v2,4/6] net: ipa: register IPA interrupt handlers directly
https://git.kernel.org/netdev/net-next/c/482ae3a993e4
- [net-next,v2,5/6] net: ipa: kill ipa_interrupt_add()
https://git.kernel.org/netdev/net-next/c/8d8d3f1a3ef9
- [net-next,v2,6/6] net: ipa: don't maintain IPA interrupt handler array
(no matching commit)
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
On Fri, 06 Jan 2023 06:10:17 +0000 [email protected]
wrote:
> - [net-next,v2,6/6] net: ipa: don't maintain IPA interrupt handler array
> (no matching commit)
Hm, no idea why it thinks this patch was not applied.