Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761480AbdDSJF6 (ORCPT ); Wed, 19 Apr 2017 05:05:58 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:35308 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752895AbdDSJFx (ORCPT ); Wed, 19 Apr 2017 05:05:53 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="17913915" From: Dou Liyang To: , CC: , , , , , , Dou Liyang Subject: [RFC PATCH v2 03/12] x86/apic: Prepare for unifying the interrupt delivery modes setup Date: Wed, 19 Apr 2017 17:05:17 +0800 Message-ID: <42d452ca14d8eb633c6d87d7aa37ffa20c0f0aa5.1492589715.git.douly.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.167.226.106] X-yoursite-MailScanner-ID: F3FD24670219.A33C5 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: douly.fnst@cn.fujitsu.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2476 Lines: 77 There are three positions for initializing the interrupt delivery modes: 1) In IRQ initial function, may setup the through-local-APIC virtual wire mode. 2) In an SMP-capable system, will try to switch to symmetric I/O model when preparing the cpus in native_smp_prepare_cpus(). 3) In UP system with UP_LATE_INIT=y, will set up local APIC and I/O APIC in smp_init(). Switching to symmetric I/O model is so late, which causes the dump-capture kernel hangs with 'notsc' option inherited from 1st kernel option. Preparatory patch to initialize an interrupt mode directly and provide a new function init_interrupt_mode() to unify that three positions and do that setup as soon as possible. Signed-off-by: Dou Liyang --- arch/x86/include/asm/apic.h | 2 ++ arch/x86/kernel/apic/apic.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index 86597f3..64f30ee3 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -128,6 +128,7 @@ extern void disable_local_APIC(void); extern void lapic_shutdown(void); extern void sync_Arb_IDs(void); extern void apic_virtual_wire_mode_setup(void); +extern void init_interrupt_mode(void); extern void setup_local_APIC(void); extern void init_apic_mappings(void); void register_lapic_address(unsigned long address); @@ -171,6 +172,7 @@ static inline void disable_local_APIC(void) { } # define setup_secondary_APIC_clock x86_init_noop static inline void lapic_update_tsc_freq(void) { } static inline void apic_virtual_wire_mode_setup(void) {} +static inline void init_interrupt_mode(void) {} #endif /* !CONFIG_X86_LOCAL_APIC */ #ifdef CONFIG_X86_X2APIC diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index c754e48..8ac4f58 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -1259,6 +1259,22 @@ void __init apic_virtual_wire_mode_setup(void) apic_write(APIC_LVT1, value); } +/* Init the interrupt delivery mode for the BSP */ +void __init init_interrupt_mode(void) +{ + switch (apic_bsp_mode_check()) { + case APIC_PIC: + pr_info("Keep in PIC mode(8259)\n"); + return; + case APIC_VIRTUAL_WIRE: + pr_info("Switch to virtual wire mode\n"); + return; + case APIC_SYMMETRIC_IO: + pr_info("Switch to symmectic I/O mode\n"); + return; + } +} + static void lapic_setup_esr(void) { unsigned int oldvalue, value, maxlvt; -- 2.5.5