aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2006-07-10 07:44:42 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-10 16:24:20 -0400
commit6e99e4582861578fb00d84d085f8f283569f51dd (patch)
tree8890d540932f02fa47e49248adcc918b42c335b8 /include
parent50099328e4fe7c9f8981f408071a1ff82d59ddf8 (diff)
[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')
-rw-r--r--include/asm-powerpc/irq.h38
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 {
83 int (*match)(struct irq_host *h, struct device_node *node); 83 int (*match)(struct irq_host *h, struct device_node *node);
84 84
85 /* Create or update a mapping between a virtual irq number and a hw 85 /* Create or update a mapping between a virtual irq number and a hw
86 * irq number. This can be called several times for the same mapping 86 * irq number. This is called only once for a given mapping.
87 * but with different flags, though unmap shall always be called
88 * before the virq->hw mapping is changed.
89 */ 87 */
90 int (*map)(struct irq_host *h, unsigned int virq, 88 int (*map)(struct irq_host *h, unsigned int virq, irq_hw_number_t hw);
91 irq_hw_number_t hw, unsigned int flags);
92 89
93 /* Dispose of such a mapping */ 90 /* Dispose of such a mapping */
94 void (*unmap)(struct irq_host *h, unsigned int virq); 91 void (*unmap)(struct irq_host *h, unsigned int virq);
95 92
96 /* Translate device-tree interrupt specifier from raw format coming 93 /* Translate device-tree interrupt specifier from raw format coming
97 * from the firmware to a irq_hw_number_t (interrupt line number) and 94 * from the firmware to a irq_hw_number_t (interrupt line number) and
98 * trigger flags that can be passed to irq_create_mapping(). 95 * type (sense) that can be passed to set_irq_type(). In the absence
99 * If no translation is provided, raw format is assumed to be one cell 96 * of this callback, irq_create_of_mapping() and irq_of_parse_and_map()
100 * for interrupt line and default sense. 97 * will return the hw number in the first cell and IRQ_TYPE_NONE for
98 * the type (which amount to keeping whatever default value the
99 * interrupt controller has for that line)
101 */ 100 */
102 int (*xlate)(struct irq_host *h, struct device_node *ctrler, 101 int (*xlate)(struct irq_host *h, struct device_node *ctrler,
103 u32 *intspec, unsigned int intsize, 102 u32 *intspec, unsigned int intsize,
104 irq_hw_number_t *out_hwirq, unsigned int *out_flags); 103 irq_hw_number_t *out_hwirq, unsigned int *out_type);
105}; 104};
106 105
107struct irq_host { 106struct irq_host {
@@ -193,25 +192,14 @@ extern void irq_set_virq_count(unsigned int count);
193 * irq_create_mapping - Map a hardware interrupt into linux virq space 192 * irq_create_mapping - Map a hardware interrupt into linux virq space
194 * @host: host owning this hardware interrupt or NULL for default host 193 * @host: host owning this hardware interrupt or NULL for default host
195 * @hwirq: hardware irq number in that host space 194 * @hwirq: hardware irq number in that host space
196 * @flags: flags passed to the controller. contains the trigger type among
197 * others. Use IRQ_TYPE_* defined in include/linux/irq.h
198 * 195 *
199 * Only one mapping per hardware interrupt is permitted. Returns a linux 196 * Only one mapping per hardware interrupt is permitted. Returns a linux
200 * virq number. The flags can be used to provide sense information to the 197 * virq number.
201 * controller (typically extracted from the device-tree). If no information 198 * If the sense/trigger is to be specified, set_irq_type() should be called
202 * is passed, the controller defaults will apply (for example, xics can only 199 * on the number returned from that call.
203 * do edge so flags are irrelevant for some pseries specific irqs).
204 *
205 * The device-tree generally contains the trigger info in an encoding that is
206 * specific to a given type of controller. In that case, you can directly use
207 * host->ops->trigger_xlate() to translate that.
208 *
209 * It is recommended that new PICs that don't have existing OF bindings chose
210 * to use a representation of triggers identical to linux.
211 */ 200 */
212extern unsigned int irq_create_mapping(struct irq_host *host, 201extern unsigned int irq_create_mapping(struct irq_host *host,
213 irq_hw_number_t hwirq, 202 irq_hw_number_t hwirq);
214 unsigned int flags);
215 203
216 204
217/*** 205/***
@@ -295,7 +283,7 @@ extern void irq_free_virt(unsigned int virq, unsigned int count);
295 * 283 *
296 * This function is identical to irq_create_mapping except that it takes 284 * This function is identical to irq_create_mapping except that it takes
297 * as input informations straight from the device-tree (typically the results 285 * as input informations straight from the device-tree (typically the results
298 * of the of_irq_map_*() functions 286 * of the of_irq_map_*() functions.
299 */ 287 */
300extern unsigned int irq_create_of_mapping(struct device_node *controller, 288extern unsigned int irq_create_of_mapping(struct device_node *controller,
301 u32 *intspec, unsigned int intsize); 289 u32 *intspec, unsigned int intsize);