Skip to contentSkip to conversation

xtensa SMP queue update

PATCH Superseded Max Filippov 2 participants 5 messages Dec 1, 2013

Subsystems (4)
lore
Share & tools
lore

Max Filippov

author maintainer
#0 lore raw

v3 cover xtensa SMP queue update

Hi Chris,

this two patches are v3 update for the SMP series, they replace "xtensa: move built-in PIC to drivers/irqchip" and "xtensa: add MX irqchip" patches. You can also find them under xtensa-smp-20131201 tag in my tree.

Signature · 1 line
1.8.1.4
author maintainer
#1 lore raw

PATCH v3 11/17 xtensa: move built-in PIC to drivers/irqchip

Extract xtensa built-in interrupt controller implementation from xtensa/kernel/irq.c and move it to other irqchips, providing way to instantiate it from the device tree.

---
Changes v1 -> v3:
- update compatible string for PIC irqchip

 arch/xtensa/include/asm/irq.h      |   7 ++
 arch/xtensa/kernel/irq.c           | 137 ++++++++-----------------------------
 drivers/irqchip/Makefile           |   1 +
 drivers/irqchip/irq-xtensa-pic.c   | 108 +++++++++++++++++++++++++++++
 include/linux/irqchip/xtensa-pic.h |  18 +++++
 5 files changed, 164 insertions(+), 107 deletions(-)
 create mode 100644 drivers/irqchip/irq-xtensa-pic.c
 create mode 100644 include/linux/irqchip/xtensa-pic.h
arch/xtensa/include/asm/irq.h +7 -0
index 4c0ccc9..16464f2 100644
@@ -43,5 +43,12 @@ static __inline__ int irq_canonicalize(int irq)
 }
 
 struct irqaction;
+struct irq_domain;
+
+int xtensa_irq_domain_xlate(const u32 *intspec, unsigned int intsize,
+		unsigned long int_irq, unsigned long ext_irq,
+		unsigned long *out_hwirq, unsigned int *out_type);
+int xtensa_irq_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw);
+unsigned xtensa_map_ext_irq(unsigned ext_irq);
 
 #endif	/* _XTENSA_IRQ_H */
arch/xtensa/kernel/irq.c +30 -107

196 lines not on this page · raw message

drivers/irqchip/Makefile +1 -0
index c60b901..c81a7f3 100644
@@ -22,3 +22,4 @@ obj-$(CONFIG_RENESAS_IRQC)		+= irq-renesas-irqc.o
 obj-$(CONFIG_VERSATILE_FPGA_IRQ)	+= irq-versatile-fpga.o
 obj-$(CONFIG_ARCH_VT8500)		+= irq-vt8500.o
 obj-$(CONFIG_TB10X_IRQC)		+= irq-tb10x.o
+obj-$(CONFIG_XTENSA)			+= irq-xtensa-pic.o
drivers/irqchip/irq-xtensa-pic.c new file +108 -0

108 lines not on this page · raw message

include/linux/irqchip/xtensa-pic.h new file +18 -0
new file mode 100644
index 0000000..48718ae
@@ -0,0 +1,18 @@
+/*
+ * Xtensa built-in interrupt controller
+ *
+ * Copyright (C) 2002 - 2013 Tensilica, Inc.
+ * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#ifndef __LINUX_IRQCHIP_XTENSA_PIC_H
+#define __LINUX_IRQCHIP_XTENSA_PIC_H
+
+struct device_node;
+int xtensa_pic_init_legacy(struct device_node *interrupt_parent);
+
+#endif /* __LINUX_IRQCHIP_XTENSA_PIC_H */
Signature · 1 line
1.8.1.4
#2 lore raw

Re: [Linux-Xtensa] [PATCH v3 11/17] xtensa: move built-in PIC to drivers/irqchip

Hi Max,

Quoted 8 lines · Max Filippov

Extract xtensa built-in interrupt controller implementation from xtensa/kernel/irq.c and move it to other irqchips, providing way to instantiate it from the device tree.

---
Changes v1 -> v3:
- update compatible string for PIC irqchip

[...]

Quoted 3 lines

#ifdef CONFIG_OF

arch/xtensa/kernel/irq.c +0 -2
-	/* The interrupt controller device node is mandatory */
-	intc = of_find_compatible_node(NULL, NULL, "xtensa,pic");

[...]

Quoted 1 line

+IRQCHIP_DECLARE(xtensa_irq_chip, "cdns,xtensa-pic", xtensa_pic_init);

This changes the binding for an existing in-tree user (arch/xtensa/boot/dts/xtfpga.dtsi). I think this user should also be updated.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - [email protected] - tel: +972.2.679.5364, http://www.tkos.co.il -
author maintainer
#3 lore raw

