aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuresh Siddha <suresh.b.siddha@intel.com>2011-05-18 19:31:32 -0400
committerIngo Molnar <mingo@elte.hu>2011-05-20 07:40:50 -0400
commit4c79185cdb1425fb74241d0be772ff1a9913091a (patch)
tree3e1201564d344469d8f7dae05f878e349f7cbd40
parentb64ce24daffb634b5b3133a2e411bd4de50654e8 (diff)
x86, ioapic: Allocate ioapic_saved_data early
This allows re-using this buffer for enabling interrupt-remapping during boot and resume. And thus allow for consolidating the code between ioapic suspend/resume and interrupt-remapping. Tested-by: Daniel J Blueman <daniel.blueman@gmail.com> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Link: http://lkml.kernel.org/r/20110518233157.481404505@sbsiddha-MOBL3.sc.intel.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/apic/io_apic.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index df636209193..8e771d32ada 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -100,6 +100,11 @@ int mp_irq_entries;
100/* GSI interrupts */ 100/* GSI interrupts */
101static int nr_irqs_gsi = NR_IRQS_LEGACY; 101static int nr_irqs_gsi = NR_IRQS_LEGACY;
102 102
103/*
104 * Saved I/O APIC state during suspend/resume.
105*/
106static struct IO_APIC_route_entry *ioapic_saved_data[MAX_IO_APICS];
107
103#if defined (CONFIG_MCA) || defined (CONFIG_EISA) 108#if defined (CONFIG_MCA) || defined (CONFIG_EISA)
104int mp_bus_id_to_type[MAX_MP_BUSSES]; 109int mp_bus_id_to_type[MAX_MP_BUSSES];
105#endif 110#endif
@@ -179,6 +184,14 @@ int __init arch_early_irq_init(void)
179 io_apic_irqs = ~0UL; 184 io_apic_irqs = ~0UL;
180 } 185 }
181 186
187 for (i = 0; i < nr_ioapics; i++) {
188 ioapic_saved_data[i] =
189 kzalloc(sizeof(struct IO_APIC_route_entry) *
190 nr_ioapic_registers[i], GFP_KERNEL);
191 if (!ioapic_saved_data[i])
192 pr_err("IOAPIC %d: suspend/resume impossible!\n", i);
193 }
194
182 cfg = irq_cfgx; 195 cfg = irq_cfgx;
183 count = ARRAY_SIZE(irq_cfgx); 196 count = ARRAY_SIZE(irq_cfgx);
184 node = cpu_to_node(0); 197 node = cpu_to_node(0);
@@ -2918,8 +2931,6 @@ static int __init io_apic_bug_finalize(void)
2918 2931
2919late_initcall(io_apic_bug_finalize); 2932late_initcall(io_apic_bug_finalize);
2920 2933
2921static struct IO_APIC_route_entry *ioapic_saved_data[MAX_IO_APICS];
2922
2923static void suspend_ioapic(int ioapic_id) 2934static void suspend_ioapic(int ioapic_id)
2924{ 2935{
2925 struct IO_APIC_route_entry *saved_data = ioapic_saved_data[ioapic_id]; 2936 struct IO_APIC_route_entry *saved_data = ioapic_saved_data[ioapic_id];
@@ -2978,18 +2989,6 @@ static struct syscore_ops ioapic_syscore_ops = {
2978 2989
2979static int __init ioapic_init_ops(void) 2990static int __init ioapic_init_ops(void)
2980{ 2991{
2981 int i;
2982
2983 for (i = 0; i < nr_ioapics; i++) {
2984 unsigned int size;
2985
2986 size = nr_ioapic_registers[i]
2987 * sizeof(struct IO_APIC_route_entry);
2988 ioapic_saved_data[i] = kzalloc(size, GFP_KERNEL);
2989 if (!ioapic_saved_data[i])
2990 pr_err("IOAPIC %d: suspend/resume impossible!\n", i);
2991 }
2992
2993 register_syscore_ops(&ioapic_syscore_ops); 2992 register_syscore_ops(&ioapic_syscore_ops);
2994 2993
2995 return 0; 2994 return 0;