Skip to content

Commit bae1d8f

Browse files
committed
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>
1 parent 644bd95 commit bae1d8f

43 files changed

Lines changed: 277 additions & 348 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎arch/powerpc/include/asm/ehv_pic.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
struct ehv_pic {
2727
/* The remapper for this EHV_PIC */
28-
struct irq_host *irqhost;
28+
struct irq_domain *irqhost;
2929

3030
/* The "linux" controller struct */
3131
struct irq_chip hc_irq;

‎arch/powerpc/include/asm/i8259.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
extern void i8259_init(struct device_node *node, unsigned long intack_addr);
88
extern unsigned int i8259_irq(void);
9-
extern struct irq_host *i8259_get_host(void);
9+
extern struct irq_domain *i8259_get_host(void);
1010

1111
#endif /* __KERNEL__ */
1212
#endif /* _ASM_POWERPC_I8259_H */

‎arch/powerpc/include/asm/irq.h‎

Lines changed: 20 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* 2 of the License, or (at your option) any later version.
1010
*/
1111

12+
#include <linux/irqdomain.h>
1213
#include <linux/threads.h>
1314
#include <linux/list.h>
1415
#include <linux/radix-tree.h>
@@ -41,20 +42,7 @@ extern atomic_t ppc_n_lost_interrupts;
4142
/* Same thing, used by the generic IRQ code */
4243
#define NR_IRQS_LEGACY NUM_ISA_INTERRUPTS
4344

44-
/* This type is the placeholder for a hardware interrupt number. It has to
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-
*
45+
/*
5846
* The host code and data structures are fairly agnostic to the fact that
5947
* we use an open firmware device-tree. We do have references to struct
6048
* device_node in two places: in irq_find_host() to find the host matching
@@ -66,98 +54,40 @@ typedef unsigned long irq_hw_number_t;
6654
* by some sort of arch-specific void * "token" used to identify interrupt
6755
* controllers.
6856
*/
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-
};
12757

12858
struct irq_data;
12959
extern irq_hw_number_t irqd_to_hwirq(struct irq_data *d);
13060
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);
13262

13363
/**
134-
* irq_alloc_host - Allocate a new irq_host data structure
64+
* irq_alloc_host - Allocate a new irq_domain data structure
13565
* @of_node: optional device-tree node of the interrupt controller
13666
* @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
13868
* @ops: map/unmap host callbacks
13969
* @inval_irq: provide a hw number in that host space that is always invalid
14070
*
141-
* Allocates and initialize and irq_host structure. Note that in the case of
142-
* IRQ_HOST_MAP_LEGACY, the map() callback will be called before this returns
71+
* Allocates and initialize and irq_domain structure. Note that in the case of
72+
* IRQ_DOMAIN_MAP_LEGACY, the map() callback will be called before this returns
14373
* 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
145-
* this call as well. For a IRQ_HOST_MAP_TREE, the radix tree will be allocated
74+
* a legacy controller). For a IRQ_DOMAIN_MAP_LINEAR, the map is allocated by
75+
* this call as well. For a IRQ_DOMAIN_MAP_TREE, the radix tree will be allocated
14676
* later during boot automatically (the reverse mapping will use the slow path
14777
* until that happens).
14878
*/
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,
15080
unsigned int revmap_type,
15181
unsigned int revmap_arg,
152-
struct irq_host_ops *ops,
82+
struct irq_domain_ops *ops,
15383
irq_hw_number_t inval_irq);
15484

15585

15686
/**
15787
* irq_find_host - Locates a host for a given device node
15888
* @node: device-tree node of the interrupt controller
15989
*/
160-
extern struct irq_host *irq_find_host(struct device_node *node);
90+
extern struct irq_domain *irq_find_host(struct device_node *node);
16191

16292

16393
/**
@@ -169,7 +99,7 @@ extern struct irq_host *irq_find_host(struct device_node *node);
16999
* platforms that want to manipulate a few hard coded interrupt numbers that
170100
* aren't properly represented in the device-tree.
171101
*/
172-
extern void irq_set_default_host(struct irq_host *host);
102+
extern void irq_set_default_host(struct irq_domain *host);
173103

174104

175105
/**
@@ -192,7 +122,7 @@ extern void irq_set_virq_count(unsigned int count);
192122
* If the sense/trigger is to be specified, set_irq_type() should be called
193123
* on the number returned from that call.
194124
*/
195-
extern unsigned int irq_create_mapping(struct irq_host *host,
125+
extern unsigned int irq_create_mapping(struct irq_domain *host,
196126
irq_hw_number_t hwirq);
197127

198128

@@ -211,7 +141,7 @@ extern void irq_dispose_mapping(unsigned int virq);
211141
* irq controller implementation directly calls the appropriate low level
212142
* mapping function.
213143
*/
214-
extern unsigned int irq_find_mapping(struct irq_host *host,
144+
extern unsigned int irq_find_mapping(struct irq_domain *host,
215145
irq_hw_number_t hwirq);
216146

217147
/**
@@ -222,7 +152,7 @@ extern unsigned int irq_find_mapping(struct irq_host *host,
222152
* interrupt numbers they generate. In such a case it's simplest to use
223153
* the linux virq as the hardware interrupt number.
224154
*/
225-
extern unsigned int irq_create_direct_mapping(struct irq_host *host);
155+
extern unsigned int irq_create_direct_mapping(struct irq_domain *host);
226156

227157
/**
228158
* 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);
233163
* This is for use by irq controllers that use a radix tree reverse
234164
* mapping for fast lookup.
235165
*/
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,
237167
irq_hw_number_t hwirq);
238168

239169
/**
@@ -244,7 +174,7 @@ extern void irq_radix_revmap_insert(struct irq_host *host, unsigned int virq,
244174
* This is a fast path, for use by irq controller code that uses radix tree
245175
* revmaps
246176
*/
247-
extern unsigned int irq_radix_revmap_lookup(struct irq_host *host,
177+
extern unsigned int irq_radix_revmap_lookup(struct irq_domain *host,
248178
irq_hw_number_t hwirq);
249179

250180
/**
@@ -257,7 +187,7 @@ extern unsigned int irq_radix_revmap_lookup(struct irq_host *host,
257187
* yet and will create the revmap entry with appropriate locking
258188
*/
259189

260-
extern unsigned int irq_linear_revmap(struct irq_host *host,
190+
extern unsigned int irq_linear_revmap(struct irq_domain *host,
261191
irq_hw_number_t hwirq);
262192

263193

@@ -272,7 +202,7 @@ extern unsigned int irq_linear_revmap(struct irq_host *host,
272202
* and that can be used by some irq controllers implementations for things
273203
* like allocating ranges of numbers for MSIs. The revmaps are left untouched.
274204
*/
275-
extern unsigned int irq_alloc_virt(struct irq_host *host,
205+
extern unsigned int irq_alloc_virt(struct irq_domain *host,
276206
unsigned int count,
277207
unsigned int hint);
278208

‎arch/powerpc/include/asm/mpic.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ struct mpic
255255
struct device_node *node;
256256

257257
/* The remapper for this MPIC */
258-
struct irq_host *irqhost;
258+
struct irq_domain *irqhost;
259259

260260
/* The "linux" controller struct */
261261
struct irq_chip hc_irq;

‎arch/powerpc/include/asm/xics.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ struct ics {
8686
extern unsigned int xics_default_server;
8787
extern unsigned int xics_default_distrib_server;
8888
extern unsigned int xics_interrupt_server_size;
89-
extern struct irq_host *xics_host;
89+
extern struct irq_domain *xics_host;
9090

9191
struct xics_cppr {
9292
unsigned char stack[MAX_NUM_PRIORITIES];

0 commit comments

Comments
 (0)