aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorJiang Liu <jiang.liu@linux.intel.com>2014-06-09 04:19:49 -0400
committerThomas Gleixner <tglx@linutronix.de>2014-06-21 17:05:42 -0400
commit4b92b4f754939e4ac6bb53355abbe48a5054b573 (patch)
treef35eee474569ade2b013e947a140c84425c9e57d /arch/x86
parent95d76acc7518d566df18d67c1343bb375b78d1f3 (diff)
x86, irq: Simplify arch_early_irq_init()
Simplify function arch_early_irq_init() and kill static array irq_cfgx[]. Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Tony Luck <tony.luck@intel.com> Cc: Joerg Roedel <joro@8bytes.org> Cc: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Grant Likely <grant.likely@linaro.org> Cc: Rafael J. Wysocki <rjw@rjwysocki.net> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Randy Dunlap <rdunlap@infradead.org> Cc: Yinghai Lu <yinghai@kernel.org> Link: http://lkml.kernel.org/r/1402302011-23642-21-git-send-email-jiang.liu@linux.intel.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/apic/io_apic.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 4208ea9edc10..e25e7e315d4f 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -183,6 +183,7 @@ early_param("noapic", parse_noapic);
183 183
184static int io_apic_setup_irq_pin(unsigned int irq, int node, 184static int io_apic_setup_irq_pin(unsigned int irq, int node,
185 struct io_apic_irq_attr *attr); 185 struct io_apic_irq_attr *attr);
186static struct irq_cfg *alloc_irq_and_cfg_at(unsigned int at, int node);
186 187
187/* Will be called in mpparse/acpi/sfi codes for saving IRQ info */ 188/* Will be called in mpparse/acpi/sfi codes for saving IRQ info */
188void mp_save_irq(struct mpc_intsrc *m) 189void mp_save_irq(struct mpc_intsrc *m)
@@ -214,14 +215,10 @@ static struct irq_pin_list *alloc_irq_pin_list(int node)
214 return kzalloc_node(sizeof(struct irq_pin_list), GFP_KERNEL, node); 215 return kzalloc_node(sizeof(struct irq_pin_list), GFP_KERNEL, node);
215} 216}
216 217
217
218/* irq_cfg is indexed by the sum of all RTEs in all I/O APICs. */
219static struct irq_cfg irq_cfgx[NR_IRQS_LEGACY];
220
221int __init arch_early_irq_init(void) 218int __init arch_early_irq_init(void)
222{ 219{
223 struct irq_cfg *cfg; 220 struct irq_cfg *cfg;
224 int count, node, i; 221 int i, node = cpu_to_node(0);
225 222
226 if (!nr_legacy_irqs()) 223 if (!nr_legacy_irqs())
227 io_apic_irqs = ~0UL; 224 io_apic_irqs = ~0UL;
@@ -234,22 +231,14 @@ int __init arch_early_irq_init(void)
234 pr_err("IOAPIC %d: suspend/resume impossible!\n", i); 231 pr_err("IOAPIC %d: suspend/resume impossible!\n", i);
235 } 232 }
236 233
237 cfg = irq_cfgx; 234 /*
238 count = ARRAY_SIZE(irq_cfgx); 235 * For legacy IRQ's, start with assigning irq0 to irq15 to
239 node = cpu_to_node(0); 236 * IRQ0_VECTOR to IRQ15_VECTOR for all cpu's.
240 237 */
241 for (i = 0; i < count; i++) { 238 for (i = 0; i < nr_legacy_irqs(); i++) {
242 irq_set_chip_data(i, &cfg[i]); 239 cfg = alloc_irq_and_cfg_at(i, node);
243 zalloc_cpumask_var_node(&cfg[i].domain, GFP_KERNEL, node); 240 cfg->vector = IRQ0_VECTOR + i;
244 zalloc_cpumask_var_node(&cfg[i].old_domain, GFP_KERNEL, node); 241 cpumask_setall(cfg->domain);
245 /*
246 * For legacy IRQ's, start with assigning irq0 to irq15 to
247 * IRQ0_VECTOR to IRQ15_VECTOR for all cpu's.
248 */
249 if (i < nr_legacy_irqs()) {
250 cfg[i].vector = IRQ0_VECTOR + i;
251 cpumask_setall(cfg[i].domain);
252 }
253 } 242 }
254 243
255 return 0; 244 return 0;
@@ -3377,7 +3366,7 @@ int __init arch_probe_nr_irqs(void)
3377 if (nr < nr_irqs) 3366 if (nr < nr_irqs)
3378 nr_irqs = nr; 3367 nr_irqs = nr;
3379 3368
3380 return nr_legacy_irqs(); 3369 return 0;
3381} 3370}
3382 3371
3383int io_apic_set_pci_routing(struct device *dev, int irq, 3372int io_apic_set_pci_routing(struct device *dev, int irq,