Simple irq_domain implementation
Subsystems (8)
v2 cover Simple irq_domain implementation
Hi all,
Not much has changed with this second posting other than it shouldn't break devicetree MIPS and Microblaze platforms anymore. I've not had the time to adapt irq_domain and powerpc to work together, but those a changes that can easily be handled in follow-on patches.
Thomas, though this is not in its final form, I think it would be good to merge it now since I've got several ARM device tree board ports ready for v3.1 that depend on at least this basic implementation. When I rework to get it in line with PowerPC, I'll also take care of any changes needed by ARM and other users.
If you agree and provide an Ack, then I think these changes should go in via devicetree/next since there are patches in there that this patch depends on.
g.
---
Grant Likely (2):
irq: add irq_domain translation infrastructure dt/irq: add irq_domain_generate_simple() helper
arch/arm/include/asm/prom.h | 5 - arch/arm/kernel/devtree.c | 14 -- arch/microblaze/include/asm/irq.h | 10 -- arch/microblaze/kernel/irq.c | 7 - arch/mips/include/asm/irq.h | 5 - arch/mips/kernel/prom.c | 14 -- arch/powerpc/include/asm/irq.h | 1 arch/x86/include/asm/irq_controller.h | 12 -- arch/x86/include/asm/prom.h | 10 -- arch/x86/kernel/devicetree.c | 101 +++++----------- include/linux/irq.h | 92 ++++++++++++++ include/linux/of_irq.h | 2 kernel/irq/Makefile | 2 kernel/irq/irqdomain.c | 215 +++++++++++++++++++++++++++++++++ 14 files changed, 346 insertions(+), 144 deletions(-) delete mode 100644 arch/x86/include/asm/irq_controller.h create mode 100644 kernel/irq/irqdomain.c
Signature · 1 line
Signature
PATCH v2 1/2 irq: add irq_domain translation infrastructure
This patch adds irq_domain infrastructure for translating from hardware irq numbers to linux irqs. This is particularly important for architectures adding device tree support because the current implementation (excluding PowerPC and SPARC) cannot handle translation for more than a single interrupt controller. irq_domain supports device tree translation for any number of interrupt controllers.
This patch converts x86, Microblaze, ARM and MIPS to use irq_domain for device tree irq translation. x86 is untested beyond compiling it, irq_domain is enabled for MIPS and Microblaze, but the old behaviour is preserved until the core code is modified to actually register an irq_domain yet. On ARM it works and is required for much of the new ARM device tree board support.
PowerPC has /not/ been converted to use this new infrastructure. It is still missing some features before it can replace the virq infrastructure already in powerpc (see documentation on irq_domain_map/unmap for details). Followup patches will add the missing pieces and migrate PowerPC to use irq_domain.
SPARC has its own method of managing interrupts from the device tree and is unaffected by this change.
--- arch/arm/include/asm/prom.h | 5 - arch/arm/kernel/devtree.c | 14 --- arch/microblaze/include/asm/irq.h | 10 -- arch/microblaze/kernel/irq.c | 7 - arch/mips/include/asm/irq.h | 5 - arch/mips/kernel/prom.c | 14 --- arch/powerpc/include/asm/irq.h | 1 arch/x86/include/asm/irq_controller.h | 12 -- arch/x86/include/asm/prom.h | 10 -- arch/x86/kernel/devicetree.c | 101 +++++++-------------- include/linux/irq.h | 81 +++++++++++++++++ include/linux/of_irq.h | 2 kernel/irq/Makefile | 2 kernel/irq/irqdomain.c | 162 +++++++++++++++++++++++++++++++++ 14 files changed, 282 insertions(+), 144 deletions(-) delete mode 100644 arch/x86/include/asm/irq_controller.h create mode 100644 kernel/irq/irqdomain.c
arch/arm/include/asm/prom.h +0 -5
@@ -16,11 +16,6 @@#include <asm/setup.h> #include <asm/irq.h> -static inline void irq_dispose_mapping (unsigned int virq) -{ -return ; -} -extern struct machine_desc *setup_machine_fdt (unsigned int dt_phys);extern void arm_dt_memblock_reserve (void );
arch/arm/kernel/devtree.c +0 -14
@@ -132,17 +132,3 @@ struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)return mdesc_best; } - -/** -* irq_create_of_mapping - Hook to resolve OF irq specifier into a Linux irq# -* -* Currently the mapping mechanism is trivial; simple flat hwirq numbers are -* mapped 1:1 onto Linux irq numbers. Cascaded irq controllers are not -* supported. -*/ -unsigned int irq_create_of_mapping (struct device_node *controller, -const u32 *intspec,unsigned int intsize) -{ -return intspec[0 ]; -} -EXPORT_SYMBOL_GPL (irq_create_of_mapping);
arch/microblaze/include/asm/irq.h +1 -9
@@ -16,6 +16,7 @@* be big enough to enclose whatever representation is used by a given * platform. */ +#define _IRQ_HW_NUMBER_Ttypedef unsigned long irq_hw_number_t ;extern unsigned int nr_irq;
@@ -25,15 +26,6 @@ extern unsigned int nr_irq;struct pt_regs ;extern void do_IRQ (struct pt_regs *regs); -/** FIXME - not implement -* irq_dispose_mapping - Unmap an interrupt -* @virq: linux virq number of the interrupt to unmap -*/ -static inline void irq_dispose_mapping (unsigned int virq) -{ -return ; -} -struct irq_host ;/**
arch/microblaze/kernel/irq.c +0 -7
@@ -54,10 +54,3 @@ unsigned int irq_create_mapping(struct irq_host *host, irq_hw_number_t hwirq)return hwirq; }EXPORT_SYMBOL_GPL (irq_create_mapping); - -unsigned int irq_create_of_mapping (struct device_node *controller, -const u32 *intspec,unsigned int intsize) -{ -return intspec[0 ]; -} -EXPORT_SYMBOL_GPL (irq_create_of_mapping);
arch/mips/include/asm/irq.h +0 -5
@@ -16,11 +16,6 @@#include <irq.h> -static inline void irq_dispose_mapping (unsigned int virq) -{ -return ; -} -#ifdef CONFIG_I8259 static inline int irq_canonicalize (int irq) {
arch/mips/kernel/prom.c +0 -14
@@ -60,20 +60,6 @@ void __init early_init_dt_setup_initrd_arch(unsigned long start, }#endif -/* -* irq_create_of_mapping - Hook to resolve OF irq specifier into a Linux irq# -* -* Currently the mapping mechanism is trivial; simple flat hwirq numbers are -* mapped 1:1 onto Linux irq numbers. Cascaded irq controllers are not -* supported. -*/ -unsigned int irq_create_of_mapping (struct device_node *controller, -const u32 *intspec,unsigned int intsize) -{ -return intspec[0 ]; -} -EXPORT_SYMBOL_GPL (irq_create_of_mapping); -void __init early_init_devtree (void *params) {/* Setup flat device-tree pointer */
arch/powerpc/include/asm/irq.h +1 -0
@@ -45,6 +45,7 @@ extern atomic_t ppc_n_lost_interrupts;* be big enough to enclose whatever representation is used by a given * platform. */ +#define _IRQ_HW_NUMBER_Ttypedef unsigned long irq_hw_number_t ;/* Interrupt controller "host" data structure. This could be defined as a
arch/x86/include/asm/irq_controller.h deleted +0 -12
@@ -1,12 +0,0 @@ -#ifndef __IRQ_CONTROLLER__ -#define __IRQ_CONTROLLER__ - -struct irq_domain { -int (*xlate)(struct irq_domain *h,const u32 *intspec,u32 intsize, -u32 *out_hwirq,u32 *out_type); -void *priv; -struct device_node *controller; -struct list_head l; -}; - -#endif
arch/x86/include/asm/prom.h +0 -10
@@ -21,7 +21,6 @@#include <asm/irq.h> #include <asm/atomic.h> #include <asm/setup.h> -#include <asm/irq_controller.h> #ifdef CONFIG_OF extern int of_ioapic;
@@ -54,15 +53,6 @@ extern char cmd_line[COMMAND_LINE_SIZE];#define pci_address_to_pio pci_address_to_piounsigned long pci_address_to_pio (phys_addr_t addr); -/** -* irq_dispose_mapping - Unmap an interrupt -* @virq: linux virq number of the interrupt to unmap -* -* FIXME: We really should implement proper virq handling like power, -* but that's going to be major surgery. -*/ -static inline void irq_dispose_mapping (unsigned int virq) { } -#define HAVE_ARCH_DEVTREE_FIXUPS #endif /* __ASSEMBLY__ */
arch/x86/kernel/devicetree.c +34 -67
147 lines not on this page · raw message
include/linux/irq.h +81 -0
116 lines not on this page · raw message
include/linux/of_irq.h +2 -0
@@ -63,6 +63,7 @@ extern int of_irq_map_one(struct device_node *device, int index,extern unsigned int irq_create_of_mapping (struct device_node *controller,const u32 *intspec,unsigned int intsize); +extern void irq_dispose_mapping (unsigned int irq);extern int of_irq_to_resource (struct device_node *dev,int index,struct resource *r);extern int of_irq_count (struct device_node *dev);
@@ -70,6 +71,7 @@ extern int of_irq_to_resource_table(struct device_node *dev, struct resource *res, int nr_irqs);extern struct device_node *of_irq_find_parent (struct device_node *child); +#endif /* CONFIG_OF_IRQ */ #endif /* CONFIG_OF */ #endif /* __OF_IRQ_H */
kernel/irq/Makefile +1 -1
@@ -1,5 +1,5 @@ -obj-y := irqdesc.o handle.o manage.o spurious.o resend.o chip.o dummychip.o devres.o +obj-y := irqdesc.o handle.o manage.o spurious.o resend.o chip.o dummychip.o devres.o irqdomain.o obj-$(CONFIG_GENERIC_IRQ_CHIP) += generic-chip.o obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o obj-$(CONFIG_PROC_FS) += proc.o
kernel/irq/irqdomain.c new file +162 -0
162 lines not on this page · raw message
PATCH v2 2/2 dt/irq: add irq_domain_generate_simple() helper
In reply to Grant Likelyirq_domain_generate_simple() is an easy way to generate an irq translation domain for simple irq controllers. It assumes a flat 1:1 mapping from hardware irq number to an offset of the first linux irq number assigned to the controller
--- include/linux/irq.h | 11 ++++++++++ kernel/irq/irqdomain.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 65 insertions(+), 1 deletions(-)
include/linux/irq.h +11 -0
@@ -797,6 +797,17 @@ extern unsigned int irq_domain_map(struct irq_domain *domain, irq_hw_number_t hwirq);extern void irq_domain_unmap (struct irq_domain *domain,irq_hw_number_t hw); +struct of_device_id ; +#ifdef CONFIG_OF +extern void irq_domain_add_simple (struct device_node *controller,int irq_base); +extern void irq_domain_generate_simple (const struct of_device_id *match, +u64 phys_base,unsigned int irq_start); +#else +static inline void irq_domain_generate_simple (const struct of_device_id *match, +u64 phys_base,unsigned int irq_start) { } +#endif + +#endif /* !CONFIG_S390 */ #endif /* _LINUX_IRQ_H */
kernel/irq/irqdomain.c +54 -1
66 lines not on this page · raw message
Re: [PATCH v2 1/2] irq: add irq_domain translation infrastructure
In reply to Grant LikelyQuoted 15 lines · Grant Likely
This patch adds
irq_domaininfrastructure for translating from hardware irq numbers to linux irqs. This is particularly important for architectures adding device tree support because the current implementation (excluding PowerPC and SPARC) cannot handle translation for more than a single interrupt controller.irq_domainsupports device tree translation for any number of interrupt controllers.This patch converts x86, Microblaze, ARM and MIPS to use
irq_domainfor device tree irq translation. x86 is untested beyond compiling it,irq_domainis enabled for MIPS and Microblaze, but the old behaviour is preserved until the core code is modified to actually register anirq_domainyet. On ARM it works and is required for much of the new ARM device tree board support.
Quoted 8 lines
PowerPC has /not/ been converted to use this new infrastructure. It is still missing some features before it can replace the virq infrastructure already in powerpc (see documentation on irq_domain_map/unmap for details). Followup patches will add the missing pieces and migrate PowerPC to use
irq_domain.SPARC has its own method of managing interrupts from the device tree and is unaffected by this change.
I like it - yet another building block of the conversion of MIPS to DT in place.
Thanks,
Ralf