diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-07-10 04:44:42 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-07-10 13:24:20 -0700 |
commit | 6e99e4582861578fb00d84d085f8f283569f51dd (patch) | |
tree | 8890d540932f02fa47e49248adcc918b42c335b8 /include/asm-powerpc | |
parent | 50099328e4fe7c9f8981f408071a1ff82d59ddf8 (diff) | |
download | blackbird-op-linux-6e99e4582861578fb00d84d085f8f283569f51dd.tar.gz blackbird-op-linux-6e99e4582861578fb00d84d085f8f283569f51dd.zip |
[PATCH] powerpc: fix trigger handling in the new irq code
This patch slightly reworks the new irq code to fix a small design error. I
removed the passing of the trigger to the map() calls entirely, it was not a
good idea to have one call do two different things. It also fixes a couple of
corner cases.
Mapping a linux virtual irq to a physical irq now does only that. Setting the
trigger is a different action which has a different call.
The main changes are:
- I no longer call host->ops->map() for an already mapped irq, I just return
the virtual number that was already mapped. It was called before to give an
opportunity to change the trigger, but that was causing issues as that could
happen while the interrupt was in use by a device, and because of the
trigger change, map would potentially muck around with things in a racy way.
That was causing much burden on a given's controller implementation of
map() to get it right. This is much simpler now. map() is only called on
the initial mapping of an irq, meaning that you know that this irq is _not_
being used. You can initialize the hardware if you want (though you don't
have to).
- Controllers that can handle different type of triggers (level/edge/etc...)
now implement the standard irq_chip->set_type() call as defined by the
generic code. That means that you can use the standard set_irq_type() to
configure an irq line manually if you wish or (though I don't like that
interface), pass explicit trigger flags to request_irq() as defined by the
generic kernel interfaces. Also, using those interfaces guarantees that
your controller set_type callback is called with the descriptor lock held,
thus providing locking against activity on the same interrupt (including
mask/unmask/etc...) automatically. A result is that, for example, MPIC's
own map() implementation calls irq_set_type(NONE) to configure the hardware
to the default triggers.
- To allow the above, the irq_map array entry for the new mapped interrupt
is now set before map() callback is called for the controller.
- The irq_create_of_mapping() (also used by irq_of_parse_and_map()) function
for mapping interrupts from the device-tree now also call the separate
set_irq_type(), and only does so if there is a change in the trigger type.
- While I was at it, I changed pci_read_irq_line() (which is the helper I
would expect most archs to use in their pcibios_fixup() to get the PCI
interrupt routing from the device tree) to also handle a fallback when the
DT mapping fails consisting of reading the PCI_INTERRUPT_PIN to know wether
the device has an interrupt at all, and the the PCI_INTERRUPT_LINE to get an
interrupt number from the device. That number is then mapped using the
default controller, and the trigger is set to level low. That default
behaviour works for several platforms that don't have a proper interrupt
tree like Pegasos. If it doesn't work for your platform, then either
provide a proper interrupt tree from the firmware so that fallback isn't
needed, or don't call pci_read_irq_line()
- Add back a bit that got dropped by my main rework patch for properly
clearing pending IPIs on pSeries when using a kexec
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-powerpc')
-rw-r--r-- | include/asm-powerpc/irq.h | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/include/asm-powerpc/irq.h b/include/asm-powerpc/irq.h index e05754752028..d903a62959da 100644 --- a/include/asm-powerpc/irq.h +++ b/include/asm-powerpc/irq.h @@ -83,25 +83,24 @@ struct irq_host_ops { int (*match)(struct irq_host *h, struct device_node *node); /* Create or update a mapping between a virtual irq number and a hw - * irq number. This can be called several times for the same mapping - * but with different flags, though unmap shall always be called - * before the virq->hw mapping is changed. + * irq number. This is called only once for a given mapping. */ - int (*map)(struct irq_host *h, unsigned int virq, - irq_hw_number_t hw, unsigned int flags); + int (*map)(struct irq_host *h, unsigned int virq, irq_hw_number_t hw); /* Dispose of such a mapping */ void (*unmap)(struct irq_host *h, unsigned int virq); /* Translate device-tree interrupt specifier from raw format coming * from the firmware to a irq_hw_number_t (interrupt line number) and - * trigger flags that can be passed to irq_create_mapping(). - * If no translation is provided, raw format is assumed to be one cell - * for interrupt line and default sense. + * type (sense) that can be passed to set_irq_type(). In the absence + * of this callback, irq_create_of_mapping() and irq_of_parse_and_map() + * will return the hw number in the first cell and IRQ_TYPE_NONE for + * the type (which amount to keeping whatever default value the + * interrupt controller has for that line) */ int (*xlate)(struct irq_host *h, struct device_node *ctrler, u32 *intspec, unsigned int intsize, - irq_hw_number_t *out_hwirq, unsigned int *out_flags); + irq_hw_number_t *out_hwirq, unsigned int *out_type); }; struct irq_host { @@ -193,25 +192,14 @@ extern void irq_set_virq_count(unsigned int count); * irq_create_mapping - Map a hardware interrupt into linux virq space * @host: host owning this hardware interrupt or NULL for default host * @hwirq: hardware irq number in that host space - * @flags: flags passed to the controller. contains the trigger type among - * others. Use IRQ_TYPE_* defined in include/linux/irq.h * * Only one mapping per hardware interrupt is permitted. Returns a linux - * virq number. The flags can be used to provide sense information to the - * controller (typically extracted from the device-tree). If no information - * is passed, the controller defaults will apply (for example, xics can only - * do edge so flags are irrelevant for some pseries specific irqs). - * - * The device-tree generally contains the trigger info in an encoding that is - * specific to a given type of controller. In that case, you can directly use - * host->ops->trigger_xlate() to translate that. - * - * It is recommended that new PICs that don't have existing OF bindings chose - * to use a representation of triggers identical to linux. + * virq number. + * If the sense/trigger is to be specified, set_irq_type() should be called + * on the number returned from that call. */ extern unsigned int irq_create_mapping(struct irq_host *host, - irq_hw_number_t hwirq, - unsigned int flags); + irq_hw_number_t hwirq); /*** @@ -295,7 +283,7 @@ extern void irq_free_virt(unsigned int virq, unsigned int count); * * This function is identical to irq_create_mapping except that it takes * as input informations straight from the device-tree (typically the results - * of the of_irq_map_*() functions + * of the of_irq_map_*() functions. */ extern unsigned int irq_create_of_mapping(struct device_node *controller, u32 *intspec, unsigned int intsize); |