ARC: [intc-*] Do a domain lookup in primary handler for hwirq -> linux virq

The primary interrupt handler arch_do_IRQ() was passing hwirq as linux
virq to core code. This was fragile and worked so far as we only had legacy/linear
domains.

This came out of a rant by Marc Zyngier.
http://lists.infradead.org/pipermail/linux-snps-arc/2015-December/000298.html

Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Noam Camus <noamc@ezchip.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
This commit is contained in:
Vineet Gupta 2016-01-01 15:12:54 +05:30
parent 88555cc584
commit 1b0ccb8a4e
4 changed files with 15 additions and 14 deletions

View File

@ -31,6 +31,7 @@ config ARC
select HAVE_MOD_ARCH_SPECIFIC if ARC_DW2_UNWIND select HAVE_MOD_ARCH_SPECIFIC if ARC_DW2_UNWIND
select HAVE_OPROFILE select HAVE_OPROFILE
select HAVE_PERF_EVENTS select HAVE_PERF_EVENTS
select HANDLE_DOMAIN_IRQ
select IRQ_DOMAIN select IRQ_DOMAIN
select MODULES_USE_ELF_RELA select MODULES_USE_ELF_RELA
select NO_BOOTMEM select NO_BOOTMEM

View File

@ -137,21 +137,24 @@ static const struct irq_domain_ops arcv2_irq_ops = {
.map = arcv2_irq_map, .map = arcv2_irq_map,
}; };
static struct irq_domain *root_domain;
static int __init static int __init
init_onchip_IRQ(struct device_node *intc, struct device_node *parent) init_onchip_IRQ(struct device_node *intc, struct device_node *parent)
{ {
struct irq_domain *root_domain;
if (parent) if (parent)
panic("DeviceTree incore intc not a root irq controller\n"); panic("DeviceTree incore intc not a root irq controller\n");
root_domain = irq_domain_add_legacy(intc, NR_CPU_IRQS, 0, 0, root_domain = irq_domain_add_legacy(intc, NR_CPU_IRQS, 0, 0,
&arcv2_irq_ops, NULL); &arcv2_irq_ops, NULL);
if (!root_domain) if (!root_domain)
panic("root irq domain not avail\n"); panic("root irq domain not avail\n");
/* with this we don't need to export root_domain */ /*
* Needed for primary domain lookup to succeed
* This is a primary irqchip, and can never have a parent
*/
irq_set_default_host(root_domain); irq_set_default_host(root_domain);
return 0; return 0;

View File

@ -97,21 +97,23 @@ static const struct irq_domain_ops arc_intc_domain_ops = {
.map = arc_intc_domain_map, .map = arc_intc_domain_map,
}; };
static struct irq_domain *root_domain;
static int __init static int __init
init_onchip_IRQ(struct device_node *intc, struct device_node *parent) init_onchip_IRQ(struct device_node *intc, struct device_node *parent)
{ {
struct irq_domain *root_domain;
if (parent) if (parent)
panic("DeviceTree incore intc not a root irq controller\n"); panic("DeviceTree incore intc not a root irq controller\n");
root_domain = irq_domain_add_legacy(intc, NR_CPU_IRQS, 0, 0, root_domain = irq_domain_add_legacy(intc, NR_CPU_IRQS, 0, 0,
&arc_intc_domain_ops, NULL); &arc_intc_domain_ops, NULL);
if (!root_domain) if (!root_domain)
panic("root irq domain not avail\n"); panic("root irq domain not avail\n");
/* with this we don't need to export root_domain */ /*
* Needed for primary domain lookup to succeed
* This is a primary irqchip, and can never have a parent
*/
irq_set_default_host(root_domain); irq_set_default_host(root_domain);
return 0; return 0;

View File

@ -41,12 +41,7 @@ void __init init_IRQ(void)
* "C" Entry point for any ARC ISR, called from low level vector handler * "C" Entry point for any ARC ISR, called from low level vector handler
* @irq is the vector number read from ICAUSE reg of on-chip intc * @irq is the vector number read from ICAUSE reg of on-chip intc
*/ */
void arch_do_IRQ(unsigned int irq, struct pt_regs *regs) void arch_do_IRQ(unsigned int hwirq, struct pt_regs *regs)
{ {
struct pt_regs *old_regs = set_irq_regs(regs); handle_domain_irq(NULL, hwirq, regs);
irq_enter();
generic_handle_irq(irq);
irq_exit();
set_irq_regs(old_regs);
} }