From: MD Danish Anwar <danishanwar@ti.com>
To: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>,
Suman Anna <s-anna@ti.com>, David Lechner <david@lechnology.com>,
Roger Quadros <rogerq@kernel.org>, "Andrew F. Davis" <afd@ti.com>,
Marc Zyngier <maz@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>
Cc: <linux-kernel@vger.kernel.org>, <srk@ti.com>,
<danishanwar@ti.com>, <r-gunasekaran@ti.com>, <vigneshr@ti.com>
Subject: [PATCH 3/3] irqchip/irq-pruss-intc: Fix processing of IEP interrupts
Date: Tue, 19 Sep 2023 11:49:00 +0530 [thread overview]
Message-ID: <20230919061900.369300-4-danishanwar@ti.com> (raw)
In-Reply-To: <20230919061900.369300-1-danishanwar@ti.com>
From: Suman Anna <s-anna@ti.com>
It was discovered that IEP capture/compare IRQs (event #7 on all SoCs
and event #56 on K3 SoCs) are always triggered twice when PPS is
generated and CMP hit event detected by IEP.
An example of the problem is:
pruss_intc_irq_handler
generic_handle_irq
handle_level_irq
mask_ack_irq -> IRQ 7 masked and asked in INTC,
but it's not yet cleared on HW level
handle_irq_event()
<threaded on RT>
icss_iep_cap_cmp_handler() -> IRQ 7 is actually processed in HW
irq_finalize_oneshot()
unmask_irq()
pruss_intc_irq_unmask() -> IRQ 7 status is still observed as set
The solution is to actually ack these IRQs from pruss_intc_irq_unmask()
after the IRQ source is cleared in HW.
No public errata available for this yet.
Fixes: 04e2d1e06978 ("irqchip/irq-pruss-intc: Add a PRUSS irqchip driver for PRUSS interrupts")
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
---
drivers/irqchip/irq-pruss-intc.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/irqchip/irq-pruss-intc.c b/drivers/irqchip/irq-pruss-intc.c
index 3cf684ede564..9907847dbda8 100644
--- a/drivers/irqchip/irq-pruss-intc.c
+++ b/drivers/irqchip/irq-pruss-intc.c
@@ -70,6 +70,8 @@
#define MAX_PRU_SYS_EVENTS 160
#define MAX_PRU_CHANNELS 20
+#define MAX_PRU_INT_EVENTS 64
+
/**
* struct pruss_intc_map_record - keeps track of actual mapping state
* @value: The currently mapped value (channel or host)
@@ -85,10 +87,13 @@ struct pruss_intc_map_record {
* @num_system_events: number of input system events handled by the PRUSS INTC
* @num_host_events: number of host events (which is equal to number of
* channels) supported by the PRUSS INTC
+ * @quirky_events: bitmask of events that need quirky IRQ handling (limited to
+ * (internal sources only for now, so 64 bits suffice)
*/
struct pruss_intc_match_data {
u8 num_system_events;
u8 num_host_events;
+ u64 quirky_events;
};
/**
@@ -304,6 +309,10 @@ static void pruss_intc_irq_ack(struct irq_data *data)
struct pruss_intc *intc = irq_data_get_irq_chip_data(data);
unsigned int hwirq = data->hwirq;
+ if (hwirq < MAX_PRU_INT_EVENTS &&
+ intc->soc_config->quirky_events & BIT_ULL(hwirq))
+ return;
+
pruss_intc_write_reg(intc, PRU_INTC_SICR, hwirq);
}
@@ -320,6 +329,9 @@ static void pruss_intc_irq_unmask(struct irq_data *data)
struct pruss_intc *intc = irq_data_get_irq_chip_data(data);
unsigned int hwirq = data->hwirq;
+ if (hwirq < MAX_PRU_INT_EVENTS &&
+ intc->soc_config->quirky_events & BIT_ULL(hwirq))
+ pruss_intc_write_reg(intc, PRU_INTC_SICR, hwirq);
pruss_intc_write_reg(intc, PRU_INTC_EISR, hwirq);
}
@@ -644,11 +656,13 @@ static int pruss_intc_remove(struct platform_device *pdev)
static const struct pruss_intc_match_data pruss_intc_data = {
.num_system_events = 64,
.num_host_events = 10,
+ .quirky_events = BIT_ULL(7), /* IEP capture/compare event */
};
static const struct pruss_intc_match_data icssg_intc_data = {
.num_system_events = 160,
.num_host_events = 20,
+ .quirky_events = BIT_ULL(7) | BIT_ULL(56), /* IEP{0,1} capture/compare events */
};
static const struct of_device_id pruss_intc_of_match[] = {
--
2.34.1
next prev parent reply other threads:[~2023-09-19 6:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-19 6:18 [PATCH 0/3] Bug Fixes for PRUSS irqchip driver MD Danish Anwar
2023-09-19 6:18 ` [PATCH 1/3] irqchip/irq-pruss-intc: Fix enabling of intc events MD Danish Anwar
2023-09-19 6:18 ` [PATCH 2/3] irqchip/irq-pruss-intc: Fix listed IRQ type in /proc/interrupts MD Danish Anwar
2023-09-19 6:19 ` MD Danish Anwar [this message]
2023-09-19 7:32 ` [PATCH 3/3] irqchip/irq-pruss-intc: Fix processing of IEP interrupts Marc Zyngier
2026-02-18 7:08 ` Meghana Malladi
2026-02-18 11:04 ` Marc Zyngier
2026-02-18 11:26 ` Meghana Malladi
2026-02-22 20:59 ` Thomas Gleixner
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=20230919061900.369300-4-danishanwar@ti.com \
--to=danishanwar@ti.com \
--cc=afd@ti.com \
--cc=david@lechnology.com \
--cc=grzegorz.jaszczyk@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=r-gunasekaran@ti.com \
--cc=rogerq@kernel.org \
--cc=s-anna@ti.com \
--cc=srk@ti.com \
--cc=tglx@linutronix.de \
--cc=vigneshr@ti.com \
/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
all inboxes | Powered by JetHome®