From: Liu Hua <sdu.liu@huawei.com>
To: <tglx@linutronix.de>, <jason@lakedaemon.net>,
<nicolas.pitre@linaro.org>, <linux@arm.linux.org.uk>,
<will.deacon@arm.com>, <ebiederm@xmission.com>
Cc: <linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <wangnan0@huawei.com>,
<liuxueliu.liu@huawei.com>, <peifeiyue@huawei.com>,
<liusdu@huawei.com>, Liu Hua <sdu.liu@huawei.com>
Subject: [RFC PATCH 2/2] irqchip: GIC: introduce method to deactive interupts
Date: Fri, 11 Jul 2014 14:46:17 +0800 [thread overview]
Message-ID: <1405061177-43834-3-git-send-email-sdu.liu@huawei.com> (raw)
In-Reply-To: <1405061177-43834-1-git-send-email-sdu.liu@huawei.com>
When using kdump on ARM platform, if kernel panics in interrupt handler
(maybe PPI or SPI), the capture kernel can not recive certain interrupt,
and fails to boot.
On this situation, We have read register GICC_IAR. But we have no chance
to write relative bit to register GICC_EOIR(kernel paniced before). So
the state of this type interrupt remains active. Ant that makes gic not
deliver this type interrupt to cpu interface.
So we should not assume that all interruts state of GIC is inactive when
kernel initailize the GIC. This patch identifies this type interrupts
and deactives them;
Signed-off-by: Liu Hua <sdu.liu@huawei.com>
---
drivers/irqchip/irq-gic.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index ddee133..d8620cf 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -352,12 +352,68 @@ static u8 gic_get_cpumask(struct gic_chip_data *gic)
return mask;
}
+void gic_v1_eois(u32 active, void __iomem *cpu_base)
+{
+ int bit = -1;
+
+ while ((bit = find_next_bit((unsigned long *) &active,
+ 32, bit + 1)) < 32) {
+ writel_relaxed(bit, cpu_base + GIC_CPU_EOI);
+ }
+}
+
+void gic_v1_clear_active(void __iomem *dist_base,
+ void __iomem *cpu_base, int gic_irqs)
+{
+ int irq, offset;
+ u32 active;
+
+ for (irq = 0; irq < gic_irqs; irq += 32) {
+ offset = GIC_DIST_ACTIVE_SET + irq * 4 / 32;
+ active = readl_relaxed(dist_base + offset);
+ if (!active)
+ continue;
+ gic_v1_eois(active, cpu_base);
+ }
+}
+
+void gic_v2_clear_active(void __iomem *dist_base, int gic_irqs)
+{
+ int irq, offset;
+ u32 active;
+
+ for (irq = 0; irq < gic_irqs; irq += 32) {
+ offset = irq * 4 / 32 + GIC_DIST_ACTIVE_SET;
+ active = readl_relaxed(dist_base + offset);
+ if (!active)
+ continue;
+ offset = irq * 4 / 32 + GIC_DIST_ACTIVE_CLEAR;
+ writel_relaxed(active, dist_base + offset);
+ }
+}
+
+void __init gic_dist_clear_active(void __iomem *dist_base,
+ void __iomem *cpu_base, int gic_irqs)
+{
+ u32 ArchRev;
+
+ ArchRev = readl_relaxed(dist_base + GIC_DIST_ICPIDR2);
+ ArchRev = (ArchRev >> 4) & 0xF;
+
+ if (ArchRev == 0x1) {
+ gic_v1_clear_active(dist_base, cpu_base, gic_irqs);
+ } else {
+ gic_v2_clear_active(dist_base, gic_irqs);
+ }
+}
+
static void __init gic_dist_init(struct gic_chip_data *gic)
{
unsigned int i;
u32 cpumask;
unsigned int gic_irqs = gic->gic_irqs;
void __iomem *base = gic_data_dist_base(gic);
+ void __iomem *cpu_base = gic_data_cpu_base(gic);
writel_relaxed(0, base + GIC_DIST_CTRL);
@@ -371,6 +427,7 @@ static void __init gic_dist_init(struct gic_chip_data *gic)
writel_relaxed(cpumask, base + GIC_DIST_TARGET + i * 4 / 4);
gic_dist_config(base, gic_irqs, NULL);
+ gic_dist_clear_active(base, cpu_base, gic_irqs);
writel_relaxed(1, base + GIC_DIST_CTRL);
}
--
1.9.0
next prev parent reply other threads:[~2014-07-11 22:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-11 6:46 [RFC PATCH 0/2] irqchip: GIC: check and clear GIC interupt active status Liu Hua
2014-07-11 6:46 ` [RFC PATCH 1/2] irqchip: GIC: introduce ICPIDR2 register interface Liu Hua
2014-07-11 6:46 ` Liu Hua [this message]
2014-07-11 12:35 ` [RFC PATCH 0/2] irqchip: GIC: check and clear GIC interupt active status Will Deacon
2014-07-14 3:22 ` Liu hua
2014-07-14 9:57 ` Will Deacon
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=1405061177-43834-3-git-send-email-sdu.liu@huawei.com \
--to=sdu.liu@huawei.com \
--cc=ebiederm@xmission.com \
--cc=jason@lakedaemon.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=liusdu@huawei.com \
--cc=liuxueliu.liu@huawei.com \
--cc=nicolas.pitre@linaro.org \
--cc=peifeiyue@huawei.com \
--cc=tglx@linutronix.de \
--cc=wangnan0@huawei.com \
--cc=will.deacon@arm.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®