History

genirq: Move non-irqdomain handle_domain_irq() handling into ARM's handle_IRQ()

Despite the name, handle_domain_irq() deals with non-irqdomain handling for the sake of a handful of legacy ARM platforms. Move such handling into ARM's handle_IRQ(), allowing for better code generation for everyone else. This allows us get rid of some complexity, and to rearrange the guards on the various helpers in a more logical way.

Marc Zyngier committed 5 years ago

Commit e1c05491 parent 8240ef53 files · +33 −33Browse files

Unified · Split

3 files
  1. arch/arm/kernel/irq.c +21 −1
  2. include/linux/irqdesc.h +4 −10
  3. kernel/irq/irqdesc.c +8 −22
arch/arm/kernel/irq.c+21−1
@@ -63,7 +63,27 @@ int arch_show_interrupts(struct seq_file *p, int prec) · 62 unmodified lines
63 */63 */
64void handle_IRQ(unsigned int irq, struct pt_regs *regs)64void handle_IRQ(unsigned int irq, struct pt_regs *regs)
65{65{
66 __handle_domain_irq(NULL, irq, false, regs);66 struct pt_regs *old_regs = set_irq_regs(regs);
67 struct irq_desc *desc;
68
69 irq_enter();
70
71 /*
72 * Some hardware gives randomly wrong interrupts. Rather
73 * than crashing, do something sensible.
74 */
75 if (unlikely(!irq || irq >= nr_irqs))
76 desc = NULL;
77 else
78 desc = irq_to_desc(irq);
79
80 if (likely(desc))
81 handle_irq_desc(desc);
82 else
83 ack_bad_irq(irq);
84
85 irq_exit();
86 set_irq_regs(old_regs);
67}87}
68 88
69/*89/*
include/linux/irqdesc.h+4−10
@@ -161,24 +161,18 @@ static inline void generic_handle_irq_desc(struct irq_desc *desc) · 160 unmodified lines
161int handle_irq_desc(struct irq_desc *desc);161int handle_irq_desc(struct irq_desc *desc);
162int generic_handle_irq(unsigned int irq);162int generic_handle_irq(unsigned int irq);
163 163
164#ifdef CONFIG_HANDLE_DOMAIN_IRQ164#ifdef CONFIG_IRQ_DOMAIN
165/*165/*
166 * Convert a HW interrupt number to a logical one using a IRQ domain,166 * Convert a HW interrupt number to a logical one using a IRQ domain,
167 * and handle the result interrupt number. Return -EINVAL if167 * and handle the result interrupt number. Return -EINVAL if
168 * conversion failed.168 * conversion failed.
169 */169 */
170int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq,
171 bool lookup, struct pt_regs *regs);
172
173int generic_handle_domain_irq(struct irq_domain *domain, unsigned int hwirq);170int generic_handle_domain_irq(struct irq_domain *domain, unsigned int hwirq);
174 171
175static inline int handle_domain_irq(struct irq_domain *domain,172#ifdef CONFIG_HANDLE_DOMAIN_IRQ
176 unsigned int hwirq, struct pt_regs *regs)173int handle_domain_irq(struct irq_domain *domain,
177{174 unsigned int hwirq, struct pt_regs *regs);
178 return __handle_domain_irq(domain, hwirq, true, regs);
179}
180 175
181#ifdef CONFIG_IRQ_DOMAIN
182int handle_domain_nmi(struct irq_domain *domain, unsigned int hwirq,176int handle_domain_nmi(struct irq_domain *domain, unsigned int hwirq,
183 struct pt_regs *regs);177 struct pt_regs *regs);
184#endif178#endif
kernel/irq/irqdesc.c+8−22
@@ -659,7 +659,7 @@ int generic_handle_irq(unsigned int irq) · 658 unmodified lines
659}659}
660EXPORT_SYMBOL_GPL(generic_handle_irq);660EXPORT_SYMBOL_GPL(generic_handle_irq);
661 661
662#ifdef CONFIG_HANDLE_DOMAIN_IRQ662#ifdef CONFIG_IRQ_DOMAIN
663/**663/**
664 * generic_handle_domain_irq - Invoke the handler for a HW irq belonging664 * generic_handle_domain_irq - Invoke the handler for a HW irq belonging
665 * to a domain, usually for a non-root interrupt665 * to a domain, usually for a non-root interrupt
@@ -676,9 +676,10 @@ int generic_handle_domain_irq(struct irq_domain *domain, unsigned int hwirq) · 10 unmodified lines
676}676}
677EXPORT_SYMBOL_GPL(generic_handle_domain_irq);677EXPORT_SYMBOL_GPL(generic_handle_domain_irq);
678 678
679#ifdef CONFIG_HANDLE_DOMAIN_IRQ
679/**680/**
680 * __handle_domain_irq - Invoke the handler for a HW irq belonging to a domain,681 * handle_domain_irq - Invoke the handler for a HW irq belonging to a domain,
681 * usually for a root interrupt controller682 * usually for a root interrupt controller
682 * @domain: The domain where to perform the lookup683 * @domain: The domain where to perform the lookup
683 * @hwirq: The HW irq number to convert to a logical one684 * @hwirq: The HW irq number to convert to a logical one
684 * @lookup: Whether to perform the domain lookup or not685 * @lookup: Whether to perform the domain lookup or not
@@ -686,8 +687,8 @@ EXPORT_SYMBOL_GPL(generic_handle_domain_irq); · 1 unmodified line
686 *687 *
687 * Returns: 0 on success, or -EINVAL if conversion has failed688 * Returns: 0 on success, or -EINVAL if conversion has failed
688 */689 */
689int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq,690int handle_domain_irq(struct irq_domain *domain,
690 bool lookup, struct pt_regs *regs)691 unsigned int hwirq, struct pt_regs *regs)
691{692{
692 struct pt_regs *old_regs = set_irq_regs(regs);693 struct pt_regs *old_regs = set_irq_regs(regs);
693 struct irq_desc *desc;694 struct irq_desc *desc;
@@ -695,22 +696,8 @@ int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq, · 1 unmodified line
695 696
696 irq_enter();697 irq_enter();
697 698
698 if (likely(IS_ENABLED(CONFIG_IRQ_DOMAIN) && lookup)) {699 /* The irqdomain code provides boundary checks */
699 /* The irqdomain code provides boundary checks */700 desc = irq_resolve_mapping(domain, hwirq);
700 desc = irq_resolve_mapping(domain, hwirq);
701 } else {
702 /*
703 * Some hardware gives randomly wrong interrupts. Rather
704 * than crashing, do something sensible.
705 */
706 if (unlikely(!hwirq || hwirq >= nr_irqs)) {
707 ack_bad_irq(hwirq);
708 desc = NULL;
709 } else {
710 desc = irq_to_desc(hwirq);
711 }
712 }
713
714 if (likely(desc))701 if (likely(desc))
715 handle_irq_desc(desc);702 handle_irq_desc(desc);
716 else703 else
@@ -721,7 +708,6 @@ int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq, · 4 unmodified lines
721 return ret;708 return ret;
722}709}
723 710
724#ifdef CONFIG_IRQ_DOMAIN
725/**711/**
726 * handle_domain_nmi - Invoke the handler for a HW irq belonging to a domain712 * handle_domain_nmi - Invoke the handler for a HW irq belonging to a domain
727 * @domain: The domain where to perform the lookup713 * @domain: The domain where to perform the lookup

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t