lkml.org 
[lkml]   [2021]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 05/17] net: ipa: Check interrupts for availability
Date
From: Vladimir Lypak <vladimir.lypak@gmail.com>

Make ipa_interrupt_add/ipa_interrupt_remove no-operation if requested
interrupt is not supported by IPA hardware.

Signed-off-by: Vladimir Lypak <vladimir.lypak@gmail.com>
Signed-off-by: Sireesh Kodali <sireeshkodali1@gmail.com>
---
drivers/net/ipa/ipa_interrupt.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrupt.c
index b35170a93b0f..94708a23a597 100644
--- a/drivers/net/ipa/ipa_interrupt.c
+++ b/drivers/net/ipa/ipa_interrupt.c
@@ -48,6 +48,25 @@ static bool ipa_interrupt_uc(struct ipa_interrupt *interrupt, u32 irq_id)
return irq_id == IPA_IRQ_UC_0 || irq_id == IPA_IRQ_UC_1;
}

+static bool ipa_interrupt_check_fixup(enum ipa_irq_id *irq_id, enum ipa_version version)
+{
+ switch (*irq_id) {
+ case IPA_IRQ_EOT_COAL:
+ return version < IPA_VERSION_3_5;
+ case IPA_IRQ_DCMP:
+ return version < IPA_VERSION_4_5;
+ case IPA_IRQ_TLV_LEN_MIN_DSM:
+ return version >= IPA_VERSION_4_5;
+ default:
+ break;
+ }
+
+ if (*irq_id >= IPA_IRQ_DRBIP_PKT_EXCEED_MAX_SIZE_EN)
+ return version >= IPA_VERSION_4_9;
+
+ return true;
+}
+
/* Process a particular interrupt type that has been received */
static void ipa_interrupt_process(struct ipa_interrupt *interrupt, u32 irq_id)
{
@@ -191,6 +210,9 @@ void ipa_interrupt_add(struct ipa_interrupt *interrupt,
struct ipa *ipa = interrupt->ipa;
u32 offset;

+ if (!ipa_interrupt_check_fixup(&ipa_irq, ipa->version))
+ return;
+
WARN_ON(ipa_irq >= IPA_IRQ_COUNT);

interrupt->handler[ipa_irq] = handler;
@@ -208,6 +230,9 @@ ipa_interrupt_remove(struct ipa_interrupt *interrupt, enum ipa_irq_id ipa_irq)
struct ipa *ipa = interrupt->ipa;
u32 offset;

+ if (!ipa_interrupt_check_fixup(&ipa_irq, ipa->version))
+ return;
+
WARN_ON(ipa_irq >= IPA_IRQ_COUNT);

/* Update the IPA interrupt mask to disable it */
--
2.33.0
\
 
 \ /
  Last update: 2021-09-20 05:09    [W:0.317 / U:0.736 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site