Skip to contentSkip to conversation

Try out the irqdomain + generic chip integration series

PATCH In review Grant Likely 5 participants 9 messages May 29, 2013 – May 30, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Try out the irqdomain + generic chip integration series

Hi Thomas,

Rather than just straight reviewing the generic irq chip patch series, I tried it out by converting another driver to use it. As far as I've been able to tell it does the right thing and you can have my ack. The first patch in this series adds another feature needed by the versatile driver. Patch 2 should be okay, but I'd like to get an ack from Ben before it gets applied.

I need to get someone to test patch 3 on hardware before you pick up that one.

Oh, and I'll reply directly to patch 7 of your series with an ack and a minor comment.

Cheers,
g.

#1 lore raw

PATCH 1/3 irqchip: Add mask to block out invalid irqs

Some controllers have irqs that aren't wired up and must never be used. For the generic chip attached to an irq_domain this provides a mask that can be used to block out particular irqs so that they never get mapped.

Cc Thomas Gleixner <[email protected]>
---
 include/linux/irq.h       | 2 ++
 kernel/irq/generic-chip.c | 3 +++
 2 files changed, 5 insertions(+)
include/linux/irq.h +2 -0
index af7052c..298a9b9 100644
@@ -679,6 +679,7 @@ struct irq_chip_type {
  * @num_ct:		Number of available irq_chip_type instances (usually 1)
  * @private:		Private data for non generic chip callbacks
  * @installed:		bitfield to denote installed interrupts
+ * @unused:		bitfield to denote unused interrupts
  * @domain:		irq domain pointer
  * @list:		List head for keeping track of instances
  * @chip_types:		Array of interrupt irq_chip_types
@@ -702,6 +703,7 @@ struct irq_chip_generic {
 	unsigned int		num_ct;
 	void			*private;
 	unsigned long		installed;
+	unsigned long		unused;
 	struct irq_domain	*domain;
 	struct list_head	list;
 	struct irq_chip_type	chip_types[0];
kernel/irq/generic-chip.c +3 -0
index 8e4d6bd..7b44aa2 100644
@@ -359,6 +359,9 @@ static int irq_map_generic_chip(struct irq_domain *d, unsigned int virq,
 
 	idx = hw_irq % dgc->irqs_per_chip;
 
+	if (test_bit(idx, &gc->unused))
+		return -ENOTSUPP;
+
 	if (test_bit(idx, &gc->installed))
 		return -EBUSY;
 
Signature · 1 line
1.8.1.2
#2 lore raw

[tip:irq/core] genirq: irqchip: Add mask to block out invalid irqs

genirq: irqchip: Add mask to block out invalid irqs
Commit-ID:  e8bd834f73714378ef110a64287db1b77033c8da
Gitweb:     http://git.kernel.org/tip/e8bd834f73714378ef110a64287db1b77033c8da
Author:     Grant Likely <[email protected]>
AuthorDate: Wed, 29 May 2013 03:10:52 +0100
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Wed, 29 May 2013 10:57:11 +0200

genirq: irqchip: Add mask to block out invalid irqs

Some controllers have irqs that aren't wired up and must never be used. For the generic chip attached to an irq_domain this provides a mask that can be used to block out particular irqs so that they never get mapped.

---
 include/linux/irq.h       | 2 ++
 kernel/irq/generic-chip.c | 3 +++
 2 files changed, 5 insertions(+)
include/linux/irq.h +2 -0
index af7052c..298a9b9 100644
@@ -679,6 +679,7 @@ struct irq_chip_type {
  * @num_ct:		Number of available irq_chip_type instances (usually 1)
  * @private:		Private data for non generic chip callbacks
  * @installed:		bitfield to denote installed interrupts
+ * @unused:		bitfield to denote unused interrupts
  * @domain:		irq domain pointer
  * @list:		List head for keeping track of instances
  * @chip_types:		Array of interrupt irq_chip_types
@@ -702,6 +703,7 @@ struct irq_chip_generic {
 	unsigned int		num_ct;
 	void			*private;
 	unsigned long		installed;
+	unsigned long		unused;
 	struct irq_domain	*domain;
 	struct list_head	list;
 	struct irq_chip_type	chip_types[0];
kernel/irq/generic-chip.c +3 -0
index 8743d62..95575d8 100644
@@ -359,6 +359,9 @@ static int irq_map_generic_chip(struct irq_domain *d, unsigned int virq,
 
 	idx = hw_irq % dgc->irqs_per_chip;
 
+	if (test_bit(idx, &gc->unused))
+		return -ENOTSUPP;
+
 	if (test_bit(idx, &gc->installed))
 		return -EBUSY;
 
#3 lore raw

PATCH 2/3 irqdomain: Relax failure path on setting up mappings

In reply to Grant Likely

Commit 98aa468e, "irqdomain: Support for static IRQ mapping and association" introduced an API for directly associating blocks of hwirqs to linux irqs. However, if any irq in that block failed to map (say if the mapping functions returns an error because the irq is already mapped) then the whole thing will fail and roll back. This is probably too aggressive since there are valid reasons why a mapping may fail. ie. Firmware may have a particular IRQ marked as unusable.

This patch drops the error path out of irq_domain_associate(). If a mapping fails, then it is simply skipped. There is no reason to fail the entire allocation.

Cc Paul Mundt <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 kernel/irq/irqdomain.c | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)
kernel/irq/irqdomain.c +3 -26
index 1db9e70..428ae1db 100644
@@ -455,28 +455,9 @@ int irq_domain_associate_many(struct irq_domain *domain, unsigned int irq_base,
 		irq_data->domain = domain;
 		if (domain->ops->map) {
 			ret = domain->ops->map(domain, virq, hwirq);
-			if (ret != 0) {
-				/*
-				 * If map() returns -EPERM, this interrupt is protected
-				 * by the firmware or some other service and shall not
-				 * be mapped.
-				 *
-				 * Since on some platforms we blindly try to map everything
-				 * we end up with a log full of backtraces.
-				 *
-				 * So instead, we silently fail on -EPERM, it is the
-				 * responsibility of the PIC driver to display a relevant
-				 * message if needed.
-				 */
-				if (ret != -EPERM) {
-					pr_err("irq-%i==>hwirq-0x%lx mapping failed: %d\n",
-					       virq, hwirq, ret);
-					WARN_ON(1);
-				}
-				irq_data->domain = NULL;
-				irq_data->hwirq = 0;
-				goto err_unmap;
-			}
+			/* Some maps are refused; this is probably just fine */
+			if (ret)
+				continue;
 		}
 
 		switch (domain->revmap_type) {
@@ -495,10 +476,6 @@ int irq_domain_associate_many(struct irq_domain *domain, unsigned int irq_base,
 	}
 
 	return 0;
-
- err_unmap:
-	irq_domain_disassociate_many(domain, irq_base, i);
-	return -EINVAL;
 }
 EXPORT_SYMBOL_GPL(irq_domain_associate_many);
 
Signature · 1 line
1.8.1.2
#4 lore raw

PATCH 3/3 irqchip: Make versatile fpga irq driver a generic chip

In reply to Grant Likely

This is an RFC patch to convert the versatile FPGA irq controller driver to use generic irq chip. It builds on the series that extends the generic chip code to allow a linear irq domain to contain one or more generic irq chips so that each interrupt controller doesn't need to hand code the generic chip setup.

I've written this as a proof of concept to see if the new generic irq code does what it needs to. I had to extend it slightly to properly handle the valid mask used by the versatile FPGA driver.

Tested on QEMU, but not on real hardware.

Cc Russell King <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 drivers/irqchip/Kconfig              |   1 +
 drivers/irqchip/irq-versatile-fpga.c | 104 +++++++++++++----------------------
 2 files changed, 39 insertions(+), 66 deletions(-)
drivers/irqchip/Kconfig +1 -0
index 4a33351..8765502 100644
@@ -14,6 +14,7 @@ config ARM_VIC
 	bool
 	select IRQ_DOMAIN
 	select MULTI_IRQ_HANDLER
+	select GENERIC_IRQ_CHIP
 
 config ARM_VIC_NR
 	int
drivers/irqchip/irq-versatile-fpga.c +38 -66

156 lines not on this page · raw message

Signature · 1 line
1.8.1.2
#5 lore raw

Re: [PATCH 3/3] irqchip: Make versatile fpga irq driver a generic chip

Quoted 11 lines · Grant Likely

This is an RFC patch to convert the versatile FPGA irq controller driver to use generic irq chip. It builds on the series that extends the generic chip code to allow a linear irq domain to contain one or more generic irq chips so that each interrupt controller doesn't need to hand code the generic chip setup.

I've written this as a proof of concept to see if the new generic irq code does what it needs to. I had to extend it slightly to properly handle the valid mask used by the versatile FPGA driver.

Tested on QEMU, but not on real hardware.

Hm, I could test this but what is the needed baseline? I think I need Thomas' patches underneath right?

Could you publish a branch that I can test?

Yours,
Linus Walleij

#6 lore raw

Re: [PATCH 3/3] irqchip: Make versatile fpga irq driver a generic chip

Quoted 12 lines · Linus Walleij
Quoted 10 lines · Grant Likely

This is an RFC patch to convert the versatile FPGA irq controller driver to use generic irq chip. It builds on the series that extends the generic chip code to allow a linear irq domain to contain one or more generic irq chips so that each interrupt controller doesn't need to hand code the generic chip setup.

I've written this as a proof of concept to see if the new generic irq code does what it needs to. I had to extend it slightly to properly handle the valid mask used by the versatile FPGA driver.

Quoted 7 lines
Quoted 1 line

Tested on QEMU, but not on real hardware.

Hm, I could test this but what is the needed baseline? I think I need Thomas' patches underneath right?

Could you publish a branch that I can test?

Try this one:

git://git.secretlab.ca/git/linux irqdomain/generic-chip

g.

Tested-by
#7 lore raw

Re: [PATCH 3/3] irqchip: Make versatile fpga irq driver a generic chip

Quoted 10 lines · Grant Likely
Quoted 4 lines · Linus Walleij

Hm, I could test this but what is the needed baseline? I think I need Thomas' patches underneath right?

Could you publish a branch that I can test?

Try this one:

git://git.secretlab.ca/git/linux irqdomain/generic-chip

Hey it works!

Compiled and booted on Integrator/AP which uses this controller exclusively.

But you need this hunk:

drivers/irqchip/Kconfig +1 -0
index 8765502..0cca010 100644
@@ -36,6 +36,7 @@ config RENESAS_IRQC
 
 config VERSATILE_FPGA_IRQ
        bool
+       select GENERIC_IRQ_CHIP
        select IRQ_DOMAIN
 
 config VERSATILE_FPGA_IRQ_NR

With that:

For the series.

Yours,
Linus Walleij

#8 lore raw
In reply to Grant Likely

Grant,

Quoted 8 lines · Grant Likely

Hi Thomas,

Rather than just straight reviewing the generic irq chip patch series, I tried it out by converting another driver to use it. As far as I've been able to tell it does the right thing and you can have my ack. The first patch in this series adds another feature needed by the versatile driver. Patch 2 should be okay, but I'd like to get an ack from Ben before it gets applied.

I pick up #1 and push it with the other lot, so people can start working on top of that. I'll put it into a separate branch (irq/for-arm) so SoC folks can grab it from there to avoid inter tree dependencies.

Quoted 2 lines

I need to get someone to test patch 3 on hardware before you pick up that one.

Sure. It might also go through the SoC tree(s).

Quoted 2 lines

Oh, and I'll reply directly to patch 7 of your series with an ack and a minor comment.

Thanks,

tglx