Lines Matching refs:desc

54 static int alloc_masks(struct irq_desc *desc, int node)  in alloc_masks()  argument
56 if (!zalloc_cpumask_var_node(&desc->irq_common_data.affinity, in alloc_masks()
61 if (!zalloc_cpumask_var_node(&desc->irq_common_data.effective_affinity, in alloc_masks()
63 free_cpumask_var(desc->irq_common_data.affinity); in alloc_masks()
69 if (!zalloc_cpumask_var_node(&desc->pending_mask, GFP_KERNEL, node)) { in alloc_masks()
71 free_cpumask_var(desc->irq_common_data.effective_affinity); in alloc_masks()
73 free_cpumask_var(desc->irq_common_data.affinity); in alloc_masks()
80 static void desc_smp_init(struct irq_desc *desc, int node, in desc_smp_init() argument
85 cpumask_copy(desc->irq_common_data.affinity, affinity); in desc_smp_init()
88 cpumask_clear(desc->pending_mask); in desc_smp_init()
91 desc->irq_common_data.node = node; in desc_smp_init()
97 alloc_masks(struct irq_desc *desc, int node) { return 0; } in alloc_masks() argument
99 desc_smp_init(struct irq_desc *desc, int node, const struct cpumask *affinity) { } in desc_smp_init() argument
102 static void desc_set_defaults(unsigned int irq, struct irq_desc *desc, int node, in desc_set_defaults() argument
107 desc->irq_common_data.handler_data = NULL; in desc_set_defaults()
108 desc->irq_common_data.msi_desc = NULL; in desc_set_defaults()
110 desc->irq_data.common = &desc->irq_common_data; in desc_set_defaults()
111 desc->irq_data.irq = irq; in desc_set_defaults()
112 desc->irq_data.chip = &no_irq_chip; in desc_set_defaults()
113 desc->irq_data.chip_data = NULL; in desc_set_defaults()
114 irq_settings_clr_and_set(desc, ~0, _IRQ_DEFAULT_INIT_FLAGS); in desc_set_defaults()
115 irqd_set(&desc->irq_data, IRQD_IRQ_DISABLED); in desc_set_defaults()
116 irqd_set(&desc->irq_data, IRQD_IRQ_MASKED); in desc_set_defaults()
117 desc->handle_irq = handle_bad_irq; in desc_set_defaults()
118 desc->depth = 1; in desc_set_defaults()
119 desc->irq_count = 0; in desc_set_defaults()
120 desc->irqs_unhandled = 0; in desc_set_defaults()
121 desc->tot_count = 0; in desc_set_defaults()
122 desc->name = NULL; in desc_set_defaults()
123 desc->owner = owner; in desc_set_defaults()
125 *per_cpu_ptr(desc->kstat_irqs, cpu) = 0; in desc_set_defaults()
126 desc_smp_init(desc, node, affinity); in desc_set_defaults()
151 struct irq_desc *desc = mt_find(&sparse_irqs, &index, nr_irqs); in irq_find_at_or_after() local
153 return desc ? irq_desc_get_irq(desc) : nr_irqs; in irq_find_at_or_after()
156 static void irq_insert_desc(unsigned int irq, struct irq_desc *desc) in irq_insert_desc() argument
159 WARN_ON(mas_store_gfp(&mas, desc, GFP_KERNEL) != 0); in irq_insert_desc()
181 struct irq_desc *desc = container_of(kobj, struct irq_desc, kobj); in per_cpu_count_show() local
187 unsigned int c = irq_desc_kstat_cpu(desc, cpu); in per_cpu_count_show()
201 struct irq_desc *desc = container_of(kobj, struct irq_desc, kobj); in chip_name_show() local
204 raw_spin_lock_irq(&desc->lock); in chip_name_show()
205 if (desc->irq_data.chip && desc->irq_data.chip->name) { in chip_name_show()
207 desc->irq_data.chip->name); in chip_name_show()
209 raw_spin_unlock_irq(&desc->lock); in chip_name_show()
218 struct irq_desc *desc = container_of(kobj, struct irq_desc, kobj); in hwirq_show() local
221 raw_spin_lock_irq(&desc->lock); in hwirq_show()
222 if (desc->irq_data.domain) in hwirq_show()
223 ret = sprintf(buf, "%lu\n", desc->irq_data.hwirq); in hwirq_show()
224 raw_spin_unlock_irq(&desc->lock); in hwirq_show()
233 struct irq_desc *desc = container_of(kobj, struct irq_desc, kobj); in type_show() local
236 raw_spin_lock_irq(&desc->lock); in type_show()
238 irqd_is_level_type(&desc->irq_data) ? "level" : "edge"); in type_show()
239 raw_spin_unlock_irq(&desc->lock); in type_show()
249 struct irq_desc *desc = container_of(kobj, struct irq_desc, kobj); in wakeup_show() local
252 raw_spin_lock_irq(&desc->lock); in wakeup_show()
254 irqd_is_wakeup_set(&desc->irq_data) ? "enabled" : "disabled"); in wakeup_show()
255 raw_spin_unlock_irq(&desc->lock); in wakeup_show()
265 struct irq_desc *desc = container_of(kobj, struct irq_desc, kobj); in name_show() local
268 raw_spin_lock_irq(&desc->lock); in name_show()
269 if (desc->name) in name_show()
270 ret = scnprintf(buf, PAGE_SIZE, "%s\n", desc->name); in name_show()
271 raw_spin_unlock_irq(&desc->lock); in name_show()
280 struct irq_desc *desc = container_of(kobj, struct irq_desc, kobj); in actions_show() local
285 raw_spin_lock_irq(&desc->lock); in actions_show()
286 for_each_action_of_desc(desc, action) { in actions_show()
291 raw_spin_unlock_irq(&desc->lock); in actions_show()
318 static void irq_sysfs_add(int irq, struct irq_desc *desc) in irq_sysfs_add() argument
326 if (kobject_add(&desc->kobj, irq_kobj_base, "%d", irq)) in irq_sysfs_add()
329 desc->istate |= IRQS_SYSFS; in irq_sysfs_add()
333 static void irq_sysfs_del(struct irq_desc *desc) in irq_sysfs_del() argument
341 if (desc->istate & IRQS_SYSFS) in irq_sysfs_del()
342 kobject_del(&desc->kobj); in irq_sysfs_del()
347 struct irq_desc *desc; in irq_sysfs_init() local
360 for_each_irq_desc(irq, desc) in irq_sysfs_init()
361 irq_sysfs_add(irq, desc); in irq_sysfs_init()
374 static void irq_sysfs_add(int irq, struct irq_desc *desc) {} in irq_sysfs_add() argument
375 static void irq_sysfs_del(struct irq_desc *desc) {} in irq_sysfs_del() argument
388 static void free_masks(struct irq_desc *desc) in free_masks() argument
391 free_cpumask_var(desc->pending_mask); in free_masks()
393 free_cpumask_var(desc->irq_common_data.affinity); in free_masks()
395 free_cpumask_var(desc->irq_common_data.effective_affinity); in free_masks()
399 static inline void free_masks(struct irq_desc *desc) { } in free_masks() argument
416 struct irq_desc *desc; in alloc_desc() local
418 desc = kzalloc_node(sizeof(*desc), GFP_KERNEL, node); in alloc_desc()
419 if (!desc) in alloc_desc()
422 desc->kstat_irqs = alloc_percpu(unsigned int); in alloc_desc()
423 if (!desc->kstat_irqs) in alloc_desc()
426 if (alloc_masks(desc, node)) in alloc_desc()
429 raw_spin_lock_init(&desc->lock); in alloc_desc()
430 lockdep_set_class(&desc->lock, &irq_desc_lock_class); in alloc_desc()
431 mutex_init(&desc->request_mutex); in alloc_desc()
432 init_rcu_head(&desc->rcu); in alloc_desc()
433 init_waitqueue_head(&desc->wait_for_threads); in alloc_desc()
435 desc_set_defaults(irq, desc, node, affinity, owner); in alloc_desc()
436 irqd_set(&desc->irq_data, flags); in alloc_desc()
437 kobject_init(&desc->kobj, &irq_kobj_type); in alloc_desc()
438 irq_resend_init(desc); in alloc_desc()
440 return desc; in alloc_desc()
443 free_percpu(desc->kstat_irqs); in alloc_desc()
445 kfree(desc); in alloc_desc()
451 struct irq_desc *desc = container_of(kobj, struct irq_desc, kobj); in irq_kobj_release() local
453 free_masks(desc); in irq_kobj_release()
454 free_percpu(desc->kstat_irqs); in irq_kobj_release()
455 kfree(desc); in irq_kobj_release()
460 struct irq_desc *desc = container_of(rhp, struct irq_desc, rcu); in delayed_free_desc() local
462 kobject_put(&desc->kobj); in delayed_free_desc()
467 struct irq_desc *desc = irq_to_desc(irq); in free_desc() local
469 irq_remove_debugfs_entry(desc); in free_desc()
470 unregister_irq_proc(irq, desc); in free_desc()
481 irq_sysfs_del(desc); in free_desc()
490 call_rcu(&desc->rcu, delayed_free_desc); in free_desc()
497 struct irq_desc *desc; in alloc_descs() local
522 desc = alloc_desc(start + i, node, flags, mask, owner); in alloc_descs()
523 if (!desc) in alloc_descs()
525 irq_insert_desc(start + i, desc); in alloc_descs()
526 irq_sysfs_add(start + i, desc); in alloc_descs()
527 irq_add_debugfs_entry(start + i, desc); in alloc_descs()
548 struct irq_desc *desc; in early_irq_init() local
567 desc = alloc_desc(i, node, 0, NULL, NULL); in early_irq_init()
568 irq_insert_desc(i, desc); in early_irq_init()
586 struct irq_desc *desc; in early_irq_init() local
592 desc = irq_desc; in early_irq_init()
596 desc[i].kstat_irqs = alloc_percpu(unsigned int); in early_irq_init()
597 alloc_masks(&desc[i], node); in early_irq_init()
598 raw_spin_lock_init(&desc[i].lock); in early_irq_init()
599 lockdep_set_class(&desc[i].lock, &irq_desc_lock_class); in early_irq_init()
600 mutex_init(&desc[i].request_mutex); in early_irq_init()
601 init_waitqueue_head(&desc[i].wait_for_threads); in early_irq_init()
602 desc_set_defaults(i, &desc[i], node, NULL, NULL); in early_irq_init()
603 irq_resend_init(&desc[i]); in early_irq_init()
616 struct irq_desc *desc = irq_to_desc(irq); in free_desc() local
619 raw_spin_lock_irqsave(&desc->lock, flags); in free_desc()
620 desc_set_defaults(irq, desc, irq_desc_get_node(desc), NULL, NULL); in free_desc()
621 raw_spin_unlock_irqrestore(&desc->lock, flags); in free_desc()
632 struct irq_desc *desc = irq_to_desc(start + i); in alloc_descs() local
634 desc->owner = owner; in alloc_descs()
635 irq_insert_desc(start + i, desc); in alloc_descs()
661 int handle_irq_desc(struct irq_desc *desc) in handle_irq_desc() argument
665 if (!desc) in handle_irq_desc()
668 data = irq_desc_get_irq_data(desc); in handle_irq_desc()
672 generic_handle_irq_desc(desc); in handle_irq_desc()
865 struct irq_desc *desc = irq_to_desc(irq); in __irq_get_desc_lock() local
867 if (desc) { in __irq_get_desc_lock()
870 !irq_settings_is_per_cpu_devid(desc)) in __irq_get_desc_lock()
874 irq_settings_is_per_cpu_devid(desc)) in __irq_get_desc_lock()
879 chip_bus_lock(desc); in __irq_get_desc_lock()
880 raw_spin_lock_irqsave(&desc->lock, *flags); in __irq_get_desc_lock()
882 return desc; in __irq_get_desc_lock()
885 void __irq_put_desc_unlock(struct irq_desc *desc, unsigned long flags, bool bus) in __irq_put_desc_unlock() argument
886 __releases(&desc->lock) in __irq_put_desc_unlock()
888 raw_spin_unlock_irqrestore(&desc->lock, flags); in __irq_put_desc_unlock()
890 chip_bus_sync_unlock(desc); in __irq_put_desc_unlock()
896 struct irq_desc *desc = irq_to_desc(irq); in irq_set_percpu_devid_partition() local
898 if (!desc) in irq_set_percpu_devid_partition()
901 if (desc->percpu_enabled) in irq_set_percpu_devid_partition()
904 desc->percpu_enabled = kzalloc(sizeof(*desc->percpu_enabled), GFP_KERNEL); in irq_set_percpu_devid_partition()
906 if (!desc->percpu_enabled) in irq_set_percpu_devid_partition()
910 desc->percpu_affinity = affinity; in irq_set_percpu_devid_partition()
912 desc->percpu_affinity = cpu_possible_mask; in irq_set_percpu_devid_partition()
925 struct irq_desc *desc = irq_to_desc(irq); in irq_get_percpu_devid_partition() local
927 if (!desc || !desc->percpu_enabled) in irq_get_percpu_devid_partition()
931 cpumask_copy(affinity, desc->percpu_affinity); in irq_get_percpu_devid_partition()
953 struct irq_desc *desc = irq_to_desc(irq); in kstat_irqs_cpu() local
955 return desc && desc->kstat_irqs ? in kstat_irqs_cpu()
956 *per_cpu_ptr(desc->kstat_irqs, cpu) : 0; in kstat_irqs_cpu()
959 static bool irq_is_nmi(struct irq_desc *desc) in irq_is_nmi() argument
961 return desc->istate & IRQS_NMI; in irq_is_nmi()
966 struct irq_desc *desc = irq_to_desc(irq); in kstat_irqs() local
970 if (!desc || !desc->kstat_irqs) in kstat_irqs()
972 if (!irq_settings_is_per_cpu_devid(desc) && in kstat_irqs()
973 !irq_settings_is_per_cpu(desc) && in kstat_irqs()
974 !irq_is_nmi(desc)) in kstat_irqs()
975 return data_race(desc->tot_count); in kstat_irqs()
978 sum += data_race(*per_cpu_ptr(desc->kstat_irqs, cpu)); in kstat_irqs()
1006 struct irq_desc *desc = irq_to_desc(irq); in __irq_set_lockdep_class() local
1008 if (desc) { in __irq_set_lockdep_class()
1009 lockdep_set_class(&desc->lock, lock_class); in __irq_set_lockdep_class()
1010 lockdep_set_class(&desc->request_mutex, request_class); in __irq_set_lockdep_class()