public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: X86 ML <x86@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/6] x86/cpu: Simplify extended APIC ID detection on AMD
Date: Tue,  5 Apr 2016 08:29:51 +0200	[thread overview]
Message-ID: <1459837795-2588-3-git-send-email-bp@alien8.de> (raw)
In-Reply-To: <1459837795-2588-1-git-send-email-bp@alien8.de>

From: Borislav Petkov <bp@suse.de>

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 <bp@suse.de>
---
 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 140eb4351a7b..2a380d7606d7 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
 
-- 
2.7.3

  parent reply	other threads:[~2016-04-05  6:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-05  6:29 [PATCH 0/6] x86: Misc cleanups Borislav Petkov
2016-04-05  6:29 ` [PATCH 1/6] x86/fpu/regset: Use boot_cpu_has() Borislav Petkov
2016-04-05 13:51   ` Brian Gerst
2016-04-05 15:11     ` Borislav Petkov
2016-04-13 11:41   ` [tip:x86/asm] x86/fpu/regset: Replace static_cpu_has() usage with boot_cpu_has() tip-bot for Borislav Petkov
2016-04-05  6:29 ` Borislav Petkov [this message]
2016-04-13 11:41   ` [tip:x86/asm] x86/cpu: Simplify extended APIC ID detection on AMD tip-bot for Borislav Petkov
2016-04-05  6:29 ` [PATCH 3/6] x86/tsc: Do not check X86_FEATURE_CONSTANT_TSC in notifier call Borislav Petkov
2016-04-05  8:00   ` Peter Zijlstra
2016-04-13 11:41   ` [tip:x86/asm] " tip-bot for Borislav Petkov
2016-04-05  6:29 ` [PATCH 4/6] x86/tsc: Save an indentation level in recalibrate_cpu_khz() Borislav Petkov
2016-04-05  8:05   ` Peter Zijlstra
2016-04-13 11:42   ` [tip:x86/asm] " tip-bot for Borislav Petkov
2016-04-05  6:29 ` [PATCH 5/6] x86/fpu: Remove check_fpu() indirection Borislav Petkov
2016-04-13 11:42   ` [tip:x86/asm] " tip-bot for Borislav Petkov
2016-04-05  6:29 ` [PATCH 6/6] x86/fpu: Get rid of x87 math exception helpers Borislav Petkov
2016-04-13 11:42   ` [tip:x86/asm] " tip-bot for Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1459837795-2588-3-git-send-email-bp@alien8.de \
    --to=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox