Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752045AbdH1DVd (ORCPT ); Sun, 27 Aug 2017 23:21:33 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:12839 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751857AbdH1DVa (ORCPT ); Sun, 27 Aug 2017 23:21:30 -0400 X-IronPort-AV: E=Sophos;i="5.41,439,1498492800"; d="scan'208";a="24797610" From: Dou Liyang To: , , CC: , , , , , , , Dou Liyang Subject: [PATCH v8 07/13] x86/apic: Unify interrupt mode setup for UP system Date: Mon, 28 Aug 2017 11:20:32 +0800 Message-ID: <1503890438-27840-8-git-send-email-douly.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1503890438-27840-1-git-send-email-douly.fnst@cn.fujitsu.com> References: <1503890438-27840-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: 7F7CC4724013.A00D0 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: 2561 Lines: 97 In UniProcessor kernel with UP_LATE_INIT=y, it enables and setups interrupt delivery mode in up_late_init(). Unify it to apic_intr_mode_init(), remove APIC_init_uniprocessor(). Signed-off-by: Dou Liyang --- arch/x86/include/asm/apic.h | 1 - arch/x86/kernel/apic/apic.c | 47 ++++++--------------------------------------- 2 files changed, 6 insertions(+), 42 deletions(-) diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index 01f3fc8..983a0dc 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -144,7 +144,6 @@ void register_lapic_address(unsigned long address); extern void setup_boot_APIC_clock(void); extern void setup_secondary_APIC_clock(void); extern void lapic_update_tsc_freq(void); -extern int APIC_init_uniprocessor(void); #ifdef CONFIG_X86_64 static inline int apic_force_enable(unsigned long addr) diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 97bd47b..5729354 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -1359,7 +1359,7 @@ void __init init_bsp_APIC(void) /* Init the interrupt delivery mode for the BSP */ void __init apic_intr_mode_init(void) { - bool upmode = false; + bool upmode = IS_ENABLED(CONFIG_UP_LATE_INIT); apic_intr_mode = apic_intr_mode_select(); @@ -2468,51 +2468,16 @@ void __init apic_bsp_setup(bool upmode) setup_IO_APIC(); } -/* - * This initializes the IO-APIC and APIC hardware if this is - * a UP kernel. - */ -int __init APIC_init_uniprocessor(void) +#ifdef CONFIG_UP_LATE_INIT +void __init up_late_init(void) { - if (disable_apic) { - pr_info("Apic disabled\n"); - return -1; - } -#ifdef CONFIG_X86_64 - if (!boot_cpu_has(X86_FEATURE_APIC)) { - disable_apic = 1; - pr_info("Apic disabled by BIOS\n"); - return -1; - } -#else - if (!smp_found_config && !boot_cpu_has(X86_FEATURE_APIC)) - return -1; + apic_intr_mode_init(); - /* - * Complain if the BIOS pretends there is one. - */ - if (!boot_cpu_has(X86_FEATURE_APIC) && - APIC_INTEGRATED(boot_cpu_apic_version)) { - pr_err("BIOS bug, local APIC 0x%x not detected!...\n", - boot_cpu_physical_apicid); - return -1; - } -#endif - - if (!smp_found_config) - disable_ioapic_support(); + if (apic_intr_mode == APIC_PIC) + return; - default_setup_apic_routing(); - apic_bsp_setup(true); /* Setup local timer */ x86_init.timers.setup_percpu_clockev(); - return 0; -} - -#ifdef CONFIG_UP_LATE_INIT -void __init up_late_init(void) -{ - APIC_init_uniprocessor(); } #endif -- 2.5.5