Received: by 10.192.165.148 with SMTP id m20csp1609647imm; Wed, 25 Apr 2018 22:46:31 -0700 (PDT) X-Google-Smtp-Source: AIpwx48fQFJg1rwZqyThy5B3RDy3OfT65sr3RsKNb4LYUHn9rJIXse5iL3VMNtqTTftlpkwCpeXi X-Received: by 2002:a17:902:585e:: with SMTP id f30-v6mr31966548plj.50.1524721591550; Wed, 25 Apr 2018 22:46:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524721591; cv=none; d=google.com; s=arc-20160816; b=e2ciYmFn3AI4u0f3W2HN8720uBidbXnQ+8vI0KAa8Q9bkFfz2et0B4Wj3gJv2XqJ61 UCwAMpO281kMETpaTTQVqbTT1qHe/GywETZo1NIxAL8xOVE2szN4gA8+5lPDbyZhHA7D /4BG+bMy5IkINAbptD6YvLL77Yx90dimEcWPhjhCLKq2oAYCrEXJiDB+7jOuehpJuUvc dvT8BzesIcbmOmVguSdQWKjSF386AhY952SmWQHl7Lyiq1ApNcXrZXXV8Ya4l0VZ/H3y gPCBxX5aM7UgeLI2pzMKKCSG25rOZ++8VOVWL053qFKoBprYAb9o5hxEcsh+nCnzpOus xY1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=jTi9WBDFKT0vGx8wyPa+JLljyjzmU9jWtrQtTMCCuNk=; b=S8q6dEZCrtBCETdmw9vwyKc+wmKR1UexJLoFeomZuW3zC8gOj3Xx1iFsXoVhlrbxDR kWmAkwlF9dKFVXvFDH3m/YEfMu3CgOLeMpO1otsKViELL+Sw9ie045zz15+kKl7CKU3h JDMpMtIdHwOLDJ5hUtR10BVNFdA4VJbcG3tfzRH+hO2SiN3BD23W3PZasYl47yssScRJ /aYvuag0LiB5MVPy7yK3+/TVHP/tTHfH/jak4Ir35IZtyHE33hXhc4NAnyqOKyYCW93c CSxwm+qYhh3gt+tVRG1DbzXGQz9ABQ69YidoFx3oHGJEFXl1nyJcWHlEP+QJ0uDGchfp srkQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r87si17546137pfg.305.2018.04.25.22.46.17; Wed, 25 Apr 2018 22:46:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751647AbeDZFpK (ORCPT + 99 others); Thu, 26 Apr 2018 01:45:10 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:39151 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750775AbeDZFpI (ORCPT ); Thu, 26 Apr 2018 01:45:08 -0400 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="39329976" Received: from bogon (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 26 Apr 2018 13:45:06 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id AA52E4B31484; Thu, 26 Apr 2018 13:45:05 +0800 (CST) Received: from localhost.localdomain (10.167.226.106) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 26 Apr 2018 13:45:05 +0800 From: Dou Liyang To: , CC: , , , Dou Liyang Subject: [PATCH] x86/idt: Simplify the idt_setup_apic_and_irq_gates() Date: Thu, 26 Apr 2018 13:44:52 +0800 Message-ID: <20180426054452.32308-1-douly.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.14.3 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.167.226.106] X-yoursite-MailScanner-ID: AA52E4B31484.AFBE9 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: douly.fnst@cn.fujitsu.com X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The vectors between FIRST_SYSTEM_VECTOR and NR_VECTORS are special IRQ vectors used by the SMP architecture. But, if X86_LOCAL_APIC=n, it will not be used, and the FIRST_SYSTEM_VECTOR is equal to NR_VECTORS. idt_setup_apic_and_irq_gates() didn't notice that, which make the code a little complex. Remove the code of the X86_LOCAL_APIC=n case to simplify it. Signed-off-by: Dou Liyang --- arch/x86/kernel/idt.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/idt.c b/arch/x86/kernel/idt.c index 2c3a1b4294eb..8b4174890706 100644 --- a/arch/x86/kernel/idt.c +++ b/arch/x86/kernel/idt.c @@ -317,15 +317,16 @@ void __init idt_setup_apic_and_irq_gates(void) set_intr_gate(i, entry); } - for_each_clear_bit_from(i, system_vectors, NR_VECTORS) { + /* + * If X86_LOCAL_APIC=n, the FIRST_SYSTEM_VECTOR is equal to NR_VECTORS + * Just consider the X86_LOCAL_APIC=y case + */ #ifdef CONFIG_X86_LOCAL_APIC + for_each_clear_bit_from(i, system_vectors, NR_VECTORS) { set_bit(i, system_vectors); set_intr_gate(i, spurious_interrupt); -#else - entry = irq_entries_start + 8 * (i - FIRST_EXTERNAL_VECTOR); - set_intr_gate(i, entry); -#endif } +#endif } /** -- 2.14.3