1 #include <linux/kernel.h>
2 #include <linux/string.h>
3 #include <linux/cpumask.h>
4 #include <linux/errno.h>
7 #include <asm/hw_irq.h>
8 #include <asm/irq_remapping.h>
10 #include "irq_remapping.h"
12 int irq_remapping_enabled;
14 int disable_irq_remap;
15 int disable_sourceid_checking;
18 static struct irq_remap_ops *remap_ops;
20 static __init int setup_nointremap(char *str)
22 disable_irq_remap = 1;
25 early_param("nointremap", setup_nointremap);
27 static __init int setup_irqremap(char *str)
33 if (!strncmp(str, "on", 2))
34 disable_irq_remap = 0;
35 else if (!strncmp(str, "off", 3))
36 disable_irq_remap = 1;
37 else if (!strncmp(str, "nosid", 5))
38 disable_sourceid_checking = 1;
39 else if (!strncmp(str, "no_x2apic_optout", 16))
42 str += strcspn(str, ",");
49 early_param("intremap", setup_irqremap);
51 void __init setup_irq_remapping_ops(void)
53 remap_ops = &intel_irq_remap_ops;
56 int irq_remapping_supported(void)
58 if (disable_irq_remap)
61 if (!remap_ops || !remap_ops->supported)
64 return remap_ops->supported();
67 int __init irq_remapping_prepare(void)
69 if (!remap_ops || !remap_ops->prepare)
72 return remap_ops->prepare();
75 int __init irq_remapping_enable(void)
77 if (!remap_ops || !remap_ops->enable)
80 return remap_ops->enable();
83 void irq_remapping_disable(void)
85 if (!remap_ops || !remap_ops->disable)
91 int irq_remapping_reenable(int mode)
93 if (!remap_ops || !remap_ops->reenable)
96 return remap_ops->reenable(mode);
99 int __init irq_remap_enable_fault_handling(void)
101 if (!remap_ops || !remap_ops->enable_faulting)
104 return remap_ops->enable_faulting();
107 int setup_ioapic_remapped_entry(int irq,
108 struct IO_APIC_route_entry *entry,
109 unsigned int destination, int vector,
110 struct io_apic_irq_attr *attr)
112 if (!remap_ops || !remap_ops->setup_ioapic_entry)
115 return remap_ops->setup_ioapic_entry(irq, entry, destination,
119 int set_remapped_irq_affinity(struct irq_data *data, const struct cpumask *mask,
122 if (!config_enabled(CONFIG_SMP) || !remap_ops ||
123 !remap_ops->set_affinity)
126 return remap_ops->set_affinity(data, mask, force);
129 void free_remapped_irq(int irq)
131 if (!remap_ops || !remap_ops->free_irq)
134 remap_ops->free_irq(irq);
137 void compose_remapped_msi_msg(struct pci_dev *pdev,
138 unsigned int irq, unsigned int dest,
139 struct msi_msg *msg, u8 hpet_id)
141 if (!remap_ops || !remap_ops->compose_msi_msg)
144 remap_ops->compose_msi_msg(pdev, irq, dest, msg, hpet_id);
147 int msi_alloc_remapped_irq(struct pci_dev *pdev, int irq, int nvec)
149 if (!remap_ops || !remap_ops->msi_alloc_irq)
152 return remap_ops->msi_alloc_irq(pdev, irq, nvec);
155 int msi_setup_remapped_irq(struct pci_dev *pdev, unsigned int irq,
156 int index, int sub_handle)
158 if (!remap_ops || !remap_ops->msi_setup_irq)
161 return remap_ops->msi_setup_irq(pdev, irq, index, sub_handle);
164 int setup_hpet_msi_remapped(unsigned int irq, unsigned int id)
166 if (!remap_ops || !remap_ops->setup_hpet_msi)
169 return remap_ops->setup_hpet_msi(irq, id);