From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753577AbdEJNqe (ORCPT ); Wed, 10 May 2017 09:46:34 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:31973 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753377AbdEJNpl (ORCPT ); Wed, 10 May 2017 09:45:41 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="18692976" From: Dou Liyang To: , CC: , , , , , , Dou Liyang Subject: [RFC PATCH v3 09/12] x86/apic: Setup interrupt mode earlier in case of no SMP motherboard Date: Wed, 10 May 2017 21:44:46 +0800 Message-ID: <1494423889-25799-10-git-send-email-douly.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1494423889-25799-1-git-send-email-douly.fnst@cn.fujitsu.com> References: <1494423889-25799-1-git-send-email-douly.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.167.226.106] X-yoursite-MailScanner-ID: A581B47C6105.A0FE8 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 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 for SMP-capable system too. Wrap this case, make it consistent with SMP-capable systems. Incidentally, -Extract apic_bsp_setup() and Refine apic_interrupt_mode_init(). Signed-off-by: Dou Liyang --- v2 --> v3: Replace APIC_SYMMETRIC_IO_NO_CONFIG with APIC_VIRTUAL_WIRE_NO_CONFIG Do some cleanup. arch/x86/kernel/apic/apic.c | 23 ++++++++++++++++------- arch/x86/kernel/smpboot.c | 2 -- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 941ae1e..b09650d 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -1160,12 +1160,13 @@ void __init sync_Arb_IDs(void) enum apic_interrupt_mode { APIC_PIC = 0, APIC_VIRTUAL_WIRE, + APIC_VIRTUAL_WIRE_NO_CONFIG, APIC_SYMMETRIC_IO, APIC_SYMMETRIC_IO_NO_ROUTING, APIC_MODE_COUNT }; -static int __init apic_interrupt_mode_select(void) +static int __init apic_interrupt_mode_select(int *upmode) { /* Check kernel option */ if (disable_apic) { @@ -1208,8 +1209,12 @@ static int __init apic_interrupt_mode_select(void) if (!smp_found_config) { disable_ioapic_support(); - if (!acpi_lapic) + if (!acpi_lapic) { pr_info("ACPI MADT or MP table not detected\n"); + *upmode = true; + + return APIC_VIRTUAL_WIRE_NO_CONFIG; + } return APIC_VIRTUAL_WIRE; } @@ -1285,23 +1290,27 @@ void __init apic_virtual_wire_mode_setup(void) /* Init the interrupt delivery mode for the BSP */ void __init apic_interrupt_mode_init(void) { - switch (apic_interrupt_mode_select()) { + int upmode = false; + + switch (apic_interrupt_mode_select(&upmode)) { case APIC_PIC: pr_info("Keep in PIC mode(8259)\n"); return; case APIC_VIRTUAL_WIRE: + case APIC_VIRTUAL_WIRE_NO_CONFIG: pr_info("Switch to virtual wire mode\n"); - return; + default_setup_apic_routing(); + 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_ROUTING: pr_info("Switch to symmectic I/O mode with no APIC routing\n"); - apic_bsp_setup(false); return; } + + 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 2101d5c..6e8c39b 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