diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-03 19:50:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-03 19:50:31 -0400 |
commit | 03ffbcdd7898c0b5299efeb9f18de927487ec1cf (patch) | |
tree | 0569222e4dc9db22049d7d8d15920cc085a194f6 /kernel/irq/devres.c | |
parent | 1b044f1cfc65a7d90b209dfabd57e16d98b58c5b (diff) | |
parent | f9632de40ee0161e864bea8c1b017d957fd7312c (diff) |
Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull irq updates from Thomas Gleixner:
"The irq department delivers:
- Expand the generic infrastructure handling the irq migration on CPU
hotplug and convert X86 over to it. (Thomas Gleixner)
Aside of consolidating code this is a preparatory change for:
- Finalizing the affinity management for multi-queue devices. The
main change here is to shut down interrupts which are affine to a
outgoing CPU and reenabling them when the CPU comes online again.
That avoids moving interrupts pointlessly around and breaking and
reestablishing affinities for no value. (Christoph Hellwig)
Note: This contains also the BLOCK-MQ and NVME changes which depend
on the rework of the irq core infrastructure. Jens acked them and
agreed that they should go with the irq changes.
- Consolidation of irq domain code (Marc Zyngier)
- State tracking consolidation in the core code (Jeffy Chen)
- Add debug infrastructure for hierarchical irq domains (Thomas
Gleixner)
- Infrastructure enhancement for managing generic interrupt chips via
devmem (Bartosz Golaszewski)
- Constification work all over the place (Tobias Klauser)
- Two new interrupt controller drivers for MVEBU (Thomas Petazzoni)
- The usual set of fixes, updates and enhancements all over the
place"
* 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (112 commits)
irqchip/or1k-pic: Fix interrupt acknowledgement
irqchip/irq-mvebu-gicp: Allocate enough memory for spi_bitmap
irqchip/gic-v3: Fix out-of-bound access in gic_set_affinity
nvme: Allocate queues for all possible CPUs
blk-mq: Create hctx for each present CPU
blk-mq: Include all present CPUs in the default queue mapping
genirq: Avoid unnecessary low level irq function calls
genirq: Set irq masked state when initializing irq_desc
genirq/timings: Add infrastructure for estimating the next interrupt arrival time
genirq/timings: Add infrastructure to track the interrupt timings
genirq/debugfs: Remove pointless NULL pointer check
irqchip/gic-v3-its: Don't assume GICv3 hardware supports 16bit INTID
irqchip/gic-v3-its: Add ACPI NUMA node mapping
irqchip/gic-v3-its-platform-msi: Make of_device_ids const
irqchip/gic-v3-its: Make of_device_ids const
irqchip/irq-mvebu-icu: Add new driver for Marvell ICU
irqchip/irq-mvebu-gicp: Add new driver for Marvell GICP
dt-bindings/interrupt-controller: Add DT binding for the Marvell ICU
genirq/irqdomain: Remove auto-recursive hierarchy support
irqchip/MSI: Use irq_domain_update_bus_token instead of an open coded access
...
Diffstat (limited to 'kernel/irq/devres.c')
-rw-r--r-- | kernel/irq/devres.c | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/kernel/irq/devres.c b/kernel/irq/devres.c index 1613bfd48365..194c506d9d20 100644 --- a/kernel/irq/devres.c +++ b/kernel/irq/devres.c | |||
@@ -4,6 +4,8 @@ | |||
4 | #include <linux/gfp.h> | 4 | #include <linux/gfp.h> |
5 | #include <linux/irq.h> | 5 | #include <linux/irq.h> |
6 | 6 | ||
7 | #include "internals.h" | ||
8 | |||
7 | /* | 9 | /* |
8 | * Device resource management aware IRQ request/free implementation. | 10 | * Device resource management aware IRQ request/free implementation. |
9 | */ | 11 | */ |
@@ -198,3 +200,87 @@ int __devm_irq_alloc_descs(struct device *dev, int irq, unsigned int from, | |||
198 | return base; | 200 | return base; |
199 | } | 201 | } |
200 | EXPORT_SYMBOL_GPL(__devm_irq_alloc_descs); | 202 | EXPORT_SYMBOL_GPL(__devm_irq_alloc_descs); |
203 | |||
204 | #ifdef CONFIG_GENERIC_IRQ_CHIP | ||
205 | /** | ||
206 | * devm_irq_alloc_generic_chip - Allocate and initialize a generic chip | ||
207 | * for a managed device | ||
208 | * @dev: Device to allocate the generic chip for | ||
209 | * @name: Name of the irq chip | ||
210 | * @num_ct: Number of irq_chip_type instances associated with this | ||
211 | * @irq_base: Interrupt base nr for this chip | ||
212 | * @reg_base: Register base address (virtual) | ||
213 | * @handler: Default flow handler associated with this chip | ||
214 | * | ||
215 | * Returns an initialized irq_chip_generic structure. The chip defaults | ||
216 | * to the primary (index 0) irq_chip_type and @handler | ||
217 | */ | ||
218 | struct irq_chip_generic * | ||
219 | devm_irq_alloc_generic_chip(struct device *dev, const char *name, int num_ct, | ||
220 | unsigned int irq_base, void __iomem *reg_base, | ||
221 | irq_flow_handler_t handler) | ||
222 | { | ||
223 | struct irq_chip_generic *gc; | ||
224 | unsigned long sz = sizeof(*gc) + num_ct * sizeof(struct irq_chip_type); | ||
225 | |||
226 | gc = devm_kzalloc(dev, sz, GFP_KERNEL); | ||
227 | if (gc) | ||
228 | irq_init_generic_chip(gc, name, num_ct, | ||
229 | irq_base, reg_base, handler); | ||
230 | |||
231 | return gc; | ||
232 | } | ||
233 | EXPORT_SYMBOL_GPL(devm_irq_alloc_generic_chip); | ||
234 | |||
235 | struct irq_generic_chip_devres { | ||
236 | struct irq_chip_generic *gc; | ||
237 | u32 msk; | ||
238 | unsigned int clr; | ||
239 | unsigned int set; | ||
240 | }; | ||
241 | |||
242 | static void devm_irq_remove_generic_chip(struct device *dev, void *res) | ||
243 | { | ||
244 | struct irq_generic_chip_devres *this = res; | ||
245 | |||
246 | irq_remove_generic_chip(this->gc, this->msk, this->clr, this->set); | ||
247 | } | ||
248 | |||
249 | /** | ||
250 | * devm_irq_setup_generic_chip - Setup a range of interrupts with a generic | ||
251 | * chip for a managed device | ||
252 | * | ||
253 | * @dev: Device to setup the generic chip for | ||
254 | * @gc: Generic irq chip holding all data | ||
255 | * @msk: Bitmask holding the irqs to initialize relative to gc->irq_base | ||
256 | * @flags: Flags for initialization | ||
257 | * @clr: IRQ_* bits to clear | ||
258 | * @set: IRQ_* bits to set | ||
259 | * | ||
260 | * Set up max. 32 interrupts starting from gc->irq_base. Note, this | ||
261 | * initializes all interrupts to the primary irq_chip_type and its | ||
262 | * associated handler. | ||
263 | */ | ||
264 | int devm_irq_setup_generic_chip(struct device *dev, struct irq_chip_generic *gc, | ||
265 | u32 msk, enum irq_gc_flags flags, | ||
266 | unsigned int clr, unsigned int set) | ||
267 | { | ||
268 | struct irq_generic_chip_devres *dr; | ||
269 | |||
270 | dr = devres_alloc(devm_irq_remove_generic_chip, | ||
271 | sizeof(*dr), GFP_KERNEL); | ||
272 | if (!dr) | ||
273 | return -ENOMEM; | ||
274 | |||
275 | irq_setup_generic_chip(gc, msk, flags, clr, set); | ||
276 | |||
277 | dr->gc = gc; | ||
278 | dr->msk = msk; | ||
279 | dr->clr = clr; | ||
280 | dr->set = set; | ||
281 | devres_add(dev, dr); | ||
282 | |||
283 | return 0; | ||
284 | } | ||
285 | EXPORT_SYMBOL_GPL(devm_irq_setup_generic_chip); | ||
286 | #endif /* CONFIG_GENERIC_IRQ_CHIP */ | ||