From patchwork Mon Jul 3 11:07:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dou Liyang X-Patchwork-Id: 9822535 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 98A9360246 for ; Mon, 3 Jul 2017 11:10:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8AD312817F for ; Mon, 3 Jul 2017 11:10:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7FACC283AD; Mon, 3 Jul 2017 11:10:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 30B692817F for ; Mon, 3 Jul 2017 11:10:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dRzD6-0005uy-7k; Mon, 03 Jul 2017 11:08:08 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dRzD5-0005tP-BC for xen-devel@lists.xenproject.org; Mon, 03 Jul 2017 11:08:07 +0000 Received: from [85.158.139.211] by server-13.bemta-5.messagelabs.com id BC/9D-01732-6952A595; Mon, 03 Jul 2017 11:08:06 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrLIsWRWlGSWpSXmKPExsViPb2gRXeaalS kwesbLBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bLbz/ZC/YJVryePZmlgbGBv4uRk0NCwE/i 4KS7jCC2kECtxP7exyxdjFxA9kpGiR0T/7JDOMcYJU4tWgxWxSagI3Gm+QE7iC0iEC6xdm03G 0gRs8AzRolPP3+AFQkLuEns3TUdqIiDg0VARWLZJheQMK9AvMTLjTPYITbLSWzbsgesnFPAVm JSy2UWiCtsJO60NjNC1AtKnJz5BCzOLCAhcfDFC2aIXiWJ1+sOsEDYuhIzZn5lhbA1JbatPsc GYZtJHNn5HyouKLHz+QW2CYwis5CMnYVk7AJGplWMGsWpRWWpRbpGlnpJRZnpGSW5iZk5uoYG pnq5qcXFiempOYlJxXrJ+bmbGIGBXs/AwLiD8fIWv0OMkhxMSqK8rjcjI4X4kvJTKjMSizPii 0pzUosPMcpwcChJ8FaoREUKCRalpqdWpGXmAGMOJi3BwaMkwnvgHlArb3FBYm5xZjpE6hSjMc eG1eu/MHG8mvD/G5MQS15+XqqUOG81yCQBkNKM0jy4QbBUcIlRVkqYl5GBgUGIpyC1KDezBFX +FaM4B6OSMG8myBSezLwSuH2vgE5hAjqloScC5JSSRISUVANjdkK1lltUX8GqzyqCaYxl9Qm5 siyRF9nr+++HHzz7gW0aG6v/x3XN8yUWL905VWTN+cC+xe23mAQqHvAdXP9LI2jZ9zcWGxm1n /r3HXr7IkVsvtmHTKv/Jl+LJ3C0fipPq30i3W/64Wrg9OlaixPurPgx+eu3/2lvMphb+qVWXf x1JsB0gcU/JZbijERDLeai4kQALg3K0QADAAA= X-Env-Sender: douly.fnst@cn.fujitsu.com X-Msg-Ref: server-4.tower-206.messagelabs.com!1499080084!101111960!1 X-Originating-IP: [59.151.112.132] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 25489 invoked from network); 3 Jul 2017 11:08:05 -0000 Received: from cn.fujitsu.com (HELO heian.cn.fujitsu.com) (59.151.112.132) by server-4.tower-206.messagelabs.com with SMTP; 3 Jul 2017 11:08:05 -0000 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="20783668" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 03 Jul 2017 19:08:05 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id 9925C47E98A6; Mon, 3 Jul 2017 19:08:03 +0800 (CST) Received: from localhost.localdomain.localdomain (10.167.226.106) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 3 Jul 2017 19:08:08 +0800 From: Dou Liyang To: , , Date: Mon, 3 Jul 2017 19:07:29 +0800 Message-ID: X-Mailer: git-send-email 2.5.5 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.167.226.106] X-yoursite-MailScanner-ID: 9925C47E98A6.A1B92 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: douly.fnst@cn.fujitsu.com Cc: Dou Liyang , bhe@redhat.com, peterz@infradead.org, mingo@kernel.org, ebiederm@xmission.com, hpa@zytor.com, izumi.taku@jp.fujitsu.com, boris.ostrovsky@oracle.com, tglx@linutronix.de Subject: [Xen-devel] [PATCH v6 09/12] x86/init: add intr_mode_init to x86_init_ops X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP X86 and XEN initialize interrupt delivery mode in different way. Ordinary conditional function calls will make the code mess. Add an unconditional x86_init_ops function which defaults to the standard function and can be overridden by the early platform code. Signed-off-by: Dou Liyang --- arch/x86/include/asm/x86_init.h | 2 ++ arch/x86/kernel/apic/apic.c | 2 +- arch/x86/kernel/smpboot.c | 2 +- arch/x86/kernel/x86_init.c | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h index 7ba7e90..f45acdf 100644 --- a/arch/x86/include/asm/x86_init.h +++ b/arch/x86/include/asm/x86_init.h @@ -50,11 +50,13 @@ struct x86_init_resources { * are set up. * @intr_init: interrupt init code * @trap_init: platform specific trap setup + * @intr_mode_init: interrupt delivery mode setup */ struct x86_init_irqs { void (*pre_vector_init)(void); void (*intr_init)(void); void (*trap_init)(void); + void (*intr_mode_init)(void); }; /** diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 6dc399e..9573c14 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -2384,7 +2384,7 @@ void __init apic_bsp_setup(bool upmode) #ifdef CONFIG_UP_LATE_INIT void __init up_late_init(void) { - apic_intr_mode_init(); + x86_init.irqs.intr_mode_init(); if (apic_intr_mode == APIC_PIC) return; diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index b40cf59..208f4f3 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1289,7 +1289,7 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) set_cpu_sibling_map(0); - apic_intr_mode_init(); + x86_init.irqs.intr_mode_init(); smp_sanity_check(); diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c index a088b2c..a7889b9 100644 --- a/arch/x86/kernel/x86_init.c +++ b/arch/x86/kernel/x86_init.c @@ -55,6 +55,7 @@ struct x86_init_ops x86_init __initdata = { .pre_vector_init = init_ISA_irqs, .intr_init = native_init_IRQ, .trap_init = x86_init_noop, + .intr_mode_init = apic_intr_mode_init }, .oem = {