From: Andrew Bresticker <abrestic@chromium.org>
To: Ralf Baechle <ralf@linux-mips.org>,
Thomas Gleixner <tglx@linutronix.de>,
Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Bresticker <abrestic@chromium.org>,
Jeffrey Deans <jeffrey.deans@imgtec.com>,
Markos Chandras <markos.chandras@imgtec.com>,
Paul Burton <paul.burton@imgtec.com>,
Qais Yousef <qais.yousef@imgtec.com>,
Jonas Gorski <jogo@openwrt.org>,
John Crispin <blogic@openwrt.org>,
David Daney <ddaney.cavm@gmail.com>,
linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
Subject: [PATCH V2 17/24] irqchip: mips-gic: Use IRQ domains
Date: Thu, 18 Sep 2014 14:47:23 -0700 [thread overview]
Message-ID: <1411076851-28242-18-git-send-email-abrestic@chromium.org> (raw)
In-Reply-To: <1411076851-28242-1-git-send-email-abrestic@chromium.org>
Use a simple IRQ domain for the MIPS GIC. Remove the gic_platform_init
callback as it's no longer necessary for it to set the irqchip.
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Reviewed-by: Qais Yousef <qais.yousef@imgtec.com>
Tested-by: Qais Yousef <qais.yousef@imgtec.com>
---
Changes from v1:
- hold spinlock across gic_irq_domain_map because of r-m-w ops
---
arch/mips/include/asm/gic.h | 1 -
arch/mips/mti-malta/malta-int.c | 8 -------
arch/mips/mti-sead3/sead3-int.c | 15 -------------
drivers/irqchip/irq-mips-gic.c | 48 ++++++++++++++++++++++++++++++++++-------
4 files changed, 40 insertions(+), 32 deletions(-)
diff --git a/arch/mips/include/asm/gic.h b/arch/mips/include/asm/gic.h
index 662b567..efcf4de 100644
--- a/arch/mips/include/asm/gic.h
+++ b/arch/mips/include/asm/gic.h
@@ -385,5 +385,4 @@ extern void gic_bind_eic_interrupt(int irq, int set);
extern unsigned int gic_get_timer_pending(void);
extern void gic_get_int_mask(unsigned long *dst, const unsigned long *src);
extern unsigned int gic_get_int(void);
-extern void gic_platform_init(int irqs, struct irq_chip *irq_controller);
#endif /* _ASM_GICREGS_H */
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
index b60adfd..e56563c 100644
--- a/arch/mips/mti-malta/malta-int.c
+++ b/arch/mips/mti-malta/malta-int.c
@@ -714,11 +714,3 @@ int malta_be_handler(struct pt_regs *regs, int is_fixup)
return retval;
}
-
-void __init gic_platform_init(int irqs, struct irq_chip *irq_controller)
-{
- int i;
-
- for (i = gic_irq_base; i < (gic_irq_base + irqs); i++)
- irq_set_chip(i, irq_controller);
-}
diff --git a/arch/mips/mti-sead3/sead3-int.c b/arch/mips/mti-sead3/sead3-int.c
index 03f9865..8f36342 100644
--- a/arch/mips/mti-sead3/sead3-int.c
+++ b/arch/mips/mti-sead3/sead3-int.c
@@ -85,18 +85,3 @@ void __init arch_init_irq(void)
ARRAY_SIZE(gic_intr_map), MIPS_GIC_IRQ_BASE);
}
-void __init gic_platform_init(int irqs, struct irq_chip *irq_controller)
-{
- int i;
-
- /*
- * For non-EIC mode, we want to setup the GIC in pass-through
- * mode, as if the GIC didn't exist. Do not map any interrupts
- * for an external interrupt controller.
- */
- if (!cpu_has_veic)
- return;
-
- for (i = gic_irq_base; i < (gic_irq_base + irqs); i++)
- irq_set_chip_and_handler(i, irq_controller, handle_percpu_irq);
-}
diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
index 5e12777..64dc5a9 100644
--- a/drivers/irqchip/irq-mips-gic.c
+++ b/drivers/irqchip/irq-mips-gic.c
@@ -44,6 +44,7 @@ static struct gic_pcpu_mask pcpu_masks[NR_CPUS];
static struct gic_pending_regs pending_regs[NR_CPUS];
static struct gic_intrmask_regs intrmask_regs[NR_CPUS];
static DEFINE_SPINLOCK(gic_lock);
+static struct irq_domain *gic_irq_domain;
#if defined(CONFIG_CSRC_GIC) || defined(CONFIG_CEVT_GIC)
cycle_t gic_read_count(void)
@@ -230,24 +231,26 @@ unsigned int gic_get_int(void)
static void gic_mask_irq(struct irq_data *d)
{
- GIC_CLR_INTR_MASK(d->irq - gic_irq_base);
+ GIC_CLR_INTR_MASK(d->hwirq);
}
static void gic_unmask_irq(struct irq_data *d)
{
- GIC_SET_INTR_MASK(d->irq - gic_irq_base);
+ GIC_SET_INTR_MASK(d->hwirq);
}
static void gic_ack_irq(struct irq_data *d)
{
+ unsigned int irq = d->hwirq;
+
/* Clear edge detector */
- if (gic_irq_flags[d->irq - gic_irq_base] & GIC_TRIG_EDGE)
- GICWRITE(GIC_REG(SHARED, GIC_SH_WEDGE), d->irq - gic_irq_base);
+ if (gic_irq_flags[irq] & GIC_TRIG_EDGE)
+ GICWRITE(GIC_REG(SHARED, GIC_SH_WEDGE), irq);
}
static int gic_set_type(struct irq_data *d, unsigned int type)
{
- unsigned int irq = d->irq - gic_irq_base;
+ unsigned int irq = d->hwirq;
unsigned long flags;
bool is_edge;
@@ -302,7 +305,7 @@ static int gic_set_type(struct irq_data *d, unsigned int type)
static int gic_set_affinity(struct irq_data *d, const struct cpumask *cpumask,
bool force)
{
- unsigned int irq = (d->irq - gic_irq_base);
+ unsigned int irq = d->hwirq;
cpumask_t tmp = CPU_MASK_NONE;
unsigned long flags;
int i;
@@ -345,6 +348,7 @@ static void __init gic_setup_intr(unsigned int intr, unsigned int cpu,
unsigned int flags)
{
struct gic_shared_intr_map *map_ptr;
+ int i;
/* Setup Intr to Pin mapping */
if (pin & GIC_MAP_TO_NMI_MSK) {
@@ -382,6 +386,8 @@ static void __init gic_setup_intr(unsigned int intr, unsigned int cpu,
GIC_CLR_INTR_MASK(intr);
/* Initialise per-cpu Interrupt software masks */
+ for (i = 0; i < NR_CPUS; i++)
+ clear_bit(intr, pcpu_masks[i].pcpu_mask);
set_bit(intr, pcpu_masks[cpu].pcpu_mask);
if ((flags & GIC_FLAG_TRANSPARENT) && (cpu_has_veic == 0))
@@ -433,6 +439,29 @@ static void __init gic_basic_init(int numintrs, int numvpes,
vpe_local_setup(numvpes);
}
+static int gic_irq_domain_map(struct irq_domain *d, unsigned int virq,
+ irq_hw_number_t hw)
+{
+ unsigned long flags;
+
+ irq_set_chip_and_handler(virq, &gic_irq_controller, handle_level_irq);
+
+ spin_lock_irqsave(&gic_lock, flags);
+ GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_MAP_TO_PIN(hw)),
+ GIC_MAP_TO_PIN_MSK | 0);
+ /* Map to VPE 0 by default */
+ GIC_SH_MAP_TO_VPE_SMASK(hw, 0);
+ set_bit(hw, pcpu_masks[0].pcpu_mask);
+ spin_unlock_irqrestore(&gic_lock, flags);
+
+ return 0;
+}
+
+static struct irq_domain_ops gic_irq_domain_ops = {
+ .map = gic_irq_domain_map,
+ .xlate = irq_domain_xlate_twocell,
+};
+
void __init gic_init(unsigned long gic_base_addr,
unsigned long gic_addrspace_size,
struct gic_intr_map *intr_map, unsigned int intr_map_size,
@@ -454,7 +483,10 @@ void __init gic_init(unsigned long gic_base_addr,
GIC_SH_CONFIG_NUMVPES_SHF;
numvpes = numvpes + 1;
- gic_basic_init(numintrs, numvpes, intr_map, intr_map_size);
+ gic_irq_domain = irq_domain_add_simple(NULL, GIC_NUM_INTRS, irqbase,
+ &gic_irq_domain_ops, NULL);
+ if (!gic_irq_domain)
+ panic("Failed to add GIC IRQ domain");
- gic_platform_init(numintrs, &gic_irq_controller);
+ gic_basic_init(numintrs, numvpes, intr_map, intr_map_size);
}
--
2.1.0.rc2.206.gedb03e5
next prev parent reply other threads:[~2014-09-18 21:49 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-18 21:47 [PATCH V2 00/24] MIPS GIC cleanup, part 1 Andrew Bresticker
2014-09-18 21:47 ` [PATCH V2 01/24] MIPS: Always use IRQ domains for CPU IRQs Andrew Bresticker
2014-09-18 21:47 ` [PATCH V2 02/24] MIPS: Rename mips_cpu_intc_init() -> mips_cpu_irq_of_init() Andrew Bresticker
2014-09-18 21:47 ` [PATCH V2 03/24] MIPS: Provide a generic plat_irq_dispatch Andrew Bresticker
2014-09-18 21:47 ` [PATCH V2 04/24] MIPS: Set vint handler when mapping CPU interrupts Andrew Bresticker
2014-09-18 21:47 ` [PATCH V2 05/24] MIPS: i8259: Use IRQ domains Andrew Bresticker
2014-09-18 21:47 ` [PATCH V2 06/24] MIPS: Add hook to get C0 performance counter interrupt Andrew Bresticker
2014-09-18 21:47 ` [PATCH V2 07/24] MIPS: smp-cps: Enable all hardware interrupts on secondary CPUs Andrew Bresticker
2014-09-18 21:47 ` [PATCH V2 08/24] MIPS: Remove gic_{enable,disable}_interrupt() Andrew Bresticker
2014-09-18 21:47 ` [PATCH V2 09/24] MIPS: sead3: Remove sead3-serial.c Andrew Bresticker
2014-09-18 21:47 ` [PATCH V2 10/24] MIPS: sead3: Do not overlap CPU/GIC IRQ ranges Andrew Bresticker
2014-09-18 21:47 ` [PATCH V2 11/24] MIPS: Malta: Move MSC01 interrupt base Andrew Bresticker
2014-09-18 21:47 ` [PATCH V2 12/24] MIPS: Move MIPS_GIC_IRQ_BASE into platform irq.h Andrew Bresticker
2014-09-18 21:47 ` [PATCH V2 13/24] MIPS: Move GIC to drivers/irqchip/ Andrew Bresticker
2014-09-18 21:47 ` [PATCH V2 14/24] irqchip: mips-gic: Remove platform irq_ack/irq_eoi callbacks Andrew Bresticker
2014-09-18 21:47 ` [PATCH V2 15/24] irqchip: mips-gic: Implement irq_set_type callback Andrew Bresticker
2014-09-18 21:47 ` [PATCH V2 16/24] irqchip: mips-gic: Fix gic_set_affinity() return value Andrew Bresticker
2014-09-18 21:47 ` Andrew Bresticker [this message]
2014-09-18 21:47 ` [PATCH V2 18/24] irqchip: mips-gic: Stop using per-platform mapping tables Andrew Bresticker
2015-01-15 11:59 ` James Hogan
2015-01-15 16:29 ` James Hogan
2015-01-15 16:36 ` Qais Yousef
2015-01-15 16:50 ` James Hogan
2015-01-15 16:58 ` Andrew Bresticker
2015-01-15 17:25 ` James Hogan
2014-09-18 21:47 ` [PATCH V2 19/24] irqchip: mips-gic: Probe for number of external interrupts Andrew Bresticker
2014-09-18 21:47 ` [PATCH V2 20/24] irqchip: mips-gic: Use separate edge/level irq_chips Andrew Bresticker
2014-09-18 21:47 ` [PATCH V2 21/24] irqchip: mips-gic: Support local interrupts Andrew Bresticker
2014-09-18 21:47 ` [PATCH V2 22/24] irqchip: mips-gic: Remove unnecessary globals Andrew Bresticker
2014-09-18 21:47 ` [PATCH V2 23/24] MIPS: Malta: Use generic plat_irq_dispatch Andrew Bresticker
2014-09-18 21:47 ` [PATCH V2 24/24] MIPS: sead3: " Andrew Bresticker
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=1411076851-28242-18-git-send-email-abrestic@chromium.org \
--to=abrestic@chromium.org \
--cc=blogic@openwrt.org \
--cc=ddaney.cavm@gmail.com \
--cc=jason@lakedaemon.net \
--cc=jeffrey.deans@imgtec.com \
--cc=jogo@openwrt.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=markos.chandras@imgtec.com \
--cc=paul.burton@imgtec.com \
--cc=qais.yousef@imgtec.com \
--cc=ralf@linux-mips.org \
--cc=tglx@linutronix.de \
/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®