iommu/vt-d: Convert MSI remapping setup to remap_ops
[platform/adaptation/renesas_rcar/renesas_kernel.git] / arch / x86 / include / asm / intr_remapping.h
1 /*
2  * Copyright (C) 2012 Advanced Micro Devices, Inc.
3  * Author: Joerg Roedel <joerg.roedel@amd.com>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 as published
7  * by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17  *
18  * This header file contains the interface of the interrupt remapping code to
19  * the x86 interrupt management code.
20  */
21
22 #ifndef __X86_INTR_REMAPPING_H
23 #define __X86_INTR_REMAPPING_H
24
25 #ifdef CONFIG_IRQ_REMAP
26
27 struct IO_APIC_route_entry;
28 struct io_apic_irq_attr;
29 struct pci_dev;
30
31 extern int intr_remapping_enabled;
32
33 extern void setup_intr_remapping(void);
34 extern int intr_remapping_supported(void);
35 extern int intr_hardware_init(void);
36 extern int intr_hardware_enable(void);
37 extern void intr_hardware_disable(void);
38 extern int intr_hardware_reenable(int);
39 extern int intr_enable_fault_handling(void);
40 extern int intr_setup_ioapic_entry(int irq,
41                                    struct IO_APIC_route_entry *entry,
42                                    unsigned int destination, int vector,
43                                    struct io_apic_irq_attr *attr);
44 extern int intr_set_affinity(struct irq_data *data,
45                              const struct cpumask *mask,
46                              bool force);
47 extern void intr_free_irq(int irq);
48 extern void intr_compose_msi_msg(struct pci_dev *pdev,
49                                  unsigned int irq, unsigned int dest,
50                                  struct msi_msg *msg, u8 hpet_id);
51 extern int intr_msi_alloc_irq(struct pci_dev *pdev, int irq, int nvec);
52 extern int intr_msi_setup_irq(struct pci_dev *pdev, unsigned int irq,
53                               int index, int sub_handle);
54 extern int intr_setup_hpet_msi(unsigned int irq, unsigned int id);
55
56 #else  /* CONFIG_IRQ_REMAP */
57
58 #define intr_remapping_enabled  0
59
60 static inline void setup_intr_remapping(void) { }
61 static inline int intr_remapping_supported(void) { return 0; }
62 static inline int intr_hardware_init(void) { return -ENODEV; }
63 static inline int intr_hardware_enable(void) { return -ENODEV; }
64 static inline void intr_hardware_disable(void) { }
65 static inline int intr_hardware_reenable(int eim) { return -ENODEV; }
66 static inline int intr_enable_fault_handling(void) { return -ENODEV; }
67 static inline int intr_setup_ioapic_entry(int irq,
68                                           struct IO_APIC_route_entry *entry,
69                                           unsigned int destination, int vector,
70                                           struct io_apic_irq_attr *attr)
71 {
72         return -ENODEV;
73 }
74 static inline int intr_set_affinity(struct irq_data *data,
75                                     const struct cpumask *mask,
76                                     bool force)
77 {
78         return 0;
79 }
80 static inline void intr_free_irq(int irq) { }
81 static inline void intr_compose_msi_msg(struct pci_dev *pdev,
82                                         unsigned int irq, unsigned int dest,
83                                         struct msi_msg *msg, u8 hpet_id)
84 {
85 }
86 static inline int intr_msi_alloc_irq(struct pci_dev *pdev, int irq, int nvec)
87 {
88         return -ENODEV;
89 }
90 static inline int intr_msi_setup_irq(struct pci_dev *pdev, unsigned int irq,
91                                      int index, int sub_handle)
92 {
93         return -ENODEV;
94 }
95 static inline int intr_setup_hpet_msi(unsigned int irq, unsigned int id)
96 {
97         return -ENODEV;
98 }
99 #endif /* CONFIG_IRQ_REMAP */
100
101 #endif /* __X86_INTR_REMAPPING_H */