Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8119466imu; Tue, 4 Dec 2018 03:20:08 -0800 (PST) X-Google-Smtp-Source: AFSGD/XSHvWAGzb7WfC7yNiZxKejx0QezrHo90znMPh83M24Tr8T4WNwgXyXTOgabQ+WihrPVCE8 X-Received: by 2002:a17:902:e012:: with SMTP id ca18mr19662442plb.218.1543922408394; Tue, 04 Dec 2018 03:20:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543922408; cv=none; d=google.com; s=arc-20160816; b=Zs6wdpfJcsg+gRatd1d8zMGz4U09qYTrpDLdVH/cvkTuWXQJ225A00l1nr0WRQqDMw BNdVOuXNHWCsVyaGewt8VKg/lOipLb0eI82pq92Np0QJM+d+lA7XYKbF/LQ689cETlJM 7jsMQs5stappOVTUKSLlfuHoZok1HoTTGWnOxuqFmS2tGPgi0eMuyMEucR+bPfmMeTXO MWEzwXqnczzCtI3/LUoPg2+lY6Je507kMR+SK8mK1q0iX798CKMd6KjBd92Ll1Gj+2AM N4OcVVo1p1oF+qsPwCEG4nNnk/FGJrcxAcZdEJxx/SfZNn0BXyaNuqqf/h+U4loNe8OL 3WRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=j8ipBLiAOoFmCANLkiQO1ZTU95/QwG0NOKcL2OHzaq4=; b=rtsDkiZkI1NSJN5+bRhDblDpBeIpuIs4oWVa0N6f74nyIRPBObQ9R0XsG5H7LqGVaK kVOrmjNamzKDgU5A56DIbUDQocxpps+Pqmb8hLgs3kCXzxWRJbwBjzjjK6gfZK2RLtFH bC+wQtKhD1jz4FuXLQ/oX/Qt/OjJ16DYYaobPOZdeaN4XH2+OHXcIHHIHhH/XD6oVmVS R5j+XxGVQehpY0Sx9z88V4nyYyoUCorvRoKH6Au4coroTIaG+/ReLXHy1TXIEBkmn5YI lneAJ95kF8nAf3QKZQtNTzATif0zHQTPvrlHwKrxRYu9XIfrPcLJSbWhUhrZInbUYAsS 6vwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="fFzPK/MO"; 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 g21si16336579plo.435.2018.12.04.03.19.53; Tue, 04 Dec 2018 03:20:08 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b="fFzPK/MO"; 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 S1727447AbeLDLEk (ORCPT + 99 others); Tue, 4 Dec 2018 06:04:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:51718 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726888AbeLDLEf (ORCPT ); Tue, 4 Dec 2018 06:04:35 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 32EB32146D; Tue, 4 Dec 2018 11:04:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543921474; bh=D6Nc2NHUeOSlgSuDNSLSIodJgYtkDI6yzgdE9ANQm3Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fFzPK/MOttrwnSkzLVSlKzuM89hcNwgKBXGdw+KtVLWHI/fqcuQ5y8SvFmZRAYHOo qyQTdk5cx0hmWv6zWLq93lAu5/6HkyIeIhHTcKZhEYlw7MQ3HTlmECnvLeiesXHYFz C8zHdyXQCbN/5Gw5LcW4MvxJw2/bxs/lj1f8o2PU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tim Chen , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Andy Lutomirski , Linus Torvalds , Jiri Kosina , Tom Lendacky , Josh Poimboeuf , Andrea Arcangeli , David Woodhouse , Andi Kleen , Dave Hansen , Casey Schaufler , Asit Mallick , Arjan van de Ven , Jon Masters , Waiman Long , Dave Stewart , Kees Cook Subject: [PATCH 4.14 085/146] x86/speculation: Rename SSBD update functions Date: Tue, 4 Dec 2018 11:49:31 +0100 Message-Id: <20181204103730.244548692@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181204103726.750894136@linuxfoundation.org> References: <20181204103726.750894136@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Gleixner tglx@linutronix.de commit 26c4d75b234040c11728a8acb796b3a85ba7507c upstream During context switch, the SSBD bit in SPEC_CTRL MSR is updated according to changes of the TIF_SSBD flag in the current and next running task. Currently, only the bit controlling speculative store bypass disable in SPEC_CTRL MSR is updated and the related update functions all have "speculative_store" or "ssb" in their names. For enhanced mitigation control other bits in SPEC_CTRL MSR need to be updated as well, which makes the SSB names inadequate. Rename the "speculative_store*" functions to a more generic name. No functional change. Signed-off-by: Tim Chen Signed-off-by: Thomas Gleixner Reviewed-by: Ingo Molnar Cc: Peter Zijlstra Cc: Andy Lutomirski Cc: Linus Torvalds Cc: Jiri Kosina Cc: Tom Lendacky Cc: Josh Poimboeuf Cc: Andrea Arcangeli Cc: David Woodhouse Cc: Andi Kleen Cc: Dave Hansen Cc: Casey Schaufler Cc: Asit Mallick Cc: Arjan van de Ven Cc: Jon Masters Cc: Waiman Long Cc: Greg KH Cc: Dave Stewart Cc: Kees Cook Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20181125185004.058866968@linutronix.de Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/spec-ctrl.h | 6 +++--- arch/x86/kernel/cpu/bugs.c | 4 ++-- arch/x86/kernel/process.c | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) --- a/arch/x86/include/asm/spec-ctrl.h +++ b/arch/x86/include/asm/spec-ctrl.h @@ -70,11 +70,11 @@ extern void speculative_store_bypass_ht_ static inline void speculative_store_bypass_ht_init(void) { } #endif -extern void speculative_store_bypass_update(unsigned long tif); +extern void speculation_ctrl_update(unsigned long tif); -static inline void speculative_store_bypass_update_current(void) +static inline void speculation_ctrl_update_current(void) { - speculative_store_bypass_update(current_thread_info()->flags); + speculation_ctrl_update(current_thread_info()->flags); } #endif --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -199,7 +199,7 @@ x86_virt_spec_ctrl(u64 guest_spec_ctrl, tif = setguest ? ssbd_spec_ctrl_to_tif(guestval) : ssbd_spec_ctrl_to_tif(hostval); - speculative_store_bypass_update(tif); + speculation_ctrl_update(tif); } } EXPORT_SYMBOL_GPL(x86_virt_spec_ctrl); @@ -629,7 +629,7 @@ static int ssb_prctl_set(struct task_str * mitigation until it is next scheduled. */ if (task == current && update) - speculative_store_bypass_update_current(); + speculation_ctrl_update_current(); return 0; } --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -398,27 +398,27 @@ static __always_inline void amd_set_ssb_ wrmsrl(MSR_AMD64_VIRT_SPEC_CTRL, ssbd_tif_to_spec_ctrl(tifn)); } -static __always_inline void intel_set_ssb_state(unsigned long tifn) +static __always_inline void spec_ctrl_update_msr(unsigned long tifn) { u64 msr = x86_spec_ctrl_base | ssbd_tif_to_spec_ctrl(tifn); wrmsrl(MSR_IA32_SPEC_CTRL, msr); } -static __always_inline void __speculative_store_bypass_update(unsigned long tifn) +static __always_inline void __speculation_ctrl_update(unsigned long tifn) { if (static_cpu_has(X86_FEATURE_VIRT_SSBD)) amd_set_ssb_virt_state(tifn); else if (static_cpu_has(X86_FEATURE_LS_CFG_SSBD)) amd_set_core_ssb_state(tifn); else - intel_set_ssb_state(tifn); + spec_ctrl_update_msr(tifn); } -void speculative_store_bypass_update(unsigned long tif) +void speculation_ctrl_update(unsigned long tif) { preempt_disable(); - __speculative_store_bypass_update(tif); + __speculation_ctrl_update(tif); preempt_enable(); } @@ -455,7 +455,7 @@ void __switch_to_xtra(struct task_struct set_cpuid_faulting(!!(tifn & _TIF_NOCPUID)); if ((tifp ^ tifn) & _TIF_SSBD) - __speculative_store_bypass_update(tifn); + __speculation_ctrl_update(tifn); } /*