Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761633AbdDSJHb (ORCPT ); Wed, 19 Apr 2017 05:07:31 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:16872 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754164AbdDSJGU (ORCPT ); Wed, 19 Apr 2017 05:06:20 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="17913940" From: Dou Liyang To: , CC: , , , , , , Dou Liyang Subject: [RFC PATCH v2 09/12] x86/apic: Setup interrupt mode earlier in case of no SMP motherboard Date: Wed, 19 Apr 2017 17:05:23 +0800 Message-ID: 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: 162D247CE24B.A16A4 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: 2834 Lines: 100 Kernel falls back to non SMP mode and sets up interrupt delivery mode in APIC_init_uniprocessor() in case of no SMP motherboard. Setting up interrupt delivery mode as soon as possible should wraps this case too. Wrap this case, make it consistent with SMP-capable systems. Incidentally, -Extract apic_bsp_setup() and Refine init_interrupt_mode(). Signed-off-by: Dou Liyang --- arch/x86/kernel/apic/apic.c | 26 ++++++++++++++++++-------- arch/x86/kernel/smpboot.c | 2 -- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 170cd1a..a915f09 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -1157,11 +1157,12 @@ enum apic_interrupt_mode { APIC_PIC = 0, APIC_VIRTUAL_WIRE, APIC_SYMMETRIC_IO, + APIC_SYMMETRIC_IO_NO_CONFIG, APIC_SYMMETRIC_IO_NO_ROUTING, APIC_MODE_COUNT }; -static int __init apic_bsp_mode_check(void) +static int __init apic_bsp_mode_check(int *upmode) { /* Check kernel option */ @@ -1200,8 +1201,11 @@ static int __init apic_bsp_mode_check(void) disable_ioapic_support(); /* Check local APIC, if there is no SMP motherboard */ - if (!acpi_lapic) + if (!acpi_lapic) { + *upmode = true; pr_info("SMP motherboard not detected\n"); + return APIC_SYMMETRIC_IO_NO_CONFIG; + } return APIC_VIRTUAL_WIRE; } @@ -1277,23 +1281,29 @@ void __init apic_virtual_wire_mode_setup(void) /* Init the interrupt delivery mode for the BSP */ void __init init_interrupt_mode(void) { - switch (apic_bsp_mode_check()) { + int upmode = false; + + switch (apic_bsp_mode_check(&upmode)) { 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; + break; case APIC_SYMMETRIC_IO: pr_info("Switch to symmectic I/O mode\n"); default_setup_apic_routing(); - apic_bsp_setup(false); - return; + break; + case APIC_SYMMETRIC_IO_NO_CONFIG: + pr_info("Switch to symmectic I/O mode with no SMP config\n"); + default_setup_apic_routing(); + break; case APIC_SYMMETRIC_IO_NO_ROUTING: pr_info("Switch to symmectic I/O mode with no APIC routing\n"); - apic_bsp_setup(false); - return; + break; } + + apic_bsp_setup(upmode); } static void lapic_setup_esr(void) diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 345ad20..19d36ca 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1324,8 +1324,6 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) switch (smp_sanity_check(max_cpus)) { case SMP_NO_CONFIG: disable_smp(); - if (APIC_init_uniprocessor()) - pr_notice("Local APIC not detected. Using dummy APIC emulation.\n"); return; case SMP_NO_APIC: disable_smp(); -- 2.5.5