提交 425d8c2f 编写于 作者: B Borislav Petkov 提交者: Ingo Molnar

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: NBorislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1459837795-2588-3-git-send-email-bp@alien8.deSigned-off-by: NIngo Molnar <mingo@kernel.org>
上级 78df526c
...@@ -565,15 +565,18 @@ static void early_init_amd(struct cpuinfo_x86 *c) ...@@ -565,15 +565,18 @@ static void early_init_amd(struct cpuinfo_x86 *c)
* can safely set X86_FEATURE_EXTD_APICID unconditionally for families * can safely set X86_FEATURE_EXTD_APICID unconditionally for families
* after 16h. * after 16h.
*/ */
if (boot_cpu_has(X86_FEATURE_APIC) && c->x86 > 0x16) { if (boot_cpu_has(X86_FEATURE_APIC)) {
if (c->x86 > 0x16)
set_cpu_cap(c, X86_FEATURE_EXTD_APICID); set_cpu_cap(c, X86_FEATURE_EXTD_APICID);
} else if (boot_cpu_has(X86_FEATURE_APIC) && c->x86 >= 0xf) { else if (c->x86 >= 0xf) {
/* check CPU config space for extended APIC ID */ /* check CPU config space for extended APIC ID */
unsigned int val; unsigned int val;
val = read_pci_config(0, 24, 0, 0x68); val = read_pci_config(0, 24, 0, 0x68);
if ((val & ((1 << 17) | (1 << 18))) == ((1 << 17) | (1 << 18))) if ((val >> 17 & 0x3) == 0x3)
set_cpu_cap(c, X86_FEATURE_EXTD_APICID); set_cpu_cap(c, X86_FEATURE_EXTD_APICID);
} }
}
#endif #endif
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册