PATCH v4 11/17 xtensa: move built-in PIC to drivers/irqchip

Extract xtensa built-in interrupt controller implementation from xtensa/kernel/irq.c and move it to other irqchips, providing way to instantiate it from the device tree.

---
Changes v3 -> v4:
- also update matching compatible string used in xtfpga.dtsi

Changes v1 -> v3:
- update compatible string for PIC irqchip

 arch/xtensa/boot/dts/xtfpga.dtsi   |   2 +-
 arch/xtensa/include/asm/irq.h      |   7 ++
 arch/xtensa/kernel/irq.c           | 137 ++++++++-----------------------------
 drivers/irqchip/Makefile           |   1 +
 drivers/irqchip/irq-xtensa-pic.c   | 108 +++++++++++++++++++++++++++++
 include/linux/irqchip/xtensa-pic.h |  18 +++++
 6 files changed, 165 insertions(+), 108 deletions(-)
 create mode 100644 drivers/irqchip/irq-xtensa-pic.c
 create mode 100644 include/linux/irqchip/xtensa-pic.h
arch/xtensa/boot/dts/xtfpga.dtsi +1 -1
index 7eda6ec..b042c3f 100644
@@ -26,7 +26,7 @@
 	};
 
 	pic: pic {
-		compatible = "xtensa,pic";
+		compatible = "cdns,xtensa-pic";
 		/* one cell: internal irq number,
 		 * two cells: second cell == 0: internal irq number
 		 *            second cell == 1: external irq number
arch/xtensa/include/asm/irq.h +7 -0
index 4c0ccc9..16464f2 100644
@@ -43,5 +43,12 @@ static __inline__ int irq_canonicalize(int irq)
 }
 
 struct irqaction;
+struct irq_domain;
+
+int xtensa_irq_domain_xlate(const u32 *intspec, unsigned int intsize,
+		unsigned long int_irq, unsigned long ext_irq,
+		unsigned long *out_hwirq, unsigned int *out_type);
+int xtensa_irq_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw);
+unsigned xtensa_map_ext_irq(unsigned ext_irq);
 
 #endif	/* _XTENSA_IRQ_H */
arch/xtensa/kernel/irq.c +30 -107

196 lines not on this page · raw message

drivers/irqchip/Makefile +1 -0
index c60b901..c81a7f3 100644
@@ -22,3 +22,4 @@ obj-$(CONFIG_RENESAS_IRQC)		+= irq-renesas-irqc.o
 obj-$(CONFIG_VERSATILE_FPGA_IRQ)	+= irq-versatile-fpga.o
 obj-$(CONFIG_ARCH_VT8500)		+= irq-vt8500.o
 obj-$(CONFIG_TB10X_IRQC)		+= irq-tb10x.o
+obj-$(CONFIG_XTENSA)			+= irq-xtensa-pic.o
drivers/irqchip/irq-xtensa-pic.c new file +108 -0

108 lines not on this page · raw message

include/linux/irqchip/xtensa-pic.h new file +18 -0
new file mode 100644
index 0000000..48718ae
@@ -0,0 +1,18 @@
+/*
+ * Xtensa built-in interrupt controller
+ *
+ * Copyright (C) 2002 - 2013 Tensilica, Inc.
+ * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#ifndef __LINUX_IRQCHIP_XTENSA_PIC_H
+#define __LINUX_IRQCHIP_XTENSA_PIC_H
+
+struct device_node;
+int xtensa_pic_init_legacy(struct device_node *interrupt_parent);
+
+#endif /* __LINUX_IRQCHIP_XTENSA_PIC_H */
Signature · 1 line
1.8.1.4
author maintainer
#4 lore raw

PATCH v3 14/17 xtensa: add MX irqchip

In reply to Max Filippov

MX is an interrupt distributor used in some SMP-capable xtensa configurations.

---
Changes v2 -> v3:
- update compatible string for MX irqchip

Changes v1 -> v2:
- don't disable preemption in the else clause of xtensa_mx_irq_[un]mask as these functions should be always called with preemption disabled.

 arch/xtensa/include/asm/irq.h       |   1 +
 arch/xtensa/include/asm/mxregs.h    |  46 ++++++++++
 arch/xtensa/include/asm/processor.h |  20 +++++
 arch/xtensa/kernel/irq.c            |   8 ++
 drivers/irqchip/Kconfig             |   4 +
 drivers/irqchip/Makefile            |   1 +
 drivers/irqchip/irq-xtensa-mx.c     | 164 ++++++++++++++++++++++++++++++++++++
 include/linux/irqchip/xtensa-mx.h   |  17 ++++
 8 files changed, 261 insertions(+)
 create mode 100644 arch/xtensa/include/asm/mxregs.h
 create mode 100644 drivers/irqchip/irq-xtensa-mx.c
 create mode 100644 include/linux/irqchip/xtensa-mx.h
arch/xtensa/include/asm/irq.h +1 -0
index 16464f2..7d194d4 100644
@@ -50,5 +50,6 @@ int xtensa_irq_domain_xlate(const u32 *intspec, unsigned int intsize,
 		unsigned long *out_hwirq, unsigned int *out_type);
 int xtensa_irq_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw);
 unsigned xtensa_map_ext_irq(unsigned ext_irq);
