1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2016 ARM Limited, All Rights Reserved.
4  * Author: Marc Zyngier <marc.zyngier@arm.com>
5  */
6 
7 #ifndef __LINUX_IRQCHIP_IRQ_PARTITION_PERCPU_H
8 #define __LINUX_IRQCHIP_IRQ_PARTITION_PERCPU_H
9 
10 #include <linux/fwnode.h>
11 #include <linux/cpumask.h>
12 #include <linux/irqdomain.h>
13 
14 struct partition_affinity {
15 	cpumask_t			mask;
16 	void				*partition_id;
17 };
18 
19 struct partition_desc;
20 
21 #ifdef CONFIG_PARTITION_PERCPU
22 int partition_translate_id(struct partition_desc *desc, void *partition_id);
23 struct partition_desc *partition_create_desc(struct fwnode_handle *fwnode,
24 					     struct partition_affinity *parts,
25 					     int nr_parts,
26 					     int chained_irq,
27 					     const struct irq_domain_ops *ops);
28 struct irq_domain *partition_get_domain(struct partition_desc *dsc);
29 #else
30 static inline int partition_translate_id(struct partition_desc *desc,
31 					 void *partition_id)
32 {
33 	return -EINVAL;
34 }
35 
36 static inline
37 struct partition_desc *partition_create_desc(struct fwnode_handle *fwnode,
38 					     struct partition_affinity *parts,
39 					     int nr_parts,
40 					     int chained_irq,
41 					     const struct irq_domain_ops *ops)
42 {
43 	return NULL;
44 }
45 
46 static inline
47 struct irq_domain *partition_get_domain(struct partition_desc *dsc)
48 {
49 	return NULL;
50 }
51 #endif
52 
53 #endif /* __LINUX_IRQCHIP_IRQ_PARTITION_PERCPU_H */
54