1 /* SPDX-License-Identifier: GPL-2.0 */
3 * irq_domain - IRQ translation domains
5 * Translation infrastructure between hw and linux irq numbers. This is
6 * helpful for interrupt controllers to implement mapping between hardware
7 * irq numbers and the Linux irq number space.
9 * irq_domains also have hooks for translating device tree or other
10 * firmware interrupt representations into a hardware irq number that
11 * can be mapped back to a Linux irq number without any extra platform
14 * Interrupt controller "domain" data structure. This could be defined as a
15 * irq domain controller. That is, it handles the mapping between hardware
16 * and virtual interrupt numbers for a given interrupt domain. The domain
17 * structure is generally created by the PIC code for a given PIC instance
18 * (though a domain can cover more than one PIC if they have a flat number
19 * model). It's the domain callbacks that are responsible for setting the
20 * irq_chip on a given irq_desc after it's been mapped.
22 * The host code and data structures use a fwnode_handle pointer to
23 * identify the domain. In some cases, and in order to preserve source
24 * code compatibility, this fwnode pointer is "upgraded" to a DT
25 * device_node. For those firmware infrastructures that do not provide
26 * a unique identifier for an interrupt controller, the irq_domain
27 * code offers a fwnode allocator.
30 #ifndef _LINUX_IRQDOMAIN_H
31 #define _LINUX_IRQDOMAIN_H
33 #include <linux/types.h>
34 #include <linux/irqdomain_defs.h>
35 #include <linux/irqhandler.h>
37 #include <linux/mutex.h>
38 #include <linux/radix-tree.h>
48 struct irq_affinity_desc
;
49 struct msi_parent_ops
;
51 #define IRQ_DOMAIN_IRQ_SPEC_PARAMS 16
54 * struct irq_fwspec - generic IRQ specifier structure
56 * @fwnode: Pointer to a firmware-specific descriptor
57 * @param_count: Number of device-specific parameters
58 * @param: Device-specific parameters
60 * This structure, directly modeled after of_phandle_args, is used to
61 * pass a device-specific description of an interrupt.
64 struct fwnode_handle
*fwnode
;
66 u32 param
[IRQ_DOMAIN_IRQ_SPEC_PARAMS
];
69 /* Conversion function from of_phandle_args fields to fwspec */
70 void of_phandle_args_to_fwspec(struct device_node
*np
, const u32
*args
,
71 unsigned int count
, struct irq_fwspec
*fwspec
);
74 * struct irq_domain_ops - Methods for irq_domain objects
75 * @match: Match an interrupt controller device node to a host, returns
77 * @select: Match an interrupt controller fw specification. It is more generic
78 * than @match as it receives a complete struct irq_fwspec. Therefore,
79 * @select is preferred if provided. Returns 1 on a match.
80 * @map: Create or update a mapping between a virtual irq number and a hw
81 * irq number. This is called only once for a given mapping.
82 * @unmap: Dispose of such a mapping
83 * @xlate: Given a device tree node and interrupt specifier, decode
84 * the hardware irq number and linux irq type value.
85 * @alloc: Allocate @nr_irqs interrupts starting from @virq.
86 * @free: Free @nr_irqs interrupts starting from @virq.
87 * @activate: Activate one interrupt in HW (@irqd). If @reserve is set, only
88 * reserve the vector. If unset, assign the vector (called from
90 * @deactivate: Disarm one interrupt (@irqd).
91 * @translate: Given @fwspec, decode the hardware irq number (@out_hwirq) and
92 * linux irq type value (@out_type). This is a generalised @xlate
93 * (over struct irq_fwspec) and is preferred if provided.
94 * @debug_show: For domains to show specific data for an interrupt in debugfs.
96 * Functions below are provided by the driver and called whenever a new mapping
97 * is created or an old mapping is disposed. The driver can then proceed to
98 * whatever internal data structures management is required. It also needs
99 * to setup the irq_desc when returning from map().
101 struct irq_domain_ops
{
102 int (*match
)(struct irq_domain
*d
, struct device_node
*node
,
103 enum irq_domain_bus_token bus_token
);
104 int (*select
)(struct irq_domain
*d
, struct irq_fwspec
*fwspec
,
105 enum irq_domain_bus_token bus_token
);
106 int (*map
)(struct irq_domain
*d
, unsigned int virq
, irq_hw_number_t hw
);
107 void (*unmap
)(struct irq_domain
*d
, unsigned int virq
);
108 int (*xlate
)(struct irq_domain
*d
, struct device_node
*node
,
109 const u32
*intspec
, unsigned int intsize
,
110 unsigned long *out_hwirq
, unsigned int *out_type
);
111 #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
112 /* extended V2 interfaces to support hierarchy irq_domains */
113 int (*alloc
)(struct irq_domain
*d
, unsigned int virq
,
114 unsigned int nr_irqs
, void *arg
);
115 void (*free
)(struct irq_domain
*d
, unsigned int virq
,
116 unsigned int nr_irqs
);
117 int (*activate
)(struct irq_domain
*d
, struct irq_data
*irqd
, bool reserve
);
118 void (*deactivate
)(struct irq_domain
*d
, struct irq_data
*irq_data
);
119 int (*translate
)(struct irq_domain
*d
, struct irq_fwspec
*fwspec
,
120 unsigned long *out_hwirq
, unsigned int *out_type
);
122 #ifdef CONFIG_GENERIC_IRQ_DEBUGFS
123 void (*debug_show
)(struct seq_file
*m
, struct irq_domain
*d
,
124 struct irq_data
*irqd
, int ind
);
128 extern const struct irq_domain_ops irq_generic_chip_ops
;
130 struct irq_domain_chip_generic
;
133 * struct irq_domain - Hardware interrupt number translation object
134 * @link: Element in global irq_domain list.
135 * @name: Name of interrupt domain
136 * @ops: Pointer to irq_domain methods
137 * @host_data: Private data pointer for use by owner. Not touched by irq_domain
139 * @flags: Per irq_domain flags
140 * @mapcount: The number of mapped interrupts
141 * @mutex: Domain lock, hierarchical domains use root domain's lock
142 * @root: Pointer to root domain, or containing structure if non-hierarchical
145 * @fwnode: Pointer to firmware node associated with the irq_domain. Pretty easy
146 * to swap it for the of_node via the irq_domain_get_of_node accessor
147 * @bus_token: @fwnode's device_node might be used for several irq domains. But
148 * in connection with @bus_token, the pair shall be unique in a
150 * @gc: Pointer to a list of generic chips. There is a helper function for
151 * setting up one or more generic chips for interrupt controllers
152 * drivers using the generic chip library which uses this pointer.
153 * @dev: Pointer to the device which instantiated the irqdomain
154 * With per device irq domains this is not necessarily the same
156 * @pm_dev: Pointer to a device that can be utilized for power management
157 * purposes related to the irq domain.
158 * @parent: Pointer to parent irq_domain to support hierarchy irq_domains
159 * @msi_parent_ops: Pointer to MSI parent domain methods for per device domain init
160 * @exit: Function called when the domain is destroyed
162 * Revmap data, used internally by the irq domain code:
163 * @hwirq_max: Top limit for the HW irq number. Especially to avoid
164 * conflicts/failures with reserved HW irqs. Can be ~0.
165 * @revmap_size: Size of the linear map table @revmap
166 * @revmap_tree: Radix map tree for hwirqs that don't fit in the linear map
167 * @revmap: Linear table of irq_data pointers
170 struct list_head link
;
172 const struct irq_domain_ops
*ops
;
175 unsigned int mapcount
;
177 struct irq_domain
*root
;
180 struct fwnode_handle
*fwnode
;
181 enum irq_domain_bus_token bus_token
;
182 struct irq_domain_chip_generic
*gc
;
184 struct device
*pm_dev
;
185 #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
186 struct irq_domain
*parent
;
188 #ifdef CONFIG_GENERIC_MSI_IRQ
189 const struct msi_parent_ops
*msi_parent_ops
;
191 void (*exit
)(struct irq_domain
*d
);
193 /* reverse map data. The linear map gets appended to the irq_domain */
194 irq_hw_number_t hwirq_max
;
195 unsigned int revmap_size
;
196 struct radix_tree_root revmap_tree
;
197 struct irq_data __rcu
*revmap
[] __counted_by(revmap_size
);
200 /* Irq domain flags */
202 /* Irq domain is hierarchical */
203 IRQ_DOMAIN_FLAG_HIERARCHY
= (1 << 0),
205 /* Irq domain name was allocated internally */
206 IRQ_DOMAIN_NAME_ALLOCATED
= (1 << 1),
208 /* Irq domain is an IPI domain with virq per cpu */
209 IRQ_DOMAIN_FLAG_IPI_PER_CPU
= (1 << 2),
211 /* Irq domain is an IPI domain with single virq */
212 IRQ_DOMAIN_FLAG_IPI_SINGLE
= (1 << 3),
214 /* Irq domain implements MSIs */
215 IRQ_DOMAIN_FLAG_MSI
= (1 << 4),
218 * Irq domain implements isolated MSI, see msi_device_has_isolated_msi()
220 IRQ_DOMAIN_FLAG_ISOLATED_MSI
= (1 << 5),
222 /* Irq domain doesn't translate anything */
223 IRQ_DOMAIN_FLAG_NO_MAP
= (1 << 6),
225 /* Irq domain is a MSI parent domain */
226 IRQ_DOMAIN_FLAG_MSI_PARENT
= (1 << 8),
228 /* Irq domain is a MSI device domain */
229 IRQ_DOMAIN_FLAG_MSI_DEVICE
= (1 << 9),
231 /* Irq domain must destroy generic chips when removed */
232 IRQ_DOMAIN_FLAG_DESTROY_GC
= (1 << 10),
235 * Flags starting from IRQ_DOMAIN_FLAG_NONCORE are reserved
236 * for implementation specific purposes and ignored by the
239 IRQ_DOMAIN_FLAG_NONCORE
= (1 << 16),
242 static inline struct device_node
*irq_domain_get_of_node(struct irq_domain
*d
)
244 return to_of_node(d
->fwnode
);
247 static inline void irq_domain_set_pm_device(struct irq_domain
*d
,
254 #ifdef CONFIG_IRQ_DOMAIN
255 struct fwnode_handle
*__irq_domain_alloc_fwnode(unsigned int type
, int id
,
256 const char *name
, phys_addr_t
*pa
);
260 IRQCHIP_FWNODE_NAMED
,
261 IRQCHIP_FWNODE_NAMED_ID
,
265 struct fwnode_handle
*irq_domain_alloc_named_fwnode(const char *name
)
267 return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED
, 0, name
, NULL
);
271 struct fwnode_handle
*irq_domain_alloc_named_id_fwnode(const char *name
, int id
)
273 return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_NAMED_ID
, id
, name
,
277 static inline struct fwnode_handle
*irq_domain_alloc_fwnode(phys_addr_t
*pa
)
279 return __irq_domain_alloc_fwnode(IRQCHIP_FWNODE_REAL
, 0, NULL
, pa
);
282 void irq_domain_free_fwnode(struct fwnode_handle
*fwnode
);
284 struct irq_domain_chip_generic_info
;
287 * struct irq_domain_info - Domain information structure
288 * @fwnode: firmware node for the interrupt controller
289 * @domain_flags: Additional flags to add to the domain flags
290 * @size: Size of linear map; 0 for radix mapping only
291 * @hwirq_max: Maximum number of interrupts supported by controller
292 * @direct_max: Maximum value of direct maps;
293 * Use ~0 for no limit; 0 for no direct mapping
294 * @hwirq_base: The first hardware interrupt number (legacy domains only)
295 * @virq_base: The first Linux interrupt number for legacy domains to
296 * immediately associate the interrupts after domain creation
297 * @bus_token: Domain bus token
298 * @name_suffix: Optional name suffix to avoid collisions when multiple
299 * domains are added using same fwnode
300 * @ops: Domain operation callbacks
301 * @host_data: Controller private data pointer
302 * @dgc_info: Geneneric chip information structure pointer used to
303 * create generic chips for the domain if not NULL.
304 * @init: Function called when the domain is created.
305 * Allow to do some additional domain initialisation.
306 * @exit: Function called when the domain is destroyed.
307 * Allow to do some additional cleanup operation.
309 struct irq_domain_info
{
310 struct fwnode_handle
*fwnode
;
311 unsigned int domain_flags
;
313 irq_hw_number_t hwirq_max
;
315 unsigned int hwirq_base
;
316 unsigned int virq_base
;
317 enum irq_domain_bus_token bus_token
;
318 const char *name_suffix
;
319 const struct irq_domain_ops
*ops
;
321 #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
323 * @parent: Pointer to the parent irq domain used in a hierarchy domain
325 struct irq_domain
*parent
;
327 struct irq_domain_chip_generic_info
*dgc_info
;
328 int (*init
)(struct irq_domain
*d
);
329 void (*exit
)(struct irq_domain
*d
);
332 struct irq_domain
*irq_domain_instantiate(const struct irq_domain_info
*info
);
333 struct irq_domain
*devm_irq_domain_instantiate(struct device
*dev
,
334 const struct irq_domain_info
*info
);
336 struct irq_domain
*irq_domain_create_simple(struct fwnode_handle
*fwnode
,
338 unsigned int first_irq
,
339 const struct irq_domain_ops
*ops
,
341 struct irq_domain
*irq_domain_add_legacy(struct device_node
*of_node
,
343 unsigned int first_irq
,
344 irq_hw_number_t first_hwirq
,
345 const struct irq_domain_ops
*ops
,
347 struct irq_domain
*irq_domain_create_legacy(struct fwnode_handle
*fwnode
,
349 unsigned int first_irq
,
350 irq_hw_number_t first_hwirq
,
351 const struct irq_domain_ops
*ops
,
353 extern struct irq_domain
*irq_find_matching_fwspec(struct irq_fwspec
*fwspec
,
354 enum irq_domain_bus_token bus_token
);
355 extern void irq_set_default_host(struct irq_domain
*host
);
356 extern struct irq_domain
*irq_get_default_host(void);
357 extern int irq_domain_alloc_descs(int virq
, unsigned int nr_irqs
,
358 irq_hw_number_t hwirq
, int node
,
359 const struct irq_affinity_desc
*affinity
);
361 static inline struct fwnode_handle
*of_node_to_fwnode(struct device_node
*node
)
363 return node
? &node
->fwnode
: NULL
;
366 extern const struct fwnode_operations irqchip_fwnode_ops
;
368 static inline bool is_fwnode_irqchip(const struct fwnode_handle
*fwnode
)
370 return fwnode
&& fwnode
->ops
== &irqchip_fwnode_ops
;
373 extern void irq_domain_update_bus_token(struct irq_domain
*domain
,
374 enum irq_domain_bus_token bus_token
);
377 struct irq_domain
*irq_find_matching_fwnode(struct fwnode_handle
*fwnode
,
378 enum irq_domain_bus_token bus_token
)
380 struct irq_fwspec fwspec
= {
384 return irq_find_matching_fwspec(&fwspec
, bus_token
);
387 static inline struct irq_domain
*irq_find_matching_host(struct device_node
*node
,
388 enum irq_domain_bus_token bus_token
)
390 return irq_find_matching_fwnode(of_node_to_fwnode(node
), bus_token
);
393 static inline struct irq_domain
*irq_find_host(struct device_node
*node
)
395 struct irq_domain
*d
;
397 d
= irq_find_matching_host(node
, DOMAIN_BUS_WIRED
);
399 d
= irq_find_matching_host(node
, DOMAIN_BUS_ANY
);
404 static inline struct irq_domain
*irq_domain_add_simple(struct device_node
*of_node
,
406 unsigned int first_irq
,
407 const struct irq_domain_ops
*ops
,
410 return irq_domain_create_simple(of_node_to_fwnode(of_node
), size
, first_irq
, ops
, host_data
);
414 * irq_domain_add_linear() - Allocate and register a linear revmap irq_domain.
415 * @of_node: pointer to interrupt controller's device tree node.
416 * @size: Number of interrupts in the domain.
417 * @ops: map/unmap domain callbacks
418 * @host_data: Controller private data pointer
420 static inline struct irq_domain
*irq_domain_add_linear(struct device_node
*of_node
,
422 const struct irq_domain_ops
*ops
,
425 struct irq_domain_info info
= {
426 .fwnode
= of_node_to_fwnode(of_node
),
430 .host_data
= host_data
,
432 struct irq_domain
*d
;
434 d
= irq_domain_instantiate(&info
);
435 return IS_ERR(d
) ? NULL
: d
;
438 #ifdef CONFIG_IRQ_DOMAIN_NOMAP
439 static inline struct irq_domain
*irq_domain_add_nomap(struct device_node
*of_node
,
440 unsigned int max_irq
,
441 const struct irq_domain_ops
*ops
,
444 struct irq_domain_info info
= {
445 .fwnode
= of_node_to_fwnode(of_node
),
446 .hwirq_max
= max_irq
,
447 .direct_max
= max_irq
,
449 .host_data
= host_data
,
451 struct irq_domain
*d
;
453 d
= irq_domain_instantiate(&info
);
454 return IS_ERR(d
) ? NULL
: d
;
457 extern unsigned int irq_create_direct_mapping(struct irq_domain
*host
);
460 static inline struct irq_domain
*irq_domain_add_tree(struct device_node
*of_node
,
461 const struct irq_domain_ops
*ops
,
464 struct irq_domain_info info
= {
465 .fwnode
= of_node_to_fwnode(of_node
),
468 .host_data
= host_data
,
470 struct irq_domain
*d
;
472 d
= irq_domain_instantiate(&info
);
473 return IS_ERR(d
) ? NULL
: d
;
476 static inline struct irq_domain
*irq_domain_create_linear(struct fwnode_handle
*fwnode
,
478 const struct irq_domain_ops
*ops
,
481 struct irq_domain_info info
= {
486 .host_data
= host_data
,
488 struct irq_domain
*d
;
490 d
= irq_domain_instantiate(&info
);
491 return IS_ERR(d
) ? NULL
: d
;
494 static inline struct irq_domain
*irq_domain_create_tree(struct fwnode_handle
*fwnode
,
495 const struct irq_domain_ops
*ops
,
498 struct irq_domain_info info
= {
502 .host_data
= host_data
,
504 struct irq_domain
*d
;
506 d
= irq_domain_instantiate(&info
);
507 return IS_ERR(d
) ? NULL
: d
;
510 extern void irq_domain_remove(struct irq_domain
*host
);
512 extern int irq_domain_associate(struct irq_domain
*domain
, unsigned int irq
,
513 irq_hw_number_t hwirq
);
514 extern void irq_domain_associate_many(struct irq_domain
*domain
,
515 unsigned int irq_base
,
516 irq_hw_number_t hwirq_base
, int count
);
518 extern unsigned int irq_create_mapping_affinity(struct irq_domain
*host
,
519 irq_hw_number_t hwirq
,
520 const struct irq_affinity_desc
*affinity
);
521 extern unsigned int irq_create_fwspec_mapping(struct irq_fwspec
*fwspec
);
522 extern void irq_dispose_mapping(unsigned int virq
);
524 static inline unsigned int irq_create_mapping(struct irq_domain
*host
,
525 irq_hw_number_t hwirq
)
527 return irq_create_mapping_affinity(host
, hwirq
, NULL
);
530 extern struct irq_desc
*__irq_resolve_mapping(struct irq_domain
*domain
,
531 irq_hw_number_t hwirq
,
534 static inline struct irq_desc
*irq_resolve_mapping(struct irq_domain
*domain
,
535 irq_hw_number_t hwirq
)
537 return __irq_resolve_mapping(domain
, hwirq
, NULL
);
541 * irq_find_mapping() - Find a linux irq from a hw irq number.
542 * @domain: domain owning this hardware interrupt
543 * @hwirq: hardware irq number in that domain space
545 static inline unsigned int irq_find_mapping(struct irq_domain
*domain
,
546 irq_hw_number_t hwirq
)
550 if (__irq_resolve_mapping(domain
, hwirq
, &irq
))
556 static inline unsigned int irq_linear_revmap(struct irq_domain
*domain
,
557 irq_hw_number_t hwirq
)
559 return irq_find_mapping(domain
, hwirq
);
562 extern const struct irq_domain_ops irq_domain_simple_ops
;
564 /* stock xlate functions */
565 int irq_domain_xlate_onecell(struct irq_domain
*d
, struct device_node
*ctrlr
,
566 const u32
*intspec
, unsigned int intsize
,
567 irq_hw_number_t
*out_hwirq
, unsigned int *out_type
);
568 int irq_domain_xlate_twocell(struct irq_domain
*d
, struct device_node
*ctrlr
,
569 const u32
*intspec
, unsigned int intsize
,
570 irq_hw_number_t
*out_hwirq
, unsigned int *out_type
);
571 int irq_domain_xlate_onetwocell(struct irq_domain
*d
, struct device_node
*ctrlr
,
572 const u32
*intspec
, unsigned int intsize
,
573 irq_hw_number_t
*out_hwirq
, unsigned int *out_type
);
575 int irq_domain_translate_twocell(struct irq_domain
*d
,
576 struct irq_fwspec
*fwspec
,
577 unsigned long *out_hwirq
,
578 unsigned int *out_type
);
580 int irq_domain_translate_onecell(struct irq_domain
*d
,
581 struct irq_fwspec
*fwspec
,
582 unsigned long *out_hwirq
,
583 unsigned int *out_type
);
586 int irq_reserve_ipi(struct irq_domain
*domain
, const struct cpumask
*dest
);
587 int irq_destroy_ipi(unsigned int irq
, const struct cpumask
*dest
);
589 /* V2 interfaces to support hierarchy IRQ domains. */
590 extern struct irq_data
*irq_domain_get_irq_data(struct irq_domain
*domain
,
592 extern void irq_domain_set_info(struct irq_domain
*domain
, unsigned int virq
,
593 irq_hw_number_t hwirq
,
594 const struct irq_chip
*chip
,
595 void *chip_data
, irq_flow_handler_t handler
,
596 void *handler_data
, const char *handler_name
);
597 extern void irq_domain_reset_irq_data(struct irq_data
*irq_data
);
598 #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
599 extern struct irq_domain
*irq_domain_create_hierarchy(struct irq_domain
*parent
,
600 unsigned int flags
, unsigned int size
,
601 struct fwnode_handle
*fwnode
,
602 const struct irq_domain_ops
*ops
, void *host_data
);
604 static inline struct irq_domain
*irq_domain_add_hierarchy(struct irq_domain
*parent
,
607 struct device_node
*node
,
608 const struct irq_domain_ops
*ops
,
611 return irq_domain_create_hierarchy(parent
, flags
, size
,
612 of_node_to_fwnode(node
),
616 extern int __irq_domain_alloc_irqs(struct irq_domain
*domain
, int irq_base
,
617 unsigned int nr_irqs
, int node
, void *arg
,
619 const struct irq_affinity_desc
*affinity
);
620 extern void irq_domain_free_irqs(unsigned int virq
, unsigned int nr_irqs
);
621 extern int irq_domain_activate_irq(struct irq_data
*irq_data
, bool early
);
622 extern void irq_domain_deactivate_irq(struct irq_data
*irq_data
);
624 static inline int irq_domain_alloc_irqs(struct irq_domain
*domain
,
625 unsigned int nr_irqs
, int node
, void *arg
)
627 return __irq_domain_alloc_irqs(domain
, -1, nr_irqs
, node
, arg
, false,
631 extern int irq_domain_alloc_irqs_hierarchy(struct irq_domain
*domain
,
632 unsigned int irq_base
,
633 unsigned int nr_irqs
, void *arg
);
634 extern int irq_domain_set_hwirq_and_chip(struct irq_domain
*domain
,
636 irq_hw_number_t hwirq
,
637 const struct irq_chip
*chip
,
639 extern void irq_domain_free_irqs_common(struct irq_domain
*domain
,
641 unsigned int nr_irqs
);
642 extern void irq_domain_free_irqs_top(struct irq_domain
*domain
,
643 unsigned int virq
, unsigned int nr_irqs
);
645 extern int irq_domain_push_irq(struct irq_domain
*domain
, int virq
, void *arg
);
646 extern int irq_domain_pop_irq(struct irq_domain
*domain
, int virq
);
648 extern int irq_domain_alloc_irqs_parent(struct irq_domain
*domain
,
649 unsigned int irq_base
,
650 unsigned int nr_irqs
, void *arg
);
652 extern void irq_domain_free_irqs_parent(struct irq_domain
*domain
,
653 unsigned int irq_base
,
654 unsigned int nr_irqs
);
656 extern int irq_domain_disconnect_hierarchy(struct irq_domain
*domain
,
659 static inline bool irq_domain_is_hierarchy(struct irq_domain
*domain
)
661 return domain
->flags
& IRQ_DOMAIN_FLAG_HIERARCHY
;
664 static inline bool irq_domain_is_ipi(struct irq_domain
*domain
)
666 return domain
->flags
&
667 (IRQ_DOMAIN_FLAG_IPI_PER_CPU
| IRQ_DOMAIN_FLAG_IPI_SINGLE
);
670 static inline bool irq_domain_is_ipi_per_cpu(struct irq_domain
*domain
)
672 return domain
->flags
& IRQ_DOMAIN_FLAG_IPI_PER_CPU
;
675 static inline bool irq_domain_is_ipi_single(struct irq_domain
*domain
)
677 return domain
->flags
& IRQ_DOMAIN_FLAG_IPI_SINGLE
;
680 static inline bool irq_domain_is_msi(struct irq_domain
*domain
)
682 return domain
->flags
& IRQ_DOMAIN_FLAG_MSI
;
685 static inline bool irq_domain_is_msi_parent(struct irq_domain
*domain
)
687 return domain
->flags
& IRQ_DOMAIN_FLAG_MSI_PARENT
;
690 static inline bool irq_domain_is_msi_device(struct irq_domain
*domain
)
692 return domain
->flags
& IRQ_DOMAIN_FLAG_MSI_DEVICE
;
695 #else /* CONFIG_IRQ_DOMAIN_HIERARCHY */
696 static inline int irq_domain_alloc_irqs(struct irq_domain
*domain
,
697 unsigned int nr_irqs
, int node
, void *arg
)
702 static inline void irq_domain_free_irqs(unsigned int virq
,
703 unsigned int nr_irqs
) { }
705 static inline bool irq_domain_is_hierarchy(struct irq_domain
*domain
)
710 static inline bool irq_domain_is_ipi(struct irq_domain
*domain
)
715 static inline bool irq_domain_is_ipi_per_cpu(struct irq_domain
*domain
)
720 static inline bool irq_domain_is_ipi_single(struct irq_domain
*domain
)
725 static inline bool irq_domain_is_msi(struct irq_domain
*domain
)
730 static inline bool irq_domain_is_msi_parent(struct irq_domain
*domain
)
735 static inline bool irq_domain_is_msi_device(struct irq_domain
*domain
)
740 #endif /* CONFIG_IRQ_DOMAIN_HIERARCHY */
742 #ifdef CONFIG_GENERIC_MSI_IRQ
743 int msi_device_domain_alloc_wired(struct irq_domain
*domain
, unsigned int hwirq
,
745 void msi_device_domain_free_wired(struct irq_domain
*domain
, unsigned int virq
);
747 static inline int msi_device_domain_alloc_wired(struct irq_domain
*domain
, unsigned int hwirq
,
753 static inline void msi_device_domain_free_wired(struct irq_domain
*domain
, unsigned int virq
)
759 #else /* CONFIG_IRQ_DOMAIN */
760 static inline void irq_dispose_mapping(unsigned int virq
) { }
761 static inline struct irq_domain
*irq_find_matching_fwnode(
762 struct fwnode_handle
*fwnode
, enum irq_domain_bus_token bus_token
)
766 #endif /* !CONFIG_IRQ_DOMAIN */
768 #endif /* _LINUX_IRQDOMAIN_H */