+unsigned xtensa_get_ext_irq_no(unsigned irq);
 
 #endif	/* _XTENSA_IRQ_H */
arch/xtensa/include/asm/mxregs.h new file +46 -0

46 lines not on this page · raw message

arch/xtensa/include/asm/processor.h +20 -0
index 7e409a5..abb5970 100644
@@ -191,5 +191,25 @@ extern unsigned long get_wchan(struct task_struct *p);
 #define set_sr(x,sr) ({unsigned int v=(unsigned int)x; WSR(v,sr);})
 #define get_sr(sr) ({unsigned int v; RSR(v,sr); v; })
 
+#ifndef XCHAL_HAVE_EXTERN_REGS
+#define XCHAL_HAVE_EXTERN_REGS 0
+#endif
+
+#if XCHAL_HAVE_EXTERN_REGS
+
+static inline void set_er(unsigned long value, unsigned long addr)
+{
+	asm volatile ("wer %0, %1" : : "a" (value), "a" (addr) : "memory");
+}
+
+static inline unsigned long get_er(unsigned long addr)
+{
+	register unsigned long value;
+	asm volatile ("rer %0, %1" : "=a" (value) : "a" (addr) : "memory");
+	return value;
+}
+
+#endif /* XCHAL_HAVE_EXTERN_REGS */
+
 #endif	/* __ASSEMBLY__ */
 #endif	/* _XTENSA_PROCESSOR_H */
arch/xtensa/kernel/irq.c +8 -0
index 3cef58e..7d49730 100644
@@ -123,6 +123,14 @@ unsigned xtensa_map_ext_irq(unsigned ext_irq)
 	return XCHAL_NUM_INTERRUPTS;
 }
 
+unsigned xtensa_get_ext_irq_no(unsigned irq)
+{
+	unsigned mask = (XCHAL_INTTYPE_MASK_EXTERN_EDGE |
+		XCHAL_INTTYPE_MASK_EXTERN_LEVEL) &
+		((1u << irq) - 1);
+	return hweight32(mask);
+}
+
 void __init init_IRQ(void)
 {
 #ifdef CONFIG_OF
drivers/irqchip/Kconfig +4 -0
index 3792a1a..07bc79c 100644
@@ -61,3 +61,7 @@ config VERSATILE_FPGA_IRQ_NR
        int
        default 4
        depends on VERSATILE_FPGA_IRQ
+
+config XTENSA_MX
+	bool
+	select IRQ_DOMAIN
drivers/irqchip/Makefile +1 -0
index c81a7f3..66913f9 100644
@@ -23,3 +23,4 @@ obj-$(CONFIG_VERSATILE_FPGA_IRQ)	+= irq-versatile-fpga.o
 obj-$(CONFIG_ARCH_VT8500)		+= irq-vt8500.o
 obj-$(CONFIG_TB10X_IRQC)		+= irq-tb10x.o
 obj-$(CONFIG_XTENSA)			+= irq-xtensa-pic.o
+obj-$(CONFIG_XTENSA_MX)			+= irq-xtensa-mx.o
drivers/irqchip/irq-xtensa-mx.c new file +164 -0

164 lines not on this page · raw message

include/linux/irqchip/xtensa-mx.h new file +17 -0
new file mode 100644
index 0000000..9c3b6ec
@@ -0,0 +1,17 @@
+/*
+ * Xtensa MX interrupt distributor
+ *
+ * Copyright (C) 2002 - 2013 Tensilica, Inc.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#ifndef __LINUX_IRQCHIP_XTENSA_MX_H
+#define __LINUX_IRQCHIP_XTENSA_MX_H
+
+struct device_node;
+int xtensa_mx_init_legacy(struct device_node *interrupt_parent);
+
+#endif /* __LINUX_IRQCHIP_XTENSA_MX_H */
Signature · 1 line
1.8.1.4