Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964924AbcDMLme (ORCPT ); Wed, 13 Apr 2016 07:42:34 -0400 Received: from terminus.zytor.com ([198.137.202.10]:56608 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753378AbcDMLmc (ORCPT ); Wed, 13 Apr 2016 07:42:32 -0400 Date: Wed, 13 Apr 2016 04:41:24 -0700 From: tip-bot for Borislav Petkov Message-ID: Cc: mingo@kernel.org, tglx@linutronix.de, brgerst@gmail.com, bp@suse.de, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, dvlasenk@redhat.com, hpa@zytor.com, bp@alien8.de, peterz@infradead.org, luto@amacapital.net Reply-To: tglx@linutronix.de, bp@suse.de, brgerst@gmail.com, mingo@kernel.org, torvalds@linux-foundation.org, dvlasenk@redhat.com, linux-kernel@vger.kernel.org, bp@alien8.de, hpa@zytor.com, peterz@infradead.org, luto@amacapital.net In-Reply-To: <1459837795-2588-3-git-send-email-bp@alien8.de> References: <1459837795-2588-3-git-send-email-bp@alien8.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/asm] x86/cpu: Simplify extended APIC ID detection on AMD Git-Commit-ID: 425d8c2fc5e6dddbad083502bb77c7beae545620 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2268 Lines: 65 Commit-ID: 425d8c2fc5e6dddbad083502bb77c7beae545620 Gitweb: http://git.kernel.org/tip/425d8c2fc5e6dddbad083502bb77c7beae545620 Author: Borislav Petkov AuthorDate: Tue, 5 Apr 2016 08:29:51 +0200 Committer: Ingo Molnar CommitDate: Wed, 13 Apr 2016 11:37:42 +0200 x86/cpu: Simplify extended APIC ID detection on AMD Both if-branches are under if (boot_cpu_has(X86_FEATURE_APIC)), unify them. Also, simplify the test for bits: - 17 ("ApicExtBrdCst: APIC extended broadcast enable") and - 18 ("ApicExtId: APIC extended ID enable.") in "D18F0x68 Link Transaction Control." No functionality change. Signed-off-by: Borislav Petkov Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1459837795-2588-3-git-send-email-bp@alien8.de Signed-off-by: Ingo Molnar --- arch/x86/kernel/cpu/amd.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 54f7b44..c343a54 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -565,14 +565,17 @@ static void early_init_amd(struct cpuinfo_x86 *c) * can safely set X86_FEATURE_EXTD_APICID unconditionally for families * after 16h. */ - if (boot_cpu_has(X86_FEATURE_APIC) && c->x86 > 0x16) { - set_cpu_cap(c, X86_FEATURE_EXTD_APICID); - } else if (boot_cpu_has(X86_FEATURE_APIC) && c->x86 >= 0xf) { - /* check CPU config space for extended APIC ID */ - unsigned int val; - val = read_pci_config(0, 24, 0, 0x68); - if ((val & ((1 << 17) | (1 << 18))) == ((1 << 17) | (1 << 18))) + if (boot_cpu_has(X86_FEATURE_APIC)) { + if (c->x86 > 0x16) set_cpu_cap(c, X86_FEATURE_EXTD_APICID); + else if (c->x86 >= 0xf) { + /* check CPU config space for extended APIC ID */ + unsigned int val; + + val = read_pci_config(0, 24, 0, 0x68); + if ((val >> 17 & 0x3) == 0x3) + set_cpu_cap(c, X86_FEATURE_EXTD_APICID); + } } #endif