Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1516770ybl; Tue, 13 Aug 2019 14:07:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfYKUeMmlyRyrcdyVgN6BIoAxwVQSknE3nDUE9HoOEUhBEBeC31ToQfjh0ecnU4Dv5GMj9 X-Received: by 2002:a17:90a:db06:: with SMTP id g6mr4067003pjv.60.1565730467846; Tue, 13 Aug 2019 14:07:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565730467; cv=none; d=google.com; s=arc-20160816; b=uizof8WFBMtkMpkxBJw3b4PKB+YWp2+UQ+dcqbV0Dcugs0rmtEOFd0jfzWR/q4KSKs VtYfyPcN2y1CSIROisYIkxLX6jeHcOzh9DL3qbIr3ftmTC6hIFnK83Gt+7100j8Ewz5o O2Ci+qEUytMCVLoBIIAxx/+Z9k9rqbLXygO4Hi20JdXW3lsJlWc95GjEabSPBqHTyZzY OV1ASmYJ/SAagaT+gw8zIUYZJND55YbFpIYo8r+45xFCNJK4qeii1SFXE+Sb6BLyKCOH 6hcHZN+koRhxd5e9qKPc39AkkfzMYlaMHNPsGFpf5Nq73OUrX/+7+iiI1GO/I2vQEF3u ItCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=noFHMjzPWm62YrM5FO3ZI8PIb6hsiNmZvulfACv58NI=; b=fvfW2diTV+D9OYkWRaRwlqD8Z3ScsSUGfBqSuKK6RcLzhFSx5SIdVtEKLMO9rwRlAA jEYflsMkp7U4bxOB5oDkL1vb3FwV1EXzK2AAKyQiS1BQyr5p+qG3fxqu8+5LDRhbW1Ea eeLqTkDF7pQ1DYtnO9XpK3V366q4OHB6EH9IbzabH4fuC8XI+r5Pu+g6+D25Xoy8JUkk FhuiLQl39FhHAcgrHjDwLNCDtaaAwRenM5L7qXH0z5fPeJZp+/fN4Az/ZnNcxY9U3/Il fCYnpjR2jlRaVVUrUyeEXIkTMWnO3kdco7vmDelqSBeofcc+9kh0+yc0Qu5eToL+Ejcr BNag== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t20si1599694pjr.107.2019.08.13.14.07.32; Tue, 13 Aug 2019 14:07:47 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726555AbfHMVCg (ORCPT + 99 others); Tue, 13 Aug 2019 17:02:36 -0400 Received: from mga06.intel.com ([134.134.136.31]:16057 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726347AbfHMVCf (ORCPT ); Tue, 13 Aug 2019 17:02:35 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Aug 2019 14:02:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,382,1559545200"; d="scan'208";a="187901319" Received: from yyu32-desk1.sc.intel.com ([10.144.153.205]) by orsmga002.jf.intel.com with ESMTP; 13 Aug 2019 14:02:33 -0700 From: Yu-cheng Yu To: x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin Cc: Yu-cheng Yu Subject: [PATCH v8 02/27] x86/cpufeatures: Add CET CPU feature flags for Control-flow Enforcement Technology (CET) Date: Tue, 13 Aug 2019 13:52:00 -0700 Message-Id: <20190813205225.12032-3-yu-cheng.yu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190813205225.12032-1-yu-cheng.yu@intel.com> References: <20190813205225.12032-1-yu-cheng.yu@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add CPU feature flags for Control-flow Enforcement Technology (CET). CPUID.(EAX=7,ECX=0):ECX[bit 7] Shadow stack CPUID.(EAX=7,ECX=0):EDX[bit 20] Indirect branch tracking Reviewed-by: Borislav Petkov Signed-off-by: Yu-cheng Yu --- arch/x86/include/asm/cpufeatures.h | 2 ++ arch/x86/kernel/cpu/cpuid-deps.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index e880f2408e29..122265ab46c1 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -334,6 +334,7 @@ #define X86_FEATURE_OSPKE (16*32+ 4) /* OS Protection Keys Enable */ #define X86_FEATURE_WAITPKG (16*32+ 5) /* UMONITOR/UMWAIT/TPAUSE Instructions */ #define X86_FEATURE_AVX512_VBMI2 (16*32+ 6) /* Additional AVX512 Vector Bit Manipulation Instructions */ +#define X86_FEATURE_SHSTK (16*32+ 7) /* Shadow Stack */ #define X86_FEATURE_GFNI (16*32+ 8) /* Galois Field New Instructions */ #define X86_FEATURE_VAES (16*32+ 9) /* Vector AES */ #define X86_FEATURE_VPCLMULQDQ (16*32+10) /* Carry-Less Multiplication Double Quadword */ @@ -358,6 +359,7 @@ #define X86_FEATURE_MD_CLEAR (18*32+10) /* VERW clears CPU buffers */ #define X86_FEATURE_TSX_FORCE_ABORT (18*32+13) /* "" TSX_FORCE_ABORT */ #define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */ +#define X86_FEATURE_IBT (18*32+20) /* Indirect Branch Tracking */ #define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */ #define X86_FEATURE_INTEL_STIBP (18*32+27) /* "" Single Thread Indirect Branch Predictors */ #define X86_FEATURE_FLUSH_L1D (18*32+28) /* Flush L1D cache */ diff --git a/arch/x86/kernel/cpu/cpuid-deps.c b/arch/x86/kernel/cpu/cpuid-deps.c index b5353244749b..9bf35f081080 100644 --- a/arch/x86/kernel/cpu/cpuid-deps.c +++ b/arch/x86/kernel/cpu/cpuid-deps.c @@ -68,6 +68,8 @@ static const struct cpuid_dep cpuid_deps[] = { { X86_FEATURE_CQM_MBM_TOTAL, X86_FEATURE_CQM_LLC }, { X86_FEATURE_CQM_MBM_LOCAL, X86_FEATURE_CQM_LLC }, { X86_FEATURE_AVX512_BF16, X86_FEATURE_AVX512VL }, + { X86_FEATURE_SHSTK, X86_FEATURE_XSAVES }, + { X86_FEATURE_IBT, X86_FEATURE_XSAVES }, {} }; -- 2.17.1