Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4054615yba; Wed, 17 Apr 2019 03:41:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxTY3b5TYpt0lP5WXd0/00xYs3SK5iLUwqdU2PohT1+h2sH+bYz6I/E0xCgc1GrJLm2f933 X-Received: by 2002:a62:e501:: with SMTP id n1mr66193234pff.17.1555497674420; Wed, 17 Apr 2019 03:41:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555497674; cv=none; d=google.com; s=arc-20160816; b=lFO6qu66mtVwR7Ey9lYsJEchOyQrDD5RbcC/rWfXDuZ4KA8iU/yCVQocQgKTS6NoZn thl2KAgr8SUcvieR49POl6CVTYgloBM+dWdVTZNLJZ7cMr/Fkqi0NVBbKoflhk9W1qP+ sZOaVN8aMftc2ktqQH0gkuFnLMXxpDfHY/hZnwj0jFclft4OKVSV36P0g/NnoknX/7Ou 5dfVn0vVs6/zdW7Bsmw4wtSJsL1ltjhGe7wFUbfmH4+C3AQz9aUfCokJ3F+dueDC9Zfp c2tBpNN19Bc8JstH0Vhxlwwrsobn1b1oSwrf8Q2SmaiRqMWTNQv4bxx3BNSHPgtHYPCM 8hKA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=O+odGE1ASeLWwYT9fjpXO79lkpR59UB31kwfiPdbT0Q=; b=W3iDCG7pQtN2TMQvFQ35T4LHPkozaXb4VHDBm4JbOVanmh/LVEeGYipQ5PB7lXBBGB ZLb7QmhDYsHR0oNdcIXd/i0QWq1d+3cgfv1SE7ycTp7Pch1a6bNj5wWzJibb6AX0deJu xHfXOZX9tv0RUfwd/a48e7qFcumb6ETon++kPLdaJVIxVjVjk1c/zMoffHnjIAXmp7hT tJGmdD67ltjNm5uIoCttdprjvd2okRtwHR31Q2jOu6Tht1i0B6dewCOLmEUjFYB1XlAb T+ucUfUkInDqvIyYKlb/M/biwe2WxUJ53/2jLw/OVZQd2OuXD5ADoSXR0pZIn4D0fitM CodA== 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 d186si53688283pfa.218.2019.04.17.03.40.59; Wed, 17 Apr 2019 03:41:14 -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 S1731605AbfDQKjz (ORCPT + 99 others); Wed, 17 Apr 2019 06:39:55 -0400 Received: from mga03.intel.com ([134.134.136.65]:55143 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726695AbfDQKjy (ORCPT ); Wed, 17 Apr 2019 06:39:54 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Apr 2019 03:39:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,361,1549958400"; d="scan'208";a="132119678" Received: from jsakkine-mobl1.tm.intel.com (HELO localhost) ([10.237.50.189]) by orsmga007.jf.intel.com with ESMTP; 17 Apr 2019 03:39:48 -0700 From: Jarkko Sakkinen To: linux-kernel@vger.kernel.org, x86@kernel.org, linux-sgx@vger.kernel.org Cc: akpm@linux-foundation.org, dave.hansen@intel.com, sean.j.christopherson@intel.com, nhorman@redhat.com, npmccallum@redhat.com, serge.ayoun@intel.com, shay.katz-zamir@intel.com, haitao.huang@intel.com, andriy.shevchenko@linux.intel.com, tglx@linutronix.de, kai.svahn@intel.com, bp@alien8.de, josh@joshtriplett.org, luto@kernel.org, kai.huang@intel.com, rientjes@google.com, Kai Huang , Jarkko Sakkinen Subject: [PATCH v20 01/28] x86/cpufeatures: Add Intel-defined SGX feature bit Date: Wed, 17 Apr 2019 13:39:11 +0300 Message-Id: <20190417103938.7762-2-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190417103938.7762-1-jarkko.sakkinen@linux.intel.com> References: <20190417103938.7762-1-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kai Huang X86_FEATURE_SGX reflects whether or not the CPU supports Intel's Software Guard eXtensions (SGX). Signed-off-by: Kai Huang Co-developed-by: Jarkko Sakkinen Signed-off-by: Jarkko Sakkinen Reviewed-by: Borislav Petkov --- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/include/asm/disabled-features.h | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 981ff9479648..a16325db4cff 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -236,6 +236,7 @@ /* Intel-defined CPU features, CPUID level 0x00000007:0 (EBX), word 9 */ #define X86_FEATURE_FSGSBASE ( 9*32+ 0) /* RDFSBASE, WRFSBASE, RDGSBASE, WRGSBASE instructions*/ #define X86_FEATURE_TSC_ADJUST ( 9*32+ 1) /* TSC adjustment MSR 0x3B */ +#define X86_FEATURE_SGX ( 9*32+ 2) /* Software Guard Extensions */ #define X86_FEATURE_BMI1 ( 9*32+ 3) /* 1st group bit manipulation extensions */ #define X86_FEATURE_HLE ( 9*32+ 4) /* Hardware Lock Elision */ #define X86_FEATURE_AVX2 ( 9*32+ 5) /* AVX2 instructions */ diff --git a/arch/x86/include/asm/disabled-features.h b/arch/x86/include/asm/disabled-features.h index a5ea841cc6d2..74de07d0f390 100644 --- a/arch/x86/include/asm/disabled-features.h +++ b/arch/x86/include/asm/disabled-features.h @@ -62,6 +62,12 @@ # define DISABLE_PTI (1 << (X86_FEATURE_PTI & 31)) #endif +#ifdef CONFIG_INTEL_SGX +# define DISABLE_SGX_CORE 0 +#else +# define DISABLE_SGX_CORE (1 << (X86_FEATURE_SGX & 31)) +#endif + /* * Make sure to add features to the correct mask */ @@ -74,7 +80,7 @@ #define DISABLED_MASK6 0 #define DISABLED_MASK7 (DISABLE_PTI) #define DISABLED_MASK8 0 -#define DISABLED_MASK9 (DISABLE_MPX|DISABLE_SMAP) +#define DISABLED_MASK9 (DISABLE_MPX|DISABLE_SMAP|DISABLE_SGX_CORE) #define DISABLED_MASK10 0 #define DISABLED_MASK11 0 #define DISABLED_MASK12 0 -- 2.19.1