Lines Matching +full:secondary +full:- +full:device

1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 1992, 1998-2006 Linus Torvalds, Ingo Molnar
4 * Copyright (C) 2005-2006 Thomas Gleixner
50 while (irqd_irq_inprogress(&desc->irq_data))
53 /* Ok, that indicated we're done: double-check carefully. */
54 raw_spin_lock_irqsave(&desc->lock, flags);
55 inprogress = irqd_irq_inprogress(&desc->irq_data);
70 raw_spin_unlock_irqrestore(&desc->lock, flags);
77 * synchronize_hardirq - wait for pending hard IRQ handlers (on other CPUs)
91 * This function may be called - with care - from IRQ context.
104 return !atomic_read(&desc->threads_active);
118 wait_event(desc->wait_for_threads, !atomic_read(&desc->threads_active));
122 * synchronize_irq - wait for pending IRQ handlers (on other CPUs)
150 if (!desc || !irqd_can_balance(&desc->irq_data) ||
151 !desc->irq_data.chip || !desc->irq_data.chip->irq_set_affinity)
157 * irq_can_set_affinity - Check if the affinity of a given irq can be set
167 * irq_can_set_affinity_usr - Check if affinity of a irq can be set from user space
178 !irqd_affinity_is_managed(&desc->irq_data);
182 * irq_set_thread_affinity - Notify irq threads to adjust affinity
187 * set_cpus_allowed_ptr() here as we hold desc->lock and this
195 if (action->thread) {
196 set_bit(IRQTF_AFFINITY, &action->thread_flags);
197 wake_up_process(action->thread);
199 if (action->secondary && action->secondary->thread) {
200 set_bit(IRQTF_AFFINITY, &action->secondary->thread_flags);
201 wake_up_process(action->secondary->thread);
215 chip->name, data->irq);
232 if (!chip || !chip->irq_set_affinity)
233 return -EINVAL;
276 ret = chip->irq_set_affinity(data, tmp_mask, force);
278 ret = chip->irq_set_affinity(data, mask, force);
280 ret = -EINVAL;
285 cpumask_copy(desc->irq_common_data.affinity, mask);
310 return -EBUSY;
324 if (ret == -EBUSY && !force)
347 cpumask_copy(desc->irq_common_data.affinity, mask);
360 if (!chip || !chip->irq_set_affinity)
361 return -EINVAL;
373 if (desc->affinity_notify) {
374 kref_get(&desc->affinity_notify->kref);
375 if (!schedule_work(&desc->affinity_notify->work)) {
377 kref_put(&desc->affinity_notify->kref,
378 desc->affinity_notify->release);
387 * irq_update_affinity_desc - Update affinity management for an interrupt
394 * There are certain limitations on when it may be used - attempts to use it
397 * managed/non-managed interrupt accounting. In addition, attempts to use it on
414 return -EOPNOTSUPP;
418 return -EINVAL;
421 if (irqd_is_started(&desc->irq_data)) {
422 ret = -EBUSY;
427 if (irqd_affinity_is_managed(&desc->irq_data)) {
428 ret = -EBUSY;
436 activated = irqd_is_activated(&desc->irq_data);
438 irq_domain_deactivate_irq(&desc->irq_data);
440 if (affinity->is_managed) {
441 irqd_set(&desc->irq_data, IRQD_AFFINITY_MANAGED);
442 irqd_set(&desc->irq_data, IRQD_MANAGED_SHUTDOWN);
445 cpumask_copy(desc->irq_common_data.affinity, &affinity->mask);
449 irq_domain_activate_irq(&desc->irq_data, false);
464 return -EINVAL;
466 raw_spin_lock_irqsave(&desc->lock, flags);
468 raw_spin_unlock_irqrestore(&desc->lock, flags);
473 * irq_set_affinity - Set the irq affinity of a given irq
486 * irq_force_affinity - Force the irq affinity of a given irq
509 return -EINVAL;
510 desc->affinity_hint = m;
522 struct irq_desc *desc = irq_to_desc(notify->irq);
529 raw_spin_lock_irqsave(&desc->lock, flags);
530 if (irq_move_pending(&desc->irq_data))
533 cpumask_copy(cpumask, desc->irq_common_data.affinity);
534 raw_spin_unlock_irqrestore(&desc->lock, flags);
536 notify->notify(notify, cpumask);
540 kref_put(&notify->kref, notify->release);
544 * irq_set_affinity_notifier - control notification of IRQ affinity changes
565 return -EINVAL;
569 notify->irq = irq;
570 kref_init(&notify->kref);
571 INIT_WORK(&notify->work, irq_affinity_notify);
574 raw_spin_lock_irqsave(&desc->lock, flags);
575 old_notify = desc->affinity_notify;
576 desc->affinity_notify = notify;
577 raw_spin_unlock_irqrestore(&desc->lock, flags);
580 if (cancel_work_sync(&old_notify->work)) {
582 kref_put(&old_notify->kref, old_notify->release);
584 kref_put(&old_notify->kref, old_notify->release);
611 if (irqd_affinity_is_managed(&desc->irq_data) ||
612 irqd_has_set(&desc->irq_data, IRQD_AFFINITY_SET)) {
613 if (cpumask_intersects(desc->irq_common_data.affinity,
615 set = desc->irq_common_data.affinity;
617 irqd_clear(&desc->irq_data, IRQD_AFFINITY_SET);
631 ret = irq_do_set_affinity(&desc->irq_data, &mask, false);
646 * irq_set_vcpu_affinity - Set vcpu affinity for the interrupt
654 * KVM -> IOMMU -> irq_set_vcpu_affinity().
662 int ret = -ENOSYS;
665 return -EINVAL;
670 if (chip && chip->irq_set_vcpu_affinity)
673 data = data->parent_data;
680 ret = chip->irq_set_vcpu_affinity(data, vcpu_info);
689 if (!desc->depth++)
699 return -EINVAL;
706 * disable_irq_nosync - disable an irq without waiting
723 * disable_irq - disable an irq and wait for completion
745 * disable_hardirq - disables an irq and waits for hardirq completion
759 * This function may be called - with care - from IRQ context.
771 * disable_nmi_nosync - disable an nmi without waiting
787 switch (desc->depth) {
794 if (desc->istate & IRQS_SUSPENDED)
813 desc->depth--;
818 * enable_irq - enable handling of an irq
823 * IRQ line is re-enabled.
826 * desc->irq_data.chip->bus_lock and desc->chip->bus_sync_unlock are NULL !
835 if (WARN(!desc->irq_data.chip,
846 * enable_nmi - enable handling of an nmi
852 * IRQ line is re-enabled.
862 int ret = -ENXIO;
864 if (irq_desc_get_chip(desc)->flags & IRQCHIP_SKIP_SET_WAKE)
867 if (desc->irq_data.chip->irq_set_wake)
868 ret = desc->irq_data.chip->irq_set_wake(&desc->irq_data, on);
874 * irq_set_irq_wake - control irq power management wakeup
880 * just as they match for non-wakeup mode support.
899 return -EINVAL;
903 ret = -EINVAL;
907 /* wakeup-capable irqs can be shared between drivers that
911 if (desc->wake_depth++ == 0) {
914 desc->wake_depth = 0;
916 irqd_set(&desc->irq_data, IRQD_WAKEUP_STATE);
919 if (desc->wake_depth == 0) {
921 } else if (--desc->wake_depth == 0) {
924 desc->wake_depth = 1;
926 irqd_clear(&desc->irq_data, IRQD_WAKEUP_STATE);
951 if (!desc->action ||
952 irqflags & desc->action->flags & IRQF_SHARED)
961 struct irq_chip *chip = desc->irq_data.chip;
964 if (!chip || !chip->irq_set_type) {
967 * flow-types?
971 chip ? (chip->name ? : "unknown") : "unknown");
975 if (chip->flags & IRQCHIP_SET_TYPE_MASKED) {
976 if (!irqd_irq_masked(&desc->irq_data))
978 if (!irqd_irq_disabled(&desc->irq_data))
984 ret = chip->irq_set_type(&desc->irq_data, flags);
989 irqd_clear(&desc->irq_data, IRQD_TRIGGER_MASK);
990 irqd_set(&desc->irq_data, flags);
994 flags = irqd_get_trigger_type(&desc->irq_data);
996 irqd_clear(&desc->irq_data, IRQD_LEVEL);
1000 irqd_set(&desc->irq_data, IRQD_LEVEL);
1007 flags, irq_desc_get_irq(desc), chip->irq_set_type);
1021 return -EINVAL;
1023 desc->parent_irq = parent_irq;
1053 WARN(1, "Secondary action handler called for irq %d\n", irq);
1066 if (!test_and_clear_bit(IRQTF_AFFINITY, &action->thread_flags))
1076 set_bit(IRQTF_AFFINITY, &action->thread_flags);
1080 raw_spin_lock_irq(&desc->lock);
1085 if (cpumask_available(desc->irq_common_data.affinity)) {
1088 m = irq_data_get_effective_affinity_mask(&desc->irq_data);
1092 raw_spin_unlock_irq(&desc->lock);
1112 &action->thread_flags)) {
1117 return -1;
1121 &action->thread_flags)) {
1137 if (!(desc->istate & IRQS_ONESHOT) ||
1138 action->handler == irq_forced_secondary_handler)
1142 raw_spin_lock_irq(&desc->lock);
1154 * versus "desc->threads_oneshot |= action->thread_mask;" in
1158 if (unlikely(irqd_irq_inprogress(&desc->irq_data))) {
1159 raw_spin_unlock_irq(&desc->lock);
1170 if (test_bit(IRQTF_RUNTHREAD, &action->thread_flags))
1173 desc->threads_oneshot &= ~action->thread_mask;
1175 if (!desc->threads_oneshot && !irqd_irq_disabled(&desc->irq_data) &&
1176 irqd_irq_masked(&desc->irq_data))
1180 raw_spin_unlock_irq(&desc->lock);
1186 * preemptible - many of them need to sleep and wait for slow busses to
1191 irqreturn_t ret = action->thread_fn(action->irq, action->dev_id);
1194 atomic_inc(&desc->threads_handled);
1222 if (atomic_dec_and_test(&desc->threads_active))
1223 wake_up(&desc->wait_for_threads);
1232 if (WARN_ON_ONCE(!(current->flags & PF_EXITING)))
1238 tsk->comm, tsk->pid, action->irq);
1241 desc = irq_to_desc(action->irq);
1244 * desc->threads_active and wake possible waiters.
1246 if (test_and_clear_bit(IRQTF_RUNTHREAD, &action->thread_flags))
1249 /* Prevent a stale desc->threads_oneshot */
1255 struct irqaction *secondary = action->secondary;
1257 if (WARN_ON_ONCE(!secondary))
1260 raw_spin_lock_irq(&desc->lock);
1261 __irq_wake_thread(desc, secondary);
1262 raw_spin_unlock_irq(&desc->lock);
1271 set_bit(IRQTF_READY, &action->thread_flags);
1272 wake_up(&desc->wait_for_threads);
1282 if (!action || !action->thread)
1285 wake_up_process(action->thread);
1286 wait_event(desc->wait_for_threads,
1287 test_bit(IRQTF_READY, &action->thread_flags));
1297 struct irq_desc *desc = irq_to_desc(action->irq);
1306 &action->thread_flags))
1335 * irq_wake_thread - wake the irq thread for the action identified by dev_id
1337 * @dev_id: Device identity for which the thread should be woken
1349 raw_spin_lock_irqsave(&desc->lock, flags);
1351 if (action->dev_id == dev_id) {
1352 if (action->thread)
1357 raw_spin_unlock_irqrestore(&desc->lock, flags);
1365 if (new->flags & (IRQF_NO_THREAD | IRQF_PERCPU | IRQF_ONESHOT))
1372 if (new->handler == irq_default_primary_handler)
1375 new->flags |= IRQF_ONESHOT;
1380 * secondary action.
1382 if (new->handler && new->thread_fn) {
1383 /* Allocate the secondary action */
1384 new->secondary = kzalloc(sizeof(struct irqaction), GFP_KERNEL);
1385 if (!new->secondary)
1386 return -ENOMEM;
1387 new->secondary->handler = irq_forced_secondary_handler;
1388 new->secondary->thread_fn = new->thread_fn;
1389 new->secondary->dev_id = new->dev_id;
1390 new->secondary->irq = new->irq;
1391 new->secondary->name = new->name;
1394 set_bit(IRQTF_FORCED_THREAD, &new->thread_flags);
1395 new->thread_fn = new->handler;
1396 new->handler = irq_default_primary_handler;
1402 struct irq_data *d = &desc->irq_data;
1403 struct irq_chip *c = d->chip;
1405 return c->irq_request_resources ? c->irq_request_resources(d) : 0;
1410 struct irq_data *d = &desc->irq_data;
1411 struct irq_chip *c = d->chip;
1413 if (c->irq_release_resources)
1414 c->irq_release_resources(d);
1423 if (d->parent_data)
1427 if (d->chip->irq_bus_lock || d->chip->irq_bus_sync_unlock)
1430 return d->chip->flags & IRQCHIP_SUPPORTS_NMI;
1436 struct irq_chip *c = d->chip;
1438 return c->irq_nmi_setup ? c->irq_nmi_setup(d) : -EINVAL;
1444 struct irq_chip *c = d->chip;
1446 if (c->irq_nmi_teardown)
1447 c->irq_nmi_teardown(d);
1451 setup_irq_thread(struct irqaction *new, unsigned int irq, bool secondary)
1455 if (!secondary) {
1456 t = kthread_create(irq_thread, new, "irq/%d-%s", irq,
1457 new->name);
1459 t = kthread_create(irq_thread, new, "irq/%d-s-%s", irq,
1460 new->name);
1471 new->thread = get_task_struct(t);
1475 * not invoke setup_affinity() for the secondary
1481 set_bit(IRQTF_AFFINITY, &new->thread_flags);
1486 * Internal function to register an irqaction - typically used to
1491 * desc->request_mutex Provides serialization against a concurrent free_irq()
1493 * desc->lock Provides serialization against hard interrupts
1495 * chip_bus_lock and desc->lock are sufficient for all other management and
1496 * interrupt related functions. desc->request_mutex solely serializes
1507 return -EINVAL;
1509 if (desc->irq_data.chip == &no_irq_chip)
1510 return -ENOSYS;
1511 if (!try_module_get(desc->owner))
1512 return -ENODEV;
1514 new->irq = irq;
1520 if (!(new->flags & IRQF_TRIGGER_MASK))
1521 new->flags |= irqd_get_trigger_type(&desc->irq_data);
1529 if (!new->thread_fn) {
1530 ret = -EINVAL;
1538 new->handler = irq_nested_primary_handler;
1552 if (new->thread_fn && !nested) {
1556 if (new->secondary) {
1557 ret = setup_irq_thread(new->secondary, irq, true);
1572 if (desc->irq_data.chip->flags & IRQCHIP_ONESHOT_SAFE)
1573 new->flags &= ~IRQF_ONESHOT;
1578 * chip bus lock and desc->lock. Also protects against handing out
1582 mutex_lock(&desc->request_mutex);
1592 if (!desc->action) {
1596 new->name, irq, desc->irq_data.chip->name);
1605 * desc->request_mutex or the optional bus lock.
1607 raw_spin_lock_irqsave(&desc->lock, flags);
1608 old_ptr = &desc->action;
1623 new->name, irq, desc->irq_data.chip->name);
1624 ret = -EINVAL;
1632 if (irqd_trigger_type_was_set(&desc->irq_data)) {
1633 oldtype = irqd_get_trigger_type(&desc->irq_data);
1635 oldtype = new->flags & IRQF_TRIGGER_MASK;
1636 irqd_set_trigger_type(&desc->irq_data, oldtype);
1639 if (!((old->flags & new->flags) & IRQF_SHARED) ||
1640 (oldtype != (new->flags & IRQF_TRIGGER_MASK)))
1643 if ((old->flags & IRQF_ONESHOT) &&
1644 (new->flags & IRQF_COND_ONESHOT))
1645 new->flags |= IRQF_ONESHOT;
1646 else if ((old->flags ^ new->flags) & IRQF_ONESHOT)
1649 /* All handlers must agree on per-cpuness */
1650 if ((old->flags & IRQF_PERCPU) !=
1651 (new->flags & IRQF_PERCPU))
1657 * Or all existing action->thread_mask bits,
1661 thread_mask |= old->thread_mask;
1662 old_ptr = &old->next;
1673 if (new->flags & IRQF_ONESHOT) {
1679 ret = -EBUSY;
1684 * desc->thread_active to indicate that the
1688 * line have completed desc->threads_active becomes
1693 * interrupt handlers, then desc->threads_active is
1700 * all existing action->thread_mask bits.
1702 new->thread_mask = 1UL << ffz(thread_mask);
1704 } else if (new->handler == irq_default_primary_handler &&
1705 !(desc->irq_data.chip->flags & IRQCHIP_ONESHOT_SAFE)) {
1712 * the irq lines is reenabled, but the device still
1722 new->name, irq);
1723 ret = -EINVAL;
1729 if (new->flags & IRQF_TRIGGER_MASK) {
1731 new->flags & IRQF_TRIGGER_MASK);
1752 desc->istate &= ~(IRQS_AUTODETECT | IRQS_SPURIOUS_DISABLED | \
1754 irqd_clear(&desc->irq_data, IRQD_IRQ_INPROGRESS);
1756 if (new->flags & IRQF_PERCPU) {
1757 irqd_set(&desc->irq_data, IRQD_PER_CPU);
1759 if (new->flags & IRQF_NO_DEBUG)
1766 if (new->flags & IRQF_ONESHOT)
1767 desc->istate |= IRQS_ONESHOT;
1770 if (new->flags & IRQF_NOBALANCING) {
1772 irqd_set(&desc->irq_data, IRQD_NO_BALANCING);
1775 if (!(new->flags & IRQF_NO_AUTOEN) &&
1785 WARN_ON_ONCE(new->flags & IRQF_SHARED);
1787 desc->depth = 1;
1790 } else if (new->flags & IRQF_TRIGGER_MASK) {
1791 unsigned int nmsk = new->flags & IRQF_TRIGGER_MASK;
1792 unsigned int omsk = irqd_get_trigger_type(&desc->irq_data);
1805 desc->irq_count = 0;
1806 desc->irqs_unhandled = 0;
1812 if (shared && (desc->istate & IRQS_SPURIOUS_DISABLED)) {
1813 desc->istate &= ~IRQS_SPURIOUS_DISABLED;
1817 raw_spin_unlock_irqrestore(&desc->lock, flags);
1819 mutex_unlock(&desc->request_mutex);
1824 wake_up_and_wait_for_irq_thread_ready(desc, new->secondary);
1827 new->dir = NULL;
1832 if (!(new->flags & IRQF_PROBE_SHARED)) {
1834 irq, new->flags, new->name, old->flags, old->name);
1839 ret = -EBUSY;
1842 raw_spin_unlock_irqrestore(&desc->lock, flags);
1844 if (!desc->action)
1848 mutex_unlock(&desc->request_mutex);
1851 if (new->thread) {
1852 struct task_struct *t = new->thread;
1854 new->thread = NULL;
1857 if (new->secondary && new->secondary->thread) {
1858 struct task_struct *t = new->secondary->thread;
1860 new->secondary->thread = NULL;
1864 module_put(desc->owner);
1869 * Internal function to unregister an irqaction - used to free
1874 unsigned irq = desc->irq_data.irq;
1880 mutex_lock(&desc->request_mutex);
1882 raw_spin_lock_irqsave(&desc->lock, flags);
1888 action_ptr = &desc->action;
1893 WARN(1, "Trying to free already-free IRQ %d\n", irq);
1894 raw_spin_unlock_irqrestore(&desc->lock, flags);
1896 mutex_unlock(&desc->request_mutex);
1900 if (action->dev_id == dev_id)
1902 action_ptr = &action->next;
1905 /* Found it - now remove it from the list of entries: */
1906 *action_ptr = action->next;
1911 if (!desc->action) {
1919 if (WARN_ON_ONCE(desc->affinity_hint))
1920 desc->affinity_hint = NULL;
1923 raw_spin_unlock_irqrestore(&desc->lock, flags);
1934 * The still held desc->request_mutex() protects against a
1951 * It's a shared IRQ -- the driver ought to be prepared for an IRQ
1958 if (action->flags & IRQF_SHARED) {
1960 action->handler(irq, dev_id);
1971 if (action->thread) {
1972 kthread_stop_put(action->thread);
1973 if (action->secondary && action->secondary->thread)
1974 kthread_stop_put(action->secondary->thread);
1978 if (!desc->action) {
1988 raw_spin_lock_irqsave(&desc->lock, flags);
1989 irq_domain_deactivate_irq(&desc->irq_data);
1990 raw_spin_unlock_irqrestore(&desc->lock, flags);
1997 mutex_unlock(&desc->request_mutex);
1999 irq_chip_pm_put(&desc->irq_data);
2000 module_put(desc->owner);
2001 kfree(action->secondary);
2006 * free_irq - free an interrupt allocated with request_irq
2008 * @dev_id: Device identity to free
2031 if (WARN_ON(desc->affinity_notify))
2032 desc->affinity_notify = NULL;
2040 devname = action->name;
2046 /* This function must be called with desc->lock held */
2051 desc->istate &= ~IRQS_NMI;
2053 if (!WARN_ON(desc->action == NULL)) {
2054 irq_pm_remove_action(desc, desc->action);
2055 devname = desc->action->name;
2056 unregister_handler_proc(irq, desc->action);
2058 kfree(desc->action);
2059 desc->action = NULL;
2067 irq_chip_pm_put(&desc->irq_data);
2068 module_put(desc->owner);
2086 if (WARN_ON(desc->depth == 0))
2089 raw_spin_lock_irqsave(&desc->lock, flags);
2094 raw_spin_unlock_irqrestore(&desc->lock, flags);
2100 * request_threaded_irq - allocate an interrupt line
2109 * @devname: An ascii name for the claiming device
2119 * If you want to set up a threaded irq handler for your device
2122 * whether the interrupt originates from the device. If yes it
2123 * needs to disable the interrupt on the device and return
2129 * device data structure is used as the cookie. Since the handler
2150 return -ENOTCONN;
2153 * Sanity-check: shared interrupts must pass in a real dev-ID,
2169 return -EINVAL;
2173 return -EINVAL;
2177 return -EINVAL;
2181 return -EINVAL;
2187 return -ENOMEM;
2189 action->handler = handler;
2190 action->thread_fn = thread_fn;
2191 action->flags = irqflags;
2192 action->name = devname;
2193 action->dev_id = dev_id;
2195 retval = irq_chip_pm_get(&desc->irq_data);
2204 irq_chip_pm_put(&desc->irq_data);
2205 kfree(action->secondary);
2212 * It's a shared IRQ -- the driver ought to be prepared for it
2233 * request_any_context_irq - allocate an interrupt line
2238 * @name: An ascii name for the claiming device
2256 return -ENOTCONN;
2260 return -EINVAL;
2274 * request_nmi - allocate an interrupt line for NMI delivery
2279 * @name: An ascii name for the claiming device
2293 * device data structure is used as the cookie. Since the handler
2308 return -ENOTCONN;
2312 return -EINVAL;
2315 return -EINVAL;
2318 return -EINVAL;
2327 return -EINVAL;
2331 return -ENOMEM;
2333 action->handler = handler;
2334 action->flags = irqflags | IRQF_NO_THREAD | IRQF_NOBALANCING;
2335 action->name = name;
2336 action->dev_id = dev_id;
2338 retval = irq_chip_pm_get(&desc->irq_data);
2346 raw_spin_lock_irqsave(&desc->lock, flags);
2349 desc->istate |= IRQS_NMI;
2353 raw_spin_unlock_irqrestore(&desc->lock, flags);
2354 return -EINVAL;
2357 raw_spin_unlock_irqrestore(&desc->lock, flags);
2362 irq_chip_pm_put(&desc->irq_data);
2384 type = irqd_get_trigger_type(&desc->irq_data);
2409 * irq_percpu_is_enabled - Check whether the per cpu irq is enabled
2426 is_enabled = cpumask_test_cpu(cpu, desc->percpu_enabled);
2466 raw_spin_lock_irqsave(&desc->lock, flags);
2468 action = desc->action;
2469 if (!action || action->percpu_dev_id != dev_id) {
2470 WARN(1, "Trying to free already-free IRQ %d\n", irq);
2474 if (!cpumask_empty(desc->percpu_enabled)) {
2476 irq, cpumask_first(desc->percpu_enabled));
2480 /* Found it - now remove it from the list of entries: */
2481 desc->action = NULL;
2483 desc->istate &= ~IRQS_NMI;
2485 raw_spin_unlock_irqrestore(&desc->lock, flags);
2489 irq_chip_pm_put(&desc->irq_data);
2490 module_put(desc->owner);
2494 raw_spin_unlock_irqrestore(&desc->lock, flags);
2499 * remove_percpu_irq - free a per-cpu interrupt
2510 __free_percpu_irq(irq, act->percpu_dev_id);
2514 * free_percpu_irq - free an interrupt allocated with request_percpu_irq
2516 * @dev_id: Device identity to free
2552 * setup_percpu_irq - setup a per-cpu interrupt
2556 * Used to statically setup per-cpu interrupts in the early boot process.
2564 return -EINVAL;
2566 retval = irq_chip_pm_get(&desc->irq_data);
2573 irq_chip_pm_put(&desc->irq_data);
2579 * __request_percpu_irq - allocate a percpu interrupt line
2583 * @devname: An ascii name for the claiming device
2591 * Dev_id must be globally unique. It is a per-cpu variable, and
2604 return -EINVAL;
2609 return -EINVAL;
2612 return -EINVAL;
2616 return -ENOMEM;
2618 action->handler = handler;
2619 action->flags = flags | IRQF_PERCPU | IRQF_NO_SUSPEND;
2620 action->name = devname;
2621 action->percpu_dev_id = dev_id;
2623 retval = irq_chip_pm_get(&desc->irq_data);
2632 irq_chip_pm_put(&desc->irq_data);
2641 * request_percpu_nmi - allocate a percpu interrupt line for NMI delivery
2644 * @name: An ascii name for the claiming device
2651 * Dev_id must be globally unique. It is a per-cpu variable, and
2670 return -EINVAL;
2678 return -EINVAL;
2682 return -EINVAL;
2686 return -ENOMEM;
2688 action->handler = handler;
2689 action->flags = IRQF_PERCPU | IRQF_NO_SUSPEND | IRQF_NO_THREAD
2691 action->name = name;
2692 action->percpu_dev_id = dev_id;
2694 retval = irq_chip_pm_get(&desc->irq_data);
2702 raw_spin_lock_irqsave(&desc->lock, flags);
2703 desc->istate |= IRQS_NMI;
2704 raw_spin_unlock_irqrestore(&desc->lock, flags);
2709 irq_chip_pm_put(&desc->irq_data);
2717 * prepare_percpu_nmi - performs CPU local setup for NMI delivery
2723 * As a CPU local operation, this should be called from non-preemptible
2740 return -EINVAL;
2743 KERN_ERR "prepare_percpu_nmi called for a non-NMI interrupt: irq %u\n",
2745 ret = -EINVAL;
2761 * teardown_percpu_nmi - undoes NMI setup of IRQ line
2769 * As a CPU local operation, this should be called from non-preemptible
2796 int err = -EINVAL;
2801 return -ENODEV;
2802 if (chip->irq_get_irqchip_state)
2805 data = data->parent_data;
2812 err = chip->irq_get_irqchip_state(data, which, state);
2817 * irq_get_irqchip_state - returns the irqchip state of a interrupt.
2827 * interrupt controller has per-cpu registers.
2835 int err = -EINVAL;
2851 * irq_set_irqchip_state - set the state of a forwarded interrupt.
2860 * interrupt controller has per-cpu registers.
2869 int err = -EINVAL;
2880 err = -ENODEV;
2883 if (chip->irq_set_irqchip_state)
2886 data = data->parent_data;
2893 err = chip->irq_set_irqchip_state(data, which, val);
2902 * irq_has_action - Check whether an interrupt is requested
2919 * irq_check_status_bit - Check whether bits in the irq descriptor status are set
2933 res = !!(desc->status_use_accessors & bitmask);