Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753412Ab1EPS7L (ORCPT ); Mon, 16 May 2011 14:59:11 -0400 Received: from mga09.intel.com ([134.134.136.24]:23512 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751204Ab1EPS7J (ORCPT ); Mon, 16 May 2011 14:59:09 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.65,220,1304319600"; d="scan'208";a="643404676" Message-Id: <20110516185646.360872956@sbsiddha-MOBL3.sc.intel.com> User-Agent: quilt/0.47-1 Date: Mon, 16 May 2011 11:56:05 -0700 From: Suresh Siddha To: mingo@elte.hu, tglx@linutronix.de, hpa@zytor.com Cc: linux-kernel@vger.kernel.org, daniel.blueman@gmail.com, suresh.b.siddha@intel.com Subject: [patch 2/4] x86, ioapic: allocate ioapic_saved_data early References: <20110516185646.282418545@sbsiddha-MOBL3.sc.intel.com> Content-Disposition: inline; filename=allocate_ioapic_saved_data_early.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2338 Lines: 75 This allows re-using this buffer for enabling interrupt-remapping during boot and resume. And thus allow for conslidating the code between ioapic suspend/resume and interrupt-remapping. Signed-off-by: Suresh Siddha --- arch/x86/kernel/apic/io_apic.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) Index: linux-2.6-tip/arch/x86/kernel/apic/io_apic.c =================================================================== --- linux-2.6-tip.orig/arch/x86/kernel/apic/io_apic.c +++ linux-2.6-tip/arch/x86/kernel/apic/io_apic.c @@ -100,6 +100,11 @@ int mp_irq_entries; /* GSI interrupts */ static int nr_irqs_gsi = NR_IRQS_LEGACY; +/* + * Saved I/O APIC state during suspend/resume. +*/ +static struct IO_APIC_route_entry *ioapic_saved_data[MAX_IO_APICS]; + #if defined (CONFIG_MCA) || defined (CONFIG_EISA) int mp_bus_id_to_type[MAX_MP_BUSSES]; #endif @@ -179,6 +184,14 @@ int __init arch_early_irq_init(void) io_apic_irqs = ~0UL; } + for (i = 0; i < nr_ioapics; i++) { + ioapic_saved_data[i] = + kzalloc(sizeof(struct IO_APIC_route_entry) * + nr_ioapic_registers[i], GFP_KERNEL); + if (!ioapic_saved_data[i]) + pr_err("IOAPIC %d: suspend/resume impossible!\n", i); + } + cfg = irq_cfgx; count = ARRAY_SIZE(irq_cfgx); node = cpu_to_node(0); @@ -2918,8 +2931,6 @@ static int __init io_apic_bug_finalize(v late_initcall(io_apic_bug_finalize); -static struct IO_APIC_route_entry *ioapic_saved_data[MAX_IO_APICS]; - static void suspend_ioapic(int ioapic_id) { struct IO_APIC_route_entry *saved_data = ioapic_saved_data[ioapic_id]; @@ -2978,18 +2989,6 @@ static struct syscore_ops ioapic_syscore static int __init ioapic_init_ops(void) { - int i; - - for (i = 0; i < nr_ioapics; i++) { - unsigned int size; - - size = nr_ioapic_registers[i] - * sizeof(struct IO_APIC_route_entry); - ioapic_saved_data[i] = kzalloc(size, GFP_KERNEL); - if (!ioapic_saved_data[i]) - pr_err("IOAPIC %d: suspend/resume impossible!\n", i); - } - register_syscore_ops(&ioapic_syscore_ops); return 0; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/