Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5770534imm; Mon, 23 Jul 2018 05:54:50 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf4ckHZJmu9r0hUyDF8YmnN4WKEdDPy9jL0D6WGAPQ03QrYxAMW4b+SdM3b23he+4EhygOl X-Received: by 2002:a62:3e1a:: with SMTP id l26-v6mr13180871pfa.214.1532350490261; Mon, 23 Jul 2018 05:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532350490; cv=none; d=google.com; s=arc-20160816; b=Ks8DcE7HDWt5Gc2p3uFi1psNN+zeHKeVrGclReaP/d3mbsuMN/gEqNKrPgSoLGAc0q jRHkcMaAvFin8pwh6FndtuuIqDUoH8VUbRYdTqDmRsKrYPw9ypOwgCYtPDX5FVFyvTcW zYe+tzRjM1rP/WSp7oIXx7ghBEIEAsEZHBmIogJYinHziWQ9NMuvbb0XaJnVj/8NJmo7 AaUXeZEHCKelOv4dPgbEtvwu5ZLwCrihK49T1btogRLSrOXmrBeF9AINVu8V5BGHcdHb hc+0I0dCkCitBbHSz49pD2z66yken4DieK7Oj0t4814xtRUWXwSaOET8H0QDk7DOdTw4 ZkKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=uisHdL+r0YG2t9PvZrsFTyJvCloPMIu/NHx6f2qOvUI=; b=eioyQvDNZ2phAzjmyfmo0bpiZAnkE6o/lu5HPE+e42XwPUOU5cDvILCbFpejXiomlW zrG0cd1IdVLtlPSUDr3XyTXA/S11uv4DElQgeKWJLkiQiOuuVOu/q8wtp7FmYMtKzzRC rRduY47Hy/drSKzIJ0+jGXq+MnQGNronQHKSWY5jwrklXjAO8h1ILCip71W3ziU7mpG2 ApETEgIUVfDkJTLXubkaaMVD/ELcWZ+tL+gniu29j/yTIKqZrFbJV74c98UdYvegXbux Q1jZiG75z+RlBWBRpygKBbh8/N7YvaRjyp6dum3qYF3RL43A05yk830dw4rEjOLVJmIj iL8Q== ARC-Authentication-Results: i=1; mx.google.com; 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 v6-v6si8027690plp.60.2018.07.23.05.54.35; Mon, 23 Jul 2018 05:54:50 -0700 (PDT) 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; 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 S2388703AbeGWNxm (ORCPT + 99 others); Mon, 23 Jul 2018 09:53:42 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51134 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388511AbeGWNrp (ORCPT ); Mon, 23 Jul 2018 09:47:45 -0400 Received: from localhost (LFbn-1-12238-233.w90-92.abo.wanadoo.fr [90.92.53.233]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 9F5D6C75; Mon, 23 Jul 2018 12:45:21 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Konrad Rzeszutek Wilk , Ingo Molnar , David Woodhouse , "Srivatsa S. Bhat" , "Matt Helsley (VMware)" , Alexey Makhalov , Bo Gan Subject: [PATCH 4.4 061/107] x86/speculation: Create spec-ctrl.h to avoid include hell Date: Mon, 23 Jul 2018 14:41:55 +0200 Message-Id: <20180723122416.105905171@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180723122413.003644357@linuxfoundation.org> References: <20180723122413.003644357@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Gleixner commit 28a2775217b17208811fa43a9e96bd1fdf417b86 upstream Having everything in nospec-branch.h creates a hell of dependencies when adding the prctl based switching mechanism. Move everything which is not required in nospec-branch.h to spec-ctrl.h and fix up the includes in the relevant files. Signed-off-by: Thomas Gleixner Reviewed-by: Konrad Rzeszutek Wilk Reviewed-by: Ingo Molnar Signed-off-by: David Woodhouse Signed-off-by: Greg Kroah-Hartman Signed-off-by: Srivatsa S. Bhat Reviewed-by: Matt Helsley (VMware) Reviewed-by: Alexey Makhalov Reviewed-by: Bo Gan Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/nospec-branch.h | 14 -------------- arch/x86/include/asm/spec-ctrl.h | 21 +++++++++++++++++++++ arch/x86/kernel/cpu/amd.c | 2 +- arch/x86/kernel/cpu/bugs.c | 2 +- arch/x86/kvm/svm.c | 2 +- arch/x86/kvm/vmx.c | 2 +- 6 files changed, 25 insertions(+), 18 deletions(-) create mode 100644 arch/x86/include/asm/spec-ctrl.h --- a/arch/x86/include/asm/nospec-branch.h +++ b/arch/x86/include/asm/nospec-branch.h @@ -183,26 +183,12 @@ enum spectre_v2_mitigation { extern void x86_spec_ctrl_set(u64); extern u64 x86_spec_ctrl_get_default(void); -/* - * On VMENTER we must preserve whatever view of the SPEC_CTRL MSR - * the guest has, while on VMEXIT we restore the host view. This - * would be easier if SPEC_CTRL were architecturally maskable or - * shadowable for guests but this is not (currently) the case. - * Takes the guest view of SPEC_CTRL MSR as a parameter. - */ -extern void x86_spec_ctrl_set_guest(u64); -extern void x86_spec_ctrl_restore_host(u64); - /* The Speculative Store Bypass disable variants */ enum ssb_mitigation { SPEC_STORE_BYPASS_NONE, SPEC_STORE_BYPASS_DISABLE, }; -/* AMD specific Speculative Store Bypass MSR data */ -extern u64 x86_amd_ls_cfg_base; -extern u64 x86_amd_ls_cfg_rds_mask; - extern char __indirect_thunk_start[]; extern char __indirect_thunk_end[]; --- /dev/null +++ b/arch/x86/include/asm/spec-ctrl.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_X86_SPECCTRL_H_ +#define _ASM_X86_SPECCTRL_H_ + +#include + +/* + * On VMENTER we must preserve whatever view of the SPEC_CTRL MSR + * the guest has, while on VMEXIT we restore the host view. This + * would be easier if SPEC_CTRL were architecturally maskable or + * shadowable for guests but this is not (currently) the case. + * Takes the guest view of SPEC_CTRL MSR as a parameter. + */ +extern void x86_spec_ctrl_set_guest(u64); +extern void x86_spec_ctrl_restore_host(u64); + +/* AMD specific Speculative Store Bypass MSR data */ +extern u64 x86_amd_ls_cfg_base; +extern u64 x86_amd_ls_cfg_rds_mask; + +#endif --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include #include --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include "trace.h" --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include "trace.h" #include "pmu.h"