Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp795882imm; Mon, 21 May 2018 14:37:50 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqy2g6LyqEVQ/JP8c4uhpEXc0D89AmS21Ha0Lzjw+L+EeNQejgQD+HB7mVtvPB9INs/QDQq X-Received: by 2002:a62:568f:: with SMTP id h15-v6mr21643563pfj.131.1526938670852; Mon, 21 May 2018 14:37:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526938670; cv=none; d=google.com; s=arc-20160816; b=wX7W9cZ1nzU1/O6fF3xPdDBp5CTu759egtGloBZ9mRjDXhDRwdwah0mSZupsidvzh4 fyhccWoFYuDwQvwVaIyE/itMDOTADNSReCmTbhdtpRlQADXbjPM9gg8o6A6CAhkb4egy w4guzRr/sP2oj9OTc+W+KdJLD1+lmOiU8kbcy5e8Rg9esLIGsghKrS5UmS3JBOmQrRjg w2mGsYRoiqCG9iHnFfVX+JVn1iIB/dPNMTYmMwqKr0NiJKgCdmdHeWlmeWQ8kfs8T3cz FXu5lfcOSJsx+lemENab7DOIfeZnlAeiH5IAq6kmqVJocMp6fllliUBSNIqDRKZ+I2pc Qo2Q== 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:dkim-signature :arc-authentication-results; bh=gotOT8uT4a0XZh1Q3CscamaYwSadi5OsqwurGRokiQ8=; b=ItfPcplhZ04Vy49+my81pygc3IkgSKWbt5pRQ8IK+KSSPe0c+cn/1+XypLqttOBv2V HeyD1dINssGvZw3fRJm+7hpByokhJSl/tVH1f4cEbkpya8jiRJbmW4WQN6cdwCRw64qB JELJirDEhfxOswmLR0uKDF5oDRyj2BHmJmybkwRtuJ3cc/6wBKPIkD6K8dBAWLfV4KX3 rjAoo8yJHHKUDr5qwI/K5b7/8skgzWbDif6oPX857+iChFASfWZkRwOVk3MDGOHZDSsL KroT5heaSjMen9YaIgb0+51OeNoGWAYTmOc7sjBIrBUY6zr+j4HrEtlcQoFXR1Zgxb0d Q5AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IFOE1syf; 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 v16-v6si14302165pfm.151.2018.05.21.14.37.35; Mon, 21 May 2018 14:37: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; dkim=pass header.i=@kernel.org header.s=default header.b=IFOE1syf; 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 S932428AbeEUVZ2 (ORCPT + 99 others); Mon, 21 May 2018 17:25:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:40180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932408AbeEUVZS (ORCPT ); Mon, 21 May 2018 17:25:18 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 CCD8D2075C; Mon, 21 May 2018 21:25:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1526937918; bh=uDcy6W90DHKHuO6HhjqBbmaOZx59PMJqUfhE0ulsJp4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IFOE1syf+Mgrvkj9dQtfigK0S6h/pe3TL8Vf9aPhltQfHOija4XKYqQYPcphHYqlg 1oBBWoWS0AwB76pLieOdKOIUwdOm1Nk115n/StPUPK9ALHz78igrGPVRnaYPomTVbm iUWgYO968CxQRrxCFZtZGMQyN/ESIpIlnbJtTuRM= 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 Subject: [PATCH 4.16 074/110] x86/speculation: Create spec-ctrl.h to avoid include hell Date: Mon, 21 May 2018 23:12:11 +0200 Message-Id: <20180521210512.695964768@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180521210503.823249477@linuxfoundation.org> References: <20180521210503.823249477@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.16-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: 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 @@ -228,26 +228,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 @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include #include --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -50,7 +50,7 @@ #include #include #include -#include +#include #include #include "trace.h" --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -52,7 +52,7 @@ #include #include #include -#include +#include #include "trace.h" #include "pmu.h"