Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp717356img; Wed, 20 Mar 2019 09:22:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhdqTL7DhMNWB2lvXqE3rA/GjSRMLp/7e8YOZ7C1jU6GeazBlhzw8u8kcpD8cGi4agHGVz X-Received: by 2002:a62:3890:: with SMTP id f138mr8614485pfa.148.1553098961593; Wed, 20 Mar 2019 09:22:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553098961; cv=none; d=google.com; s=arc-20160816; b=mcrepFtccgQmcgzE/o8yz6KrMK3GsU/jF6hal9VZNRttTptBp9YjOoGDFVP7YZZ7Uu TddAbBhZ3rjI5rWrvHvSDrUVNjuKwZSpfZp5xjTei5esubJpFQYDMRLnUbk6WSSBD03p wwLElXOKcwDYwFFw9PLpUleV90YN9IdsIOMmaaVFuzZf2DVpO9ju20qgsKIwXVxBOrUT NpEUpcBlWgUQEoKR2TB3iYb14x7ezqOv+mO9eLSqidgkpFZzIaPoFkQMkYfB9BANPTR3 Vft3F3YLSodVu3RUsDfdUebQuxzn/t7lE1v5lxFk4sMdmhIuvcymz6dtNUYmNkmTvDSe xQyw== 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=heN7T6kS9pxbldsqsAA4Fa7Vcg9eWovFZeNl8OfeUGnZOU0fBJWYE/KMR+JQ9LzC3w OEDZhYsju1HvyNuNBaLfuAL24WapQy/rh/3w2El0yxjWfl08jnj76o4CnhSKhqnIptn5 oJaFNlLyEFD0G6hA2Cl+ghWbNwXyLQwhEZcCSzedpzlU/WNqHBEwOog5Acw6jhe7Gly2 KC7IjsYcCU9HNg4+s3DzXNYccRwpkcYAhb5ZImnMDcmuJdvhxY7zPDQMTwjgfJJnhi/2 L+RDJtyA+LP3kVwTe+DpyK5tcWFyV8aoLq2VfE5WKxfmkKLS6/6qm/5VV8SyTx3ntwBS Wn4w== 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 r16si2021463pgl.347.2019.03.20.09.22.26; Wed, 20 Mar 2019 09:22:41 -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 S1727497AbfCTQVo (ORCPT + 99 others); Wed, 20 Mar 2019 12:21:44 -0400 Received: from mga01.intel.com ([192.55.52.88]:41213 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726844AbfCTQVo (ORCPT ); Wed, 20 Mar 2019 12:21:44 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Mar 2019 09:21:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,249,1549958400"; d="scan'208";a="135714567" Received: from sorenthe-mobl1.ger.corp.intel.com (HELO localhost) ([10.249.254.203]) by orsmga003.jf.intel.com with ESMTP; 20 Mar 2019 09:21:32 -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 v19,RESEND 01/27] x86/cpufeatures: Add Intel-defined SGX feature bit Date: Wed, 20 Mar 2019 18:20:53 +0200 Message-Id: <20190320162119.4469-2-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190320162119.4469-1-jarkko.sakkinen@linux.intel.com> References: <20190320162119.4469-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