Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

irqdomain: Eliminate dedicated radix lookup functions

In preparation to remove the slow revmap path, eliminate the public
radix revmap lookup functions. This simplifies the code and makes the
slowpath removal patch a lot simpler.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Rob Herring <rob.herring@calxeda.com>

+3 -65
+1 -1
arch/powerpc/sysdev/xics/icp-hv.c
··· 111 111 if (vec == XICS_IRQ_SPURIOUS) 112 112 return NO_IRQ; 113 113 114 - irq = irq_radix_revmap_lookup(xics_host, vec); 114 + irq = irq_find_mapping(xics_host, vec); 115 115 if (likely(irq != NO_IRQ)) { 116 116 xics_push_cppr(vec); 117 117 return irq;
+1 -1
arch/powerpc/sysdev/xics/icp-native.c
··· 119 119 if (vec == XICS_IRQ_SPURIOUS) 120 120 return NO_IRQ; 121 121 122 - irq = irq_radix_revmap_lookup(xics_host, vec); 122 + irq = irq_find_mapping(xics_host, vec); 123 123 if (likely(irq != NO_IRQ)) { 124 124 xics_push_cppr(vec); 125 125 return irq;
-4
include/linux/irqdomain.h
··· 174 174 return irq_create_strict_mappings(host, hwirq, hwirq, 1); 175 175 } 176 176 177 - extern void irq_radix_revmap_insert(struct irq_domain *host, unsigned int virq, 178 - irq_hw_number_t hwirq); 179 - extern unsigned int irq_radix_revmap_lookup(struct irq_domain *host, 180 - irq_hw_number_t hwirq); 181 177 extern unsigned int irq_linear_revmap(struct irq_domain *host, 182 178 irq_hw_number_t hwirq); 183 179
+1 -59
kernel/irq/irqdomain.c
··· 450 450 break; 451 451 case IRQ_DOMAIN_MAP_TREE: 452 452 mutex_lock(&revmap_trees_mutex); 453 - irq_radix_revmap_insert(domain, virq, hwirq); 453 + radix_tree_insert(&domain->revmap_data.tree, hwirq, irq_data); 454 454 mutex_unlock(&revmap_trees_mutex); 455 455 break; 456 456 } ··· 722 722 return 0; 723 723 } 724 724 EXPORT_SYMBOL_GPL(irq_find_mapping); 725 - 726 - /** 727 - * irq_radix_revmap_lookup() - Find a linux irq from a hw irq number. 728 - * @domain: domain owning this hardware interrupt 729 - * @hwirq: hardware irq number in that domain space 730 - * 731 - * This is a fast path, for use by irq controller code that uses radix tree 732 - * revmaps 733 - */ 734 - unsigned int irq_radix_revmap_lookup(struct irq_domain *domain, 735 - irq_hw_number_t hwirq) 736 - { 737 - struct irq_data *irq_data; 738 - 739 - if (WARN_ON_ONCE(domain->revmap_type != IRQ_DOMAIN_MAP_TREE)) 740 - return irq_find_mapping(domain, hwirq); 741 - 742 - /* 743 - * Freeing an irq can delete nodes along the path to 744 - * do the lookup via call_rcu. 745 - */ 746 - rcu_read_lock(); 747 - irq_data = radix_tree_lookup(&domain->revmap_data.tree, hwirq); 748 - rcu_read_unlock(); 749 - 750 - /* 751 - * If found in radix tree, then fine. 752 - * Else fallback to linear lookup - this should not happen in practice 753 - * as it means that we failed to insert the node in the radix tree. 754 - */ 755 - return irq_data ? irq_data->irq : irq_find_mapping(domain, hwirq); 756 - } 757 - EXPORT_SYMBOL_GPL(irq_radix_revmap_lookup); 758 - 759 - /** 760 - * irq_radix_revmap_insert() - Insert a hw irq to linux irq number mapping. 761 - * @domain: domain owning this hardware interrupt 762 - * @virq: linux irq number 763 - * @hwirq: hardware irq number in that domain space 764 - * 765 - * This is for use by irq controllers that use a radix tree reverse 766 - * mapping for fast lookup. 767 - */ 768 - void irq_radix_revmap_insert(struct irq_domain *domain, unsigned int virq, 769 - irq_hw_number_t hwirq) 770 - { 771 - struct irq_data *irq_data = irq_get_irq_data(virq); 772 - 773 - if (WARN_ON(domain->revmap_type != IRQ_DOMAIN_MAP_TREE)) 774 - return; 775 - 776 - if (virq) { 777 - mutex_lock(&revmap_trees_mutex); 778 - radix_tree_insert(&domain->revmap_data.tree, hwirq, irq_data); 779 - mutex_unlock(&revmap_trees_mutex); 780 - } 781 - } 782 - EXPORT_SYMBOL_GPL(irq_radix_revmap_insert); 783 725 784 726 /** 785 727 * irq_linear_revmap() - Find a linux irq from a hw irq number.