xref: /openbmc/linux/arch/x86/include/asm/irqdomain.h (revision c10d12e3)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_IRQDOMAIN_H
3 #define _ASM_IRQDOMAIN_H
4 
5 #include <linux/irqdomain.h>
6 #include <asm/hw_irq.h>
7 
8 #ifdef CONFIG_X86_LOCAL_APIC
9 enum {
10 	/* Allocate contiguous CPU vectors */
11 	X86_IRQ_ALLOC_CONTIGUOUS_VECTORS		= 0x1,
12 	X86_IRQ_ALLOC_LEGACY				= 0x2,
13 };
14 
15 extern int x86_fwspec_is_ioapic(struct irq_fwspec *fwspec);
16 extern int x86_fwspec_is_hpet(struct irq_fwspec *fwspec);
17 
18 extern struct irq_domain *x86_vector_domain;
19 
20 extern void init_irq_alloc_info(struct irq_alloc_info *info,
21 				const struct cpumask *mask);
22 extern void copy_irq_alloc_info(struct irq_alloc_info *dst,
23 				struct irq_alloc_info *src);
24 #endif /* CONFIG_X86_LOCAL_APIC */
25 
26 #ifdef CONFIG_X86_IO_APIC
27 struct device_node;
28 struct irq_data;
29 
30 enum ioapic_domain_type {
31 	IOAPIC_DOMAIN_INVALID,
32 	IOAPIC_DOMAIN_LEGACY,
33 	IOAPIC_DOMAIN_STRICT,
34 	IOAPIC_DOMAIN_DYNAMIC,
35 };
36 
37 struct ioapic_domain_cfg {
38 	enum ioapic_domain_type		type;
39 	const struct irq_domain_ops	*ops;
40 	struct device_node		*dev;
41 };
42 
43 extern const struct irq_domain_ops mp_ioapic_irqdomain_ops;
44 
45 extern int mp_irqdomain_alloc(struct irq_domain *domain, unsigned int virq,
46 			      unsigned int nr_irqs, void *arg);
47 extern void mp_irqdomain_free(struct irq_domain *domain, unsigned int virq,
48 			      unsigned int nr_irqs);
49 extern int mp_irqdomain_activate(struct irq_domain *domain,
50 				 struct irq_data *irq_data, bool reserve);
51 extern void mp_irqdomain_deactivate(struct irq_domain *domain,
52 				    struct irq_data *irq_data);
53 extern int mp_irqdomain_ioapic_idx(struct irq_domain *domain);
54 #endif /* CONFIG_X86_IO_APIC */
55 
56 #ifdef CONFIG_PCI_MSI
57 void x86_create_pci_msi_domain(void);
58 struct irq_domain *native_create_pci_msi_domain(void);
59 extern struct irq_domain *x86_pci_msi_default_domain;
60 #else
61 static inline void x86_create_pci_msi_domain(void) { }
62 #define native_create_pci_msi_domain	NULL
63 #define x86_pci_msi_default_domain	NULL
64 #endif
65 
66 #endif
67