From patchwork Wed Jan 10 22:05:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 124139 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5802651qgn; Wed, 10 Jan 2018 14:07:32 -0800 (PST) X-Google-Smtp-Source: ACJfBovnZEGvP3H2ViBZ6zeBdyvzYRQnKMP7FjGAnMP3yc6tuamM1OKeN4hIAEn+8Yt9pYS/zOpf X-Received: by 10.84.235.66 with SMTP id g2mr20386600plt.37.1515622052848; Wed, 10 Jan 2018 14:07:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515622052; cv=none; d=google.com; s=arc-20160816; b=zkMa4FztdFUNszSAQ8pOCoZZf8LCDhu3F7EDaAOShADwlsLfi974qunyaoBHuGgxIc OlUYOunk8x1PwNnKErRkhnjnvA01A6tbJHprUfX2sHLZfgwAM4pFJPTo3rtLD7y2E//w TH5nD5oIo0oEKCLo8Vgg6/iEYRNsXpoWn3x4zx3gu4i6sDOOLsTnfTUcwFJel0cB6bke 9PlyYqni4neve5jknl+kTEmAMwQDKpS3f6i6/CpoFEroDbQXYWmKgx2WPhj5z2PFlR0L aiOhTytDIDUyr8dBPqvn6f03fa689qufj8xka1kpOn7937ynb05HqYQgfQq58E9BqzgQ jNqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=V3z352kost+ZVnzDWi7Ve+eYPHvfAn2/Mv9NlEQmgSs=; b=kkxfhobI5zIugfkqYAJ4ge9SHidkLiSkCC+Ku5K3kPsSmXx9e+Vb4s259ojCekFTF7 lpSJ+OgInvVi3for8Yq0/265+ZbLkwWl4oprd2urCEPEvrzP8gDZuwcPxT6CojN4f2V0 J3gQR8VW2JMpx11oCy4xzCNWSwKjphyDvFEeubgsUXKqUgloJ4IpxR9Z6FjyFv4gKoZ5 tlpweAkMDyWhn5nYyznKGIAnAbVIhQpqr7508tvKtDIXPu9t+X52OM1HVYNksUWUy1hr Cxlp65K9sZ/cl/C/lXBkz0KO+a/yM4E6Aeer892PDnQnfUR9fHIUDmar6i4ufI0Fg1ug owuA== 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 t6si628055plq.9.2018.01.10.14.07.31; Wed, 10 Jan 2018 14:07:32 -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; 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 S1752011AbeAJWH3 (ORCPT + 28 others); Wed, 10 Jan 2018 17:07:29 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:58140 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750990AbeAJWH2 (ORCPT ); Wed, 10 Jan 2018 17:07:28 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPA (Nemesis) id 0LqlQA-1f3WKJ2tqk-00ePYL; Wed, 10 Jan 2018 23:06:09 +0100 From: Arnd Bergmann To: David Woodhouse , Thomas Gleixner , x86@kernel.org Cc: Arnd Bergmann , Ingo Molnar , "H. Peter Anvin" , Andy Lutomirski , Laura Abbott , linux-kernel@vger.kernel.org Subject: [PATCH] x86/spectre: hide 'spectre_v2_enabled' when disabled Date: Wed, 10 Jan 2018 23:05:30 +0100 Message-Id: <20180110220554.141703-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:Oam0Jx7oq5CgsD1fo1Z/OhhkcvrkCL70oupQi3aYR9X215yGQyp W5qUcbc48XRFEGQOij8XndlLgyyB9vW4VmFJk8Fe5ABGvMGcy1GLsRhetOqoZsV5p1zFh9z bfiSNC44+1zTxm6vBXqSIlPfe6jklmZPv9sndPv0BPU2ZGa/vRktqd6ohuqnCZ3ipK4xR7e bjMsyXnMvIIDQzqVZkKDQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:xdAJdyt5SYc=:oURnTDxnI+LcKRxEHXDLix OMdk2PhvBKofcbTOzDYE/ysDdtckuzkA71V6+o75ITHdSZarp08boe9B4APL0P0VX0Pe7uoMm t3POVqY65B0KoKbxfQrO9ZclCNrI1wForK75upydxPPkFwVgLwXPxaGZIwZQjbKMKxQPc7WKj ux57Rl0M+H0qYFOJwdsYnQAgRdYRK1elEM5QiXSHoQao/TcLSCCfLiBxE41Lm/U11ygomAp43 PeedVcuuF92uQVk9h1kNXNRgoQR6SI0YV6wegOtWJgCLrNUknT48GeWb8MSHk3SyCMCPCJ3vM rdnrG4xRP81ePAS1WezMeRRTAyZIgcilmZtn6+ni+fF5K2OaRTmNP0OL+don3w0sR0X8ycBIF du1EXSPOgO+NUouh8x4Ynxys2tMFG6QD/VJwFzvkggNwQWllqqA8zjd6t4gDBGDPfIOn+DWjz e8CdESQKd4XlQjzxC8Dtkw1+uFxBFEnXDCH6LqHhuSCe71g/8DS9vh9C58qQq5ZGYg0Da9cl6 r0xtUYtjYydJgZCGZCZhkLQkqWaOJP8tILuUSV33cEP/tXDzmXGj8ltpciEPhVaUEOpm1JGEg s5xSw+PFc82tV98yEPgWvKTAIi8xA3JzoI0Qv7hYcVOyu9aZnppKb7Tgtc79/91vCcC6YoujI MEiqQFLiUnnMY8aO1SnrggQrjuhP+fRr3JyqAaeHSqzqf9vU1W4/FV0DEajwIfE2rdHMG0B9w UxH/guPY3TiGGeS2aFS4cW2IKthKolmbudsbIg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org gcc prints a harmless warning when both CONFIG_RETPOLINE and CONFIG_SYSFS are disabled: arch/x86/kernel/cpu/bugs.c:79:12: warning: 'spectre_v2_enabled' defined but not used [-Wunused-variable] This hides the spectre_v2_enabled variable from compilation when CONFIG_RETPOLINE is disabled, to avoid that warning. Fixes: 54d5103245ff ("x86/spectre: Add boot time option to select Spectre v2 mitigation") Signed-off-by: Arnd Bergmann --- arch/x86/kernel/cpu/bugs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -- 2.9.0 diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index b957f771a5b7..6f0105875c3a 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -76,7 +76,9 @@ enum spectre_v2_mitigation { #undef pr_fmt #define pr_fmt(fmt) "Spectre V2 mitigation: " fmt +#ifdef CONFIG_RETPOLINE static int spectre_v2_enabled = SPECTRE_V2_NONE; +#endif static void __init spec2_print_if_insecure(const char *reason) { @@ -195,6 +197,7 @@ ssize_t cpu_show_spectre_v2(struct device *dev, if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V2)) return sprintf(buf, "Not affected\n"); +#ifdef CONFIG_RETPOLINE switch (spectre_v2_enabled) { case SPECTRE_V2_RETPOLINE_MINIMAL: return sprintf(buf, "Mitigation: Minimal generic ASM retpoline\n"); @@ -204,8 +207,8 @@ ssize_t cpu_show_spectre_v2(struct device *dev, return sprintf(buf, "Mitigation: Full generic retpoline\n"); case SPECTRE_V2_RETPOLINE_AMD: return sprintf(buf, "Mitigation: Full AMD retpoline\n"); - default: - return sprintf(buf, "Vulnerable\n"); } +#endif + return sprintf(buf, "Vulnerable\n"); } #endif