diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2012-02-14 16:06:50 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2012-02-14 16:06:50 -0500 |
commit | bae1d8f19983fbfa25559aa3cb6a81a84aa82a18 (patch) | |
tree | 387012cc698159bfb5851c5022d5b55db2dafadc /arch/powerpc/include | |
parent | 644bd954313254b54e08b69077e16831b6e04dfa (diff) |
irq_domain/powerpc: Use common irq_domain structure instead of irq_host
This patch drops the powerpc-specific irq_host structures and uses the common
irq_domain strucutres defined in linux/irqdomain.h. It also fixes all
the users to use the new structure names.
Renaming irq_host to irq_domain has been discussed for a long time, and this
patch is a step in the process of generalizing the powerpc virq code to be
usable by all architecture.
An astute reader will notice that this patch actually removes the irq_host
structure instead of renaming it. This is because the irq_domain structure
already exists in include/linux/irqdomain.h and has the needed data members.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Milton Miller <miltonm@bga.com>
Tested-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/powerpc/include')
-rw-r--r-- | arch/powerpc/include/asm/ehv_pic.h | 2 | ||||
-rw-r--r-- | arch/powerpc/include/asm/i8259.h | 2 | ||||
-rw-r--r-- | arch/powerpc/include/asm/irq.h | 110 | ||||
-rw-r--r-- | arch/powerpc/include/asm/mpic.h | 2 | ||||
-rw-r--r-- | arch/powerpc/include/asm/xics.h | 2 |
5 files changed, 24 insertions, 94 deletions
diff --git a/arch/powerpc/include/asm/ehv_pic.h b/arch/powerpc/include/asm/ehv_pic.h index a9e1f4f796f6..dc7d48e3ea90 100644 --- a/arch/powerpc/include/asm/ehv_pic.h +++ b/arch/powerpc/include/asm/ehv_pic.h | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | struct ehv_pic { | 26 | struct ehv_pic { |
27 | /* The remapper for this EHV_PIC */ | 27 | /* The remapper for this EHV_PIC */ |
28 | struct irq_host *irqhost; | 28 | struct irq_domain *irqhost; |
29 | 29 | ||
30 | /* The "linux" controller struct */ | 30 | /* The "linux" controller struct */ |
31 | struct irq_chip hc_irq; | 31 | struct irq_chip hc_irq; |
diff --git a/arch/powerpc/include/asm/i8259.h b/arch/powerpc/include/asm/i8259.h index 105ade297aad..c3fdfbd5a673 100644 --- a/arch/powerpc/include/asm/i8259.h +++ b/arch/powerpc/include/asm/i8259.h | |||
@@ -6,7 +6,7 @@ | |||
6 | 6 | ||
7 | extern void i8259_init(struct device_node *node, unsigned long intack_addr); | 7 | extern void i8259_init(struct device_node *node, unsigned long intack_addr); |
8 | extern unsigned int i8259_irq(void); | 8 | extern unsigned int i8259_irq(void); |
9 | extern struct irq_host *i8259_get_host(void); | 9 | extern struct irq_domain *i8259_get_host(void); |
10 | 10 | ||
11 | #endif /* __KERNEL__ */ | 11 | #endif /* __KERNEL__ */ |
12 | #endif /* _ASM_POWERPC_I8259_H */ | 12 | #endif /* _ASM_POWERPC_I8259_H */ |
diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h index c0e1bc319e35..cb06b39f8e61 100644 --- a/arch/powerpc/include/asm/irq.h +++ b/arch/powerpc/include/asm/irq.h | |||
@@ -9,6 +9,7 @@ | |||
9 | * 2 of the License, or (at your option) any later version. | 9 | * 2 of the License, or (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/irqdomain.h> | ||
12 | #include <linux/threads.h> | 13 | #include <linux/threads.h> |
13 | #include <linux/list.h> | 14 | #include <linux/list.h> |
14 | #include <linux/radix-tree.h> | 15 | #include <linux/radix-tree.h> |
@@ -41,20 +42,7 @@ extern atomic_t ppc_n_lost_interrupts; | |||
41 | /* Same thing, used by the generic IRQ code */ | 42 | /* Same thing, used by the generic IRQ code */ |
42 | #define NR_IRQS_LEGACY NUM_ISA_INTERRUPTS | 43 | #define NR_IRQS_LEGACY NUM_ISA_INTERRUPTS |
43 | 44 | ||
44 | /* This type is the placeholder for a hardware interrupt number. It has to | 45 | /* |
45 | * be big enough to enclose whatever representation is used by a given | ||
46 | * platform. | ||
47 | */ | ||
48 | typedef unsigned long irq_hw_number_t; | ||
49 | |||
50 | /* Interrupt controller "host" data structure. This could be defined as a | ||
51 | * irq domain controller. That is, it handles the mapping between hardware | ||
52 | * and virtual interrupt numbers for a given interrupt domain. The host | ||
53 | * structure is generally created by the PIC code for a given PIC instance | ||
54 | * (though a host can cover more than one PIC if they have a flat number | ||
55 | * model). It's the host callbacks that are responsible for setting the | ||
56 | * irq_chip on a given irq_desc after it's been mapped. | ||
57 | * | ||
58 | * The host code and data structures are fairly agnostic to the fact that | 46 | * The host code and data structures are fairly agnostic to the fact that |
59 | * we use an open firmware device-tree. We do have references to struct | 47 | * we use an open firmware device-tree. We do have references to struct |
60 | * device_node in two places: in irq_find_host() to find the host matching | 48 | * device_node in two places: in irq_find_host() to find the host matching |
@@ -66,90 +54,32 @@ typedef unsigned long irq_hw_number_t; | |||
66 | * by some sort of arch-specific void * "token" used to identify interrupt | 54 | * by some sort of arch-specific void * "token" used to identify interrupt |
67 | * controllers. | 55 | * controllers. |
68 | */ | 56 | */ |
69 | struct irq_host; | ||
70 | struct radix_tree_root; | ||
71 | |||
72 | /* Functions below are provided by the host and called whenever a new mapping | ||
73 | * is created or an old mapping is disposed. The host can then proceed to | ||
74 | * whatever internal data structures management is required. It also needs | ||
75 | * to setup the irq_desc when returning from map(). | ||
76 | */ | ||
77 | struct irq_host_ops { | ||
78 | /* Match an interrupt controller device node to a host, returns | ||
79 | * 1 on a match | ||
80 | */ | ||
81 | int (*match)(struct irq_host *h, struct device_node *node); | ||
82 | |||
83 | /* Create or update a mapping between a virtual irq number and a hw | ||
84 | * irq number. This is called only once for a given mapping. | ||
85 | */ | ||
86 | int (*map)(struct irq_host *h, unsigned int virq, irq_hw_number_t hw); | ||
87 | |||
88 | /* Dispose of such a mapping */ | ||
89 | void (*unmap)(struct irq_host *h, unsigned int virq); | ||
90 | |||
91 | /* Translate device-tree interrupt specifier from raw format coming | ||
92 | * from the firmware to a irq_hw_number_t (interrupt line number) and | ||
93 | * type (sense) that can be passed to set_irq_type(). In the absence | ||
94 | * of this callback, irq_create_of_mapping() and irq_of_parse_and_map() | ||
95 | * will return the hw number in the first cell and IRQ_TYPE_NONE for | ||
96 | * the type (which amount to keeping whatever default value the | ||
97 | * interrupt controller has for that line) | ||
98 | */ | ||
99 | int (*xlate)(struct irq_host *h, struct device_node *ctrler, | ||
100 | const u32 *intspec, unsigned int intsize, | ||
101 | irq_hw_number_t *out_hwirq, unsigned int *out_type); | ||
102 | }; | ||
103 | |||
104 | struct irq_host { | ||
105 | struct list_head link; | ||
106 | |||
107 | /* type of reverse mapping technique */ | ||
108 | unsigned int revmap_type; | ||
109 | #define IRQ_HOST_MAP_LEGACY 0 /* legacy 8259, gets irqs 1..15 */ | ||
110 | #define IRQ_HOST_MAP_NOMAP 1 /* no fast reverse mapping */ | ||
111 | #define IRQ_HOST_MAP_LINEAR 2 /* linear map of interrupts */ | ||
112 | #define IRQ_HOST_MAP_TREE 3 /* radix tree */ | ||
113 | union { | ||
114 | struct { | ||
115 | unsigned int size; | ||
116 | unsigned int *revmap; | ||
117 | } linear; | ||
118 | struct radix_tree_root tree; | ||
119 | } revmap_data; | ||
120 | struct irq_host_ops *ops; | ||
121 | void *host_data; | ||
122 | irq_hw_number_t inval_irq; | ||
123 | |||
124 | /* Optional device node pointer */ | ||
125 | struct device_node *of_node; | ||
126 | }; | ||
127 | 57 | ||
128 | struct irq_data; | 58 | struct irq_data; |
129 | extern irq_hw_number_t irqd_to_hwirq(struct irq_data *d); | 59 | extern irq_hw_number_t irqd_to_hwirq(struct irq_data *d); |
130 | extern irq_hw_number_t virq_to_hw(unsigned int virq); | 60 | extern irq_hw_number_t virq_to_hw(unsigned int virq); |
131 | extern bool virq_is_host(unsigned int virq, struct irq_host *host); | 61 | extern bool virq_is_host(unsigned int virq, struct irq_domain *host); |
132 | 62 | ||
133 | /** | 63 | /** |
134 | * irq_alloc_host - Allocate a new irq_host data structure | 64 | * irq_alloc_host - Allocate a new irq_domain data structure |
135 | * @of_node: optional device-tree node of the interrupt controller | 65 | * @of_node: optional device-tree node of the interrupt controller |
136 | * @revmap_type: type of reverse mapping to use | 66 | * @revmap_type: type of reverse mapping to use |
137 | * @revmap_arg: for IRQ_HOST_MAP_LINEAR linear only: size of the map | 67 | * @revmap_arg: for IRQ_DOMAIN_MAP_LINEAR linear only: size of the map |
138 | * @ops: map/unmap host callbacks | 68 | * @ops: map/unmap host callbacks |
139 | * @inval_irq: provide a hw number in that host space that is always invalid | 69 | * @inval_irq: provide a hw number in that host space that is always invalid |
140 | * | 70 | * |
141 | * Allocates and initialize and irq_host structure. Note that in the case of | 71 | * Allocates and initialize and irq_domain structure. Note that in the case of |
142 | * IRQ_HOST_MAP_LEGACY, the map() callback will be called before this returns | 72 | * IRQ_DOMAIN_MAP_LEGACY, the map() callback will be called before this returns |
143 | * for all legacy interrupts except 0 (which is always the invalid irq for | 73 | * for all legacy interrupts except 0 (which is always the invalid irq for |
144 | * a legacy controller). For a IRQ_HOST_MAP_LINEAR, the map is allocated by | 74 | * a legacy controller). For a IRQ_DOMAIN_MAP_LINEAR, the map is allocated by |
145 | * this call as well. For a IRQ_HOST_MAP_TREE, the radix tree will be allocated | 75 | * this call as well. For a IRQ_DOMAIN_MAP_TREE, the radix tree will be allocated |
146 | * later during boot automatically (the reverse mapping will use the slow path | 76 | * later during boot automatically (the reverse mapping will use the slow path |
147 | * until that happens). | 77 | * until that happens). |
148 | */ | 78 | */ |
149 | extern struct irq_host *irq_alloc_host(struct device_node *of_node, | 79 | extern struct irq_domain *irq_alloc_host(struct device_node *of_node, |
150 | unsigned int revmap_type, | 80 | unsigned int revmap_type, |
151 | unsigned int revmap_arg, | 81 | unsigned int revmap_arg, |
152 | struct irq_host_ops *ops, | 82 | struct irq_domain_ops *ops, |
153 | irq_hw_number_t inval_irq); | 83 | irq_hw_number_t inval_irq); |
154 | 84 | ||
155 | 85 | ||
@@ -157,7 +87,7 @@ extern struct irq_host *irq_alloc_host(struct device_node *of_node, | |||
157 | * irq_find_host - Locates a host for a given device node | 87 | * irq_find_host - Locates a host for a given device node |
158 | * @node: device-tree node of the interrupt controller | 88 | * @node: device-tree node of the interrupt controller |
159 | */ | 89 | */ |
160 | extern struct irq_host *irq_find_host(struct device_node *node); | 90 | extern struct irq_domain *irq_find_host(struct device_node *node); |
161 | 91 | ||
162 | 92 | ||
163 | /** | 93 | /** |
@@ -169,7 +99,7 @@ extern struct irq_host *irq_find_host(struct device_node *node); | |||
169 | * platforms that want to manipulate a few hard coded interrupt numbers that | 99 | * platforms that want to manipulate a few hard coded interrupt numbers that |
170 | * aren't properly represented in the device-tree. | 100 | * aren't properly represented in the device-tree. |
171 | */ | 101 | */ |
172 | extern void irq_set_default_host(struct irq_host *host); | 102 | extern void irq_set_default_host(struct irq_domain *host); |
173 | 103 | ||
174 | 104 | ||
175 | /** | 105 | /** |
@@ -192,7 +122,7 @@ extern void irq_set_virq_count(unsigned int count); | |||
192 | * If the sense/trigger is to be specified, set_irq_type() should be called | 122 | * If the sense/trigger is to be specified, set_irq_type() should be called |
193 | * on the number returned from that call. | 123 | * on the number returned from that call. |
194 | */ | 124 | */ |
195 | extern unsigned int irq_create_mapping(struct irq_host *host, | 125 | extern unsigned int irq_create_mapping(struct irq_domain *host, |
196 | irq_hw_number_t hwirq); | 126 | irq_hw_number_t hwirq); |
197 | 127 | ||
198 | 128 | ||
@@ -211,7 +141,7 @@ extern void irq_dispose_mapping(unsigned int virq); | |||
211 | * irq controller implementation directly calls the appropriate low level | 141 | * irq controller implementation directly calls the appropriate low level |
212 | * mapping function. | 142 | * mapping function. |
213 | */ | 143 | */ |
214 | extern unsigned int irq_find_mapping(struct irq_host *host, | 144 | extern unsigned int irq_find_mapping(struct irq_domain *host, |
215 | irq_hw_number_t hwirq); | 145 | irq_hw_number_t hwirq); |
216 | 146 | ||
217 | /** | 147 | /** |
@@ -222,7 +152,7 @@ extern unsigned int irq_find_mapping(struct irq_host *host, | |||
222 | * interrupt numbers they generate. In such a case it's simplest to use | 152 | * interrupt numbers they generate. In such a case it's simplest to use |
223 | * the linux virq as the hardware interrupt number. | 153 | * the linux virq as the hardware interrupt number. |
224 | */ | 154 | */ |
225 | extern unsigned int irq_create_direct_mapping(struct irq_host *host); | 155 | extern unsigned int irq_create_direct_mapping(struct irq_domain *host); |
226 | 156 | ||
227 | /** | 157 | /** |
228 | * irq_radix_revmap_insert - Insert a hw irq to linux virq number mapping. | 158 | * irq_radix_revmap_insert - Insert a hw irq to linux virq number mapping. |
@@ -233,7 +163,7 @@ extern unsigned int irq_create_direct_mapping(struct irq_host *host); | |||
233 | * This is for use by irq controllers that use a radix tree reverse | 163 | * This is for use by irq controllers that use a radix tree reverse |
234 | * mapping for fast lookup. | 164 | * mapping for fast lookup. |
235 | */ | 165 | */ |
236 | extern void irq_radix_revmap_insert(struct irq_host *host, unsigned int virq, | 166 | extern void irq_radix_revmap_insert(struct irq_domain *host, unsigned int virq, |
237 | irq_hw_number_t hwirq); | 167 | irq_hw_number_t hwirq); |
238 | 168 | ||
239 | /** | 169 | /** |
@@ -244,7 +174,7 @@ extern void irq_radix_revmap_insert(struct irq_host *host, unsigned int virq, | |||
244 | * This is a fast path, for use by irq controller code that uses radix tree | 174 | * This is a fast path, for use by irq controller code that uses radix tree |
245 | * revmaps | 175 | * revmaps |
246 | */ | 176 | */ |
247 | extern unsigned int irq_radix_revmap_lookup(struct irq_host *host, | 177 | extern unsigned int irq_radix_revmap_lookup(struct irq_domain *host, |
248 | irq_hw_number_t hwirq); | 178 | irq_hw_number_t hwirq); |
249 | 179 | ||
250 | /** | 180 | /** |
@@ -257,7 +187,7 @@ extern unsigned int irq_radix_revmap_lookup(struct irq_host *host, | |||
257 | * yet and will create the revmap entry with appropriate locking | 187 | * yet and will create the revmap entry with appropriate locking |
258 | */ | 188 | */ |
259 | 189 | ||
260 | extern unsigned int irq_linear_revmap(struct irq_host *host, | 190 | extern unsigned int irq_linear_revmap(struct irq_domain *host, |
261 | irq_hw_number_t hwirq); | 191 | irq_hw_number_t hwirq); |
262 | 192 | ||
263 | 193 | ||
@@ -272,7 +202,7 @@ extern unsigned int irq_linear_revmap(struct irq_host *host, | |||
272 | * and that can be used by some irq controllers implementations for things | 202 | * and that can be used by some irq controllers implementations for things |
273 | * like allocating ranges of numbers for MSIs. The revmaps are left untouched. | 203 | * like allocating ranges of numbers for MSIs. The revmaps are left untouched. |
274 | */ | 204 | */ |
275 | extern unsigned int irq_alloc_virt(struct irq_host *host, | 205 | extern unsigned int irq_alloc_virt(struct irq_domain *host, |
276 | unsigned int count, | 206 | unsigned int count, |
277 | unsigned int hint); | 207 | unsigned int hint); |
278 | 208 | ||
diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h index 67b4d9837236..a5b7c56237f9 100644 --- a/arch/powerpc/include/asm/mpic.h +++ b/arch/powerpc/include/asm/mpic.h | |||
@@ -255,7 +255,7 @@ struct mpic | |||
255 | struct device_node *node; | 255 | struct device_node *node; |
256 | 256 | ||
257 | /* The remapper for this MPIC */ | 257 | /* The remapper for this MPIC */ |
258 | struct irq_host *irqhost; | 258 | struct irq_domain *irqhost; |
259 | 259 | ||
260 | /* The "linux" controller struct */ | 260 | /* The "linux" controller struct */ |
261 | struct irq_chip hc_irq; | 261 | struct irq_chip hc_irq; |
diff --git a/arch/powerpc/include/asm/xics.h b/arch/powerpc/include/asm/xics.h index c48de98ba94e..4ae9a09c3b89 100644 --- a/arch/powerpc/include/asm/xics.h +++ b/arch/powerpc/include/asm/xics.h | |||
@@ -86,7 +86,7 @@ struct ics { | |||
86 | extern unsigned int xics_default_server; | 86 | extern unsigned int xics_default_server; |
87 | extern unsigned int xics_default_distrib_server; | 87 | extern unsigned int xics_default_distrib_server; |
88 | extern unsigned int xics_interrupt_server_size; | 88 | extern unsigned int xics_interrupt_server_size; |
89 | extern struct irq_host *xics_host; | 89 | extern struct irq_domain *xics_host; |
90 | 90 | ||
91 | struct xics_cppr { | 91 | struct xics_cppr { |
92 | unsigned char stack[MAX_NUM_PRIORITIES]; | 92 | unsigned char stack[MAX_NUM_PRIORITIES]; |