Lines Matching refs:virq
591 static int irq_domain_associate_locked(struct irq_domain *domain, unsigned int virq, in irq_domain_associate_locked() argument
594 struct irq_data *irq_data = irq_get_irq_data(virq); in irq_domain_associate_locked()
600 if (WARN(!irq_data, "error: virq%i is not allocated", virq)) in irq_domain_associate_locked()
602 if (WARN(irq_data->domain, "error: virq%i is already associated", virq)) in irq_domain_associate_locked()
608 ret = domain->ops->map(domain, virq, hwirq); in irq_domain_associate_locked()
617 domain->name, hwirq, virq, ret); in irq_domain_associate_locked()
632 irq_clear_status_flags(virq, IRQ_NOREQUEST); in irq_domain_associate_locked()
637 int irq_domain_associate(struct irq_domain *domain, unsigned int virq, in irq_domain_associate() argument
643 ret = irq_domain_associate_locked(domain, virq, hwirq); in irq_domain_associate()
680 unsigned int virq; in irq_create_direct_mapping() local
686 virq = irq_alloc_desc_from(1, of_node_to_nid(of_node)); in irq_create_direct_mapping()
687 if (!virq) { in irq_create_direct_mapping()
691 if (virq >= domain->hwirq_max) { in irq_create_direct_mapping()
694 irq_free_desc(virq); in irq_create_direct_mapping()
697 pr_debug("create_direct obtained virq %d\n", virq); in irq_create_direct_mapping()
699 if (irq_domain_associate(domain, virq, virq)) { in irq_create_direct_mapping()
700 irq_free_desc(virq); in irq_create_direct_mapping()
704 return virq; in irq_create_direct_mapping()
714 int virq; in irq_create_mapping_affinity_locked() local
719 virq = irq_domain_alloc_descs(-1, 1, hwirq, of_node_to_nid(of_node), in irq_create_mapping_affinity_locked()
721 if (virq <= 0) { in irq_create_mapping_affinity_locked()
726 if (irq_domain_associate_locked(domain, virq, hwirq)) { in irq_create_mapping_affinity_locked()
727 irq_free_desc(virq); in irq_create_mapping_affinity_locked()
732 hwirq, of_node_full_name(of_node), virq); in irq_create_mapping_affinity_locked()
734 return virq; in irq_create_mapping_affinity_locked()
752 int virq; in irq_create_mapping_affinity() local
765 virq = irq_find_mapping(domain, hwirq); in irq_create_mapping_affinity()
766 if (virq) { in irq_create_mapping_affinity()
767 pr_debug("existing mapping on virq %d\n", virq); in irq_create_mapping_affinity()
771 virq = irq_create_mapping_affinity_locked(domain, hwirq, affinity); in irq_create_mapping_affinity()
775 return virq; in irq_create_mapping_affinity()
816 int virq; in irq_create_fwspec_mapping() local
848 virq = irq_find_mapping(domain, hwirq); in irq_create_fwspec_mapping()
849 if (virq) { in irq_create_fwspec_mapping()
855 if (type == IRQ_TYPE_NONE || type == irq_get_trigger_type(virq)) in irq_create_fwspec_mapping()
862 if (irq_get_trigger_type(virq) == IRQ_TYPE_NONE) { in irq_create_fwspec_mapping()
863 irq_data = irq_get_irq_data(virq); in irq_create_fwspec_mapping()
865 virq = 0; in irq_create_fwspec_mapping()
875 virq = 0; in irq_create_fwspec_mapping()
880 virq = irq_domain_alloc_irqs_locked(domain, -1, 1, NUMA_NO_NODE, in irq_create_fwspec_mapping()
882 if (virq <= 0) { in irq_create_fwspec_mapping()
883 virq = 0; in irq_create_fwspec_mapping()
888 virq = irq_create_mapping_affinity_locked(domain, hwirq, NULL); in irq_create_fwspec_mapping()
889 if (!virq) in irq_create_fwspec_mapping()
893 irq_data = irq_get_irq_data(virq); in irq_create_fwspec_mapping()
895 virq = 0; in irq_create_fwspec_mapping()
904 return virq; in irq_create_fwspec_mapping()
923 void irq_dispose_mapping(unsigned int virq) in irq_dispose_mapping() argument
925 struct irq_data *irq_data = irq_get_irq_data(virq); in irq_dispose_mapping()
928 if (!virq || !irq_data) in irq_dispose_mapping()
936 irq_domain_free_irqs(virq, 1); in irq_dispose_mapping()
938 irq_domain_disassociate(domain, virq); in irq_dispose_mapping()
939 irq_free_desc(virq); in irq_dispose_mapping()
1101 int irq_domain_alloc_descs(int virq, unsigned int cnt, irq_hw_number_t hwirq, in irq_domain_alloc_descs() argument
1106 if (virq >= 0) { in irq_domain_alloc_descs()
1107 virq = __irq_alloc_descs(virq, virq, cnt, node, THIS_MODULE, in irq_domain_alloc_descs()
1113 virq = __irq_alloc_descs(-1, hint, cnt, node, THIS_MODULE, in irq_domain_alloc_descs()
1115 if (virq <= 0 && hint > 1) { in irq_domain_alloc_descs()
1116 virq = __irq_alloc_descs(-1, 1, cnt, node, THIS_MODULE, in irq_domain_alloc_descs()
1121 return virq; in irq_domain_alloc_descs()
1177 static void irq_domain_insert_irq(int virq) in irq_domain_insert_irq() argument
1181 for (data = irq_get_irq_data(virq); data; data = data->parent_data) { in irq_domain_insert_irq()
1192 irq_clear_status_flags(virq, IRQ_NOREQUEST); in irq_domain_insert_irq()
1195 static void irq_domain_remove_irq(int virq) in irq_domain_remove_irq() argument
1199 irq_set_status_flags(virq, IRQ_NOREQUEST); in irq_domain_remove_irq()
1200 irq_set_chip_and_handler(virq, NULL, NULL); in irq_domain_remove_irq()
1201 synchronize_irq(virq); in irq_domain_remove_irq()
1204 for (data = irq_get_irq_data(virq); data; data = data->parent_data) { in irq_domain_remove_irq()
1241 static void irq_domain_free_irq_data(unsigned int virq, unsigned int nr_irqs) in irq_domain_free_irq_data() argument
1247 irq_data = irq_get_irq_data(virq + i); in irq_domain_free_irq_data()
1270 unsigned int virq) in irq_domain_disconnect_hierarchy() argument
1274 irqd = irq_domain_get_irq_data(domain, virq); in irq_domain_disconnect_hierarchy()
1283 static int irq_domain_trim_hierarchy(unsigned int virq) in irq_domain_trim_hierarchy() argument
1287 irq_data = irq_get_irq_data(virq); in irq_domain_trim_hierarchy()
1321 virq, tail->parent_data->domain->name); in irq_domain_trim_hierarchy()
1333 unsigned int virq, unsigned int nr_irqs) in irq_domain_alloc_irq_data() argument
1341 irq_data = irq_get_irq_data(virq + i); in irq_domain_alloc_irq_data()
1347 irq_domain_free_irq_data(virq, i + 1); in irq_domain_alloc_irq_data()
1362 unsigned int virq) in irq_domain_get_irq_data() argument
1366 for (irq_data = irq_get_irq_data(virq); irq_data; in irq_domain_get_irq_data()
1383 int irq_domain_set_hwirq_and_chip(struct irq_domain *domain, unsigned int virq, in irq_domain_set_hwirq_and_chip() argument
1388 struct irq_data *irq_data = irq_domain_get_irq_data(domain, virq); in irq_domain_set_hwirq_and_chip()
1412 void irq_domain_set_info(struct irq_domain *domain, unsigned int virq, in irq_domain_set_info() argument
1417 irq_domain_set_hwirq_and_chip(domain, virq, hwirq, chip, chip_data); in irq_domain_set_info()
1418 __irq_set_handler(virq, handler, 0, handler_name); in irq_domain_set_info()
1419 irq_set_handler_data(virq, handler_data); in irq_domain_set_info()
1429 void irq_domain_free_irqs_common(struct irq_domain *domain, unsigned int virq, in irq_domain_free_irqs_common() argument
1436 irq_data = irq_domain_get_irq_data(domain, virq + i); in irq_domain_free_irqs_common()
1440 irq_domain_free_irqs_parent(domain, virq, nr_irqs); in irq_domain_free_irqs_common()
1450 void irq_domain_free_irqs_top(struct irq_domain *domain, unsigned int virq, in irq_domain_free_irqs_top() argument
1456 irq_set_handler_data(virq + i, NULL); in irq_domain_free_irqs_top()
1457 irq_set_handler(virq + i, NULL); in irq_domain_free_irqs_top()
1459 irq_domain_free_irqs_common(domain, virq, nr_irqs); in irq_domain_free_irqs_top()
1493 int i, ret, virq; in irq_domain_alloc_irqs_locked() local
1496 virq = irq_base; in irq_domain_alloc_irqs_locked()
1498 virq = irq_domain_alloc_descs(irq_base, nr_irqs, 0, node, in irq_domain_alloc_irqs_locked()
1500 if (virq < 0) { in irq_domain_alloc_irqs_locked()
1503 return virq; in irq_domain_alloc_irqs_locked()
1507 if (irq_domain_alloc_irq_data(domain, virq, nr_irqs)) { in irq_domain_alloc_irqs_locked()
1508 pr_debug("cannot allocate memory for IRQ%d\n", virq); in irq_domain_alloc_irqs_locked()
1513 ret = irq_domain_alloc_irqs_hierarchy(domain, virq, nr_irqs, arg); in irq_domain_alloc_irqs_locked()
1518 ret = irq_domain_trim_hierarchy(virq + i); in irq_domain_alloc_irqs_locked()
1524 irq_domain_insert_irq(virq + i); in irq_domain_alloc_irqs_locked()
1526 return virq; in irq_domain_alloc_irqs_locked()
1529 irq_domain_free_irq_data(virq, nr_irqs); in irq_domain_alloc_irqs_locked()
1531 irq_free_descs(virq, nr_irqs); in irq_domain_alloc_irqs_locked()
1610 int irq_domain_push_irq(struct irq_domain *domain, int virq, void *arg) in irq_domain_push_irq() argument
1613 struct irq_data *root_irq_data = irq_get_irq_data(virq); in irq_domain_push_irq()
1626 desc = irq_to_desc(virq); in irq_domain_push_irq()
1666 rv = irq_domain_alloc_irqs_hierarchy(domain, virq, 1, arg); in irq_domain_push_irq()
1692 int irq_domain_pop_irq(struct irq_domain *domain, int virq) in irq_domain_pop_irq() argument
1694 struct irq_data *root_irq_data = irq_get_irq_data(virq); in irq_domain_pop_irq()
1708 desc = irq_to_desc(virq); in irq_domain_pop_irq()
1720 tmp_irq_data = irq_domain_get_irq_data(domain, virq); in irq_domain_pop_irq()
1738 irq_domain_free_irqs_hierarchy(domain, virq, 1); in irq_domain_pop_irq()
1758 void irq_domain_free_irqs(unsigned int virq, unsigned int nr_irqs) in irq_domain_free_irqs() argument
1760 struct irq_data *data = irq_get_irq_data(virq); in irq_domain_free_irqs()
1769 irq_domain_remove_irq(virq + i); in irq_domain_free_irqs()
1770 irq_domain_free_irqs_hierarchy(data->domain, virq, nr_irqs); in irq_domain_free_irqs()
1773 irq_domain_free_irq_data(virq, nr_irqs); in irq_domain_free_irqs()
1774 irq_free_descs(virq, nr_irqs); in irq_domain_free_irqs()
1907 unsigned int virq) in irq_domain_get_irq_data() argument
1909 struct irq_data *irq_data = irq_get_irq_data(virq); in irq_domain_get_irq_data()
1926 void irq_domain_set_info(struct irq_domain *domain, unsigned int virq, in irq_domain_set_info() argument
1931 irq_set_chip_and_handler_name(virq, chip, handler, handler_name); in irq_domain_set_info()
1932 irq_set_chip_data(virq, chip_data); in irq_domain_set_info()
1933 irq_set_handler_data(virq, handler_data); in irq_domain_set_info()