From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751782AbdAYLmJ (ORCPT ); Wed, 25 Jan 2017 06:42:09 -0500 Received: from terminus.zytor.com ([65.50.211.136]:49082 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751475AbdAYLmI (ORCPT ); Wed, 25 Jan 2017 06:42:08 -0500 Date: Wed, 25 Jan 2017 03:40:52 -0800 From: tip-bot for Andy Lutomirski Message-ID: Cc: bp@suse.de, mingo@kernel.org, luto@kernel.org, fenghua.yu@intel.com, yu-cheng.yu@intel.com, brgerst@gmail.com, bp@alien8.de, linux-kernel@vger.kernel.org, riel@redhat.com, oleg@redhat.com, hpa@zytor.com, peterz@infradead.org, tedheadster@gmail.com, torvalds@linux-foundation.org, dave.hansen@linux.intel.com, gnomes@lxorguk.ukuu.org.uk, tglx@linutronix.de Reply-To: torvalds@linux-foundation.org, tglx@linutronix.de, dave.hansen@linux.intel.com, gnomes@lxorguk.ukuu.org.uk, riel@redhat.com, oleg@redhat.com, hpa@zytor.com, tedheadster@gmail.com, peterz@infradead.org, brgerst@gmail.com, linux-kernel@vger.kernel.org, bp@alien8.de, bp@suse.de, yu-cheng.yu@intel.com, mingo@kernel.org, luto@kernel.org, fenghua.yu@intel.com In-Reply-To: <623ff7555488122143e4417de09b18be2085ad06.1484705016.git.luto@kernel.org> References: <623ff7555488122143e4417de09b18be2085ad06.1484705016.git.luto@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/fpu] x86/cpu: Factor out application of forced CPU caps Git-Commit-ID: 8bf1ebca215c262e48c15a4a15f175991776f57f 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 Commit-ID: 8bf1ebca215c262e48c15a4a15f175991776f57f Gitweb: http://git.kernel.org/tip/8bf1ebca215c262e48c15a4a15f175991776f57f Author: Andy Lutomirski AuthorDate: Wed, 18 Jan 2017 11:15:38 -0800 Committer: Ingo Molnar CommitDate: Wed, 25 Jan 2017 10:12:40 +0100 x86/cpu: Factor out application of forced CPU caps There are multiple call sites that apply forced CPU caps. Factor them into a helper. Signed-off-by: Andy Lutomirski Reviewed-by: Borislav Petkov Cc: Borislav Petkov Cc: Brian Gerst Cc: Dave Hansen Cc: Fenghua Yu Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Matthew Whitehead Cc: Oleg Nesterov Cc: One Thousand Gnomes Cc: Peter Zijlstra Cc: Rik van Riel Cc: Thomas Gleixner Cc: Yu-cheng Yu Link: http://lkml.kernel.org/r/623ff7555488122143e4417de09b18be2085ad06.1484705016.git.luto@kernel.org Signed-off-by: Ingo Molnar --- arch/x86/kernel/cpu/common.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index c3328d0..2ea16e0 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -655,6 +655,16 @@ void cpu_detect(struct cpuinfo_x86 *c) } } +static void apply_forced_caps(struct cpuinfo_x86 *c) +{ + int i; + + for (i = 0; i < NCAPINTS; i++) { + c->x86_capability[i] &= ~cpu_caps_cleared[i]; + c->x86_capability[i] |= cpu_caps_set[i]; + } +} + void get_cpu_cap(struct cpuinfo_x86 *c) { u32 eax, ebx, ecx, edx; @@ -1035,10 +1045,7 @@ static void identify_cpu(struct cpuinfo_x86 *c) this_cpu->c_identify(c); /* Clear/Set all flags overridden by options, after probe */ - for (i = 0; i < NCAPINTS; i++) { - c->x86_capability[i] &= ~cpu_caps_cleared[i]; - c->x86_capability[i] |= cpu_caps_set[i]; - } + apply_forced_caps(c); #ifdef CONFIG_X86_64 c->apicid = apic->phys_pkg_id(c->initial_apicid, 0); @@ -1097,10 +1104,7 @@ static void identify_cpu(struct cpuinfo_x86 *c) * Clear/Set all flags overridden by options, need do it * before following smp all cpus cap AND. */ - for (i = 0; i < NCAPINTS; i++) { - c->x86_capability[i] &= ~cpu_caps_cleared[i]; - c->x86_capability[i] |= cpu_caps_set[i]; - } + apply_forced_caps(c); /* * On SMP, boot_cpu_data holds the common feature set between