Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp310031imm; Tue, 22 May 2018 19:36:46 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq8YYLpOpwXNtO506EYtjVnnSnEnMl1bff0UVksZIbcu7Evk38uPIKxqiH0hrabH2w/V14c X-Received: by 2002:a17:902:1c8:: with SMTP id b66-v6mr1001914plb.156.1527043006237; Tue, 22 May 2018 19:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527043006; cv=none; d=google.com; s=arc-20160816; b=hQcKgMnx7SOoQNF2RstR4zmldjcL62mzYp7cFl3w1LmAAv0IM4JmIcn7FsrVdUa1dY ASpIwnJUfpjz/mRA+ofA9/FRAFbuYpW4y6UY5cnzGOGSgtKOMMMzXgo3PSQuX43soQJK 87CgqD8LBppf/o4SimcWFhK7D57qRDZPoHLI7bEN/tGcvVZuue04hKEDdF/Nz3VeN/vz wgxHRC7f838sNeEjw2KaV0IpFFrNzn7nJJQ3lsy815czb2PpwDGD+A0CPSDP9CG6kt3t R/Khur4ssz06zgS7CTGMqyKQRKoSTXv0Kn6tmEY94+MVjY8tLtWKrlnPuEd23pcltjI4 P7Lw== 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=2yVRhR6X0QLdOEJ4B+6Fo7afHvDqUNGWf7Ug5J6W3mE=; b=p2u5RXg4C0kOdU3qpZwaKlbE9kXVNPEZS9P0m3aY44ugebPPzVYUOH5z5kFn8Ptxem AyagiMjbrzng+LIWmpZIecbSb4Z1GHzfWiU79aeM/mTN3WuZlcI3wVio8rkysjw607Mw Q6dOw5BGeX4XbDeJpelU6rp8f92N8gxYiyk37Cx9kqz/jaEwebr9hvptE6H5zOKQdpqH LKnjBNwBdDrtjJhIP4nX8tQNPNgjfrIlZT6WmYzDeJrJxFVKXWGpQFZdc/lB4h9eJWss Nj5Fvk8esLKDrDahm60qsNqghOkV4WB2++QwXWUIKEX3F2EUH5sBpplhgvvy4nzhigD2 apEg== 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 b17-v6si17457261plz.480.2018.05.22.19.36.17; Tue, 22 May 2018 19:36:46 -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 S1753717AbeEWCgG (ORCPT + 99 others); Tue, 22 May 2018 22:36:06 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:38993 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752658AbeEWCgF (ORCPT ); Tue, 22 May 2018 22:36:05 -0400 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="40234414" Received: from localhost (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 23 May 2018 10:36:04 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id EBEAA4B41E7C; Wed, 23 May 2018 10:36:03 +0800 (CST) Received: from localhost.localdomain (10.167.226.106) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.399.0; Wed, 23 May 2018 10:36:04 +0800 From: Dou Liyang To: , CC: , Dou Liyang Subject: [PATCH v2] x86/idt: Simplify the idt_setup_apic_and_irq_gates() Date: Wed, 23 May 2018 10:35:55 +0800 Message-ID: <20180523023555.2933-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: EBEAA4B41E7C.A2833 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 idt_setup_apic_and_irq_gates() sets the gates from FIRST_EXTERNAL_VECTOR up to FIRST_SYSTEM_VECTOR first. then secondly, from FIRST_SYSTEM_VECTOR to NR_VECTORS, it takes both APIC=y and APIC=n into account. But for APIC=n, the FIRST_SYSTEM_VECTOR is equal to NR_VECTORS, all vectors has been set at the first step. Simplify the second step, make it just work for APIC=y. Signed-off-by: Dou Liyang --- arch/x86/kernel/idt.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/idt.c b/arch/x86/kernel/idt.c index 2c3a1b4294eb..74383a3780dc 100644 --- a/arch/x86/kernel/idt.c +++ b/arch/x86/kernel/idt.c @@ -317,15 +317,12 @@ void __init idt_setup_apic_and_irq_gates(void) set_intr_gate(i, entry); } - for_each_clear_bit_from(i, system_vectors, NR_VECTORS) { #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