Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5190828imm; Tue, 19 Jun 2018 06:36:46 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKH6Uy2Ts3xWC58fuVTy8MQFy/aMMPjvRUAG0D3yeR7Lk3AOTQ/QgBcyHakMpzQHoWNj/Rz X-Received: by 2002:a65:4249:: with SMTP id d9-v6mr15087040pgq.362.1529415406214; Tue, 19 Jun 2018 06:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529415406; cv=none; d=google.com; s=arc-20160816; b=Zv7j/tfMsoXnYsMYPejONazLLLEf5UkZGHUmyTbWCfsAZgw0zYcRDVx0ovw6amaoLz 68tbs6vdsEhutyAp43D1FW45SIcZ1K+70J/TFlAvOqpwVm2hb5nFvuP9HZEKk5qXeeDB MK7H/7Z9nKXnlMzWyqzLrKbrnf6QjzIkl/qsrcPWALPg4P1fxHA/Aj7O4wPE7d6RWOcV eMAFC88pd6iS+PQ17MvMespQFzSgtVMQcDRLM7n/mCoIEBWEk4B2GbQSCi+oP1+OF5GQ tb32jxRSgph0Ca9ZCS3jNo2Mc4ez1stgF/8PIjTjxhGfO6mB30EMEdK7fhuLZzuMJqWX MjUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=PK//hPK8/mrrv8ZBwuPmqwqqp1UmdOeZcQZ8DvN2Phs=; b=ZTSfNsfwbZwr3Jw7zEjSWqWawOqfJrajnU2MCLR5XQIjNFzopVmmzdByuQyZLaJefm 1nk/BxkcphhlbBgvd9mbfzn27Fg7MG9GXWluX3dcwV4wo8U0wXZpSgjWM3TljOQPJqZ5 tjbVBejG1OA2WvCuYRvyhW5H3oeQNBVGZvklGgW/7gYB3vZ99pLAQzGoh7gSoP0kqbNd JTQG2MP077cGwa3dVWBidId1MDbWTnvmygWM5/E/rDdUjXpQNgCxidNHEiscNB70Ogko XHo9ThOr+CO8Mf8fARsrRoDRPjBg9L2hZy4ZDH6sQ9WfgGrR4jdiZP4rAGIDJWtzd1Tn HyYg== 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 k91-v6si17802310pld.248.2018.06.19.06.36.32; Tue, 19 Jun 2018 06:36:46 -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 S966310AbeFSNek (ORCPT + 99 others); Tue, 19 Jun 2018 09:34:40 -0400 Received: from mga17.intel.com ([192.55.52.151]:64703 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755203AbeFSNei (ORCPT ); Tue, 19 Jun 2018 09:34:38 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jun 2018 06:34:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,243,1526367600"; d="scan'208";a="48237895" Received: from aluisell-mobl2.ger.corp.intel.com (HELO localhost) ([10.249.254.128]) by fmsmga007.fm.intel.com with ESMTP; 19 Jun 2018 06:34:23 -0700 Date: Tue, 19 Jun 2018 16:34:22 +0300 From: Jarkko Sakkinen To: Neil Horman Cc: x86@kernel.org, platform-driver-x86@vger.kernel.org, dave.hansen@intel.com, sean.j.christopherson@intel.com, npmccallum@redhat.com, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "Rafael J. Wysocki" , Vikas Shivappa , Greg Kroah-Hartman , Andi Kleen , "Kirill A. Shutemov" , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:INTEL SGX" Subject: Re: [PATCH v11 07/13] x86, sgx: detect Intel SGX Message-ID: <20180619133422.GJ5609@linux.intel.com> References: <20180608171216.26521-1-jarkko.sakkinen@linux.intel.com> <20180608171216.26521-8-jarkko.sakkinen@linux.intel.com> <20180611113521.GB22164@hmswarspite.think-freely.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180611113521.GB22164@hmswarspite.think-freely.org> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 11, 2018 at 07:35:21AM -0400, Neil Horman wrote: > On Fri, Jun 08, 2018 at 07:09:42PM +0200, Jarkko Sakkinen wrote: > > From: Sean Christopherson > > > > Intel(R) SGX is a set of CPU instructions that can be used by applications > > to set aside private regions of code and data. The code outside the enclave > > is disallowed to access the memory inside the enclave by the CPU access > > control. > > > > This commit adds the check for SGX to arch/x86 and a new config option, > > INTEL_SGX_CORE. Exposes a boolean variable 'sgx_enabled' to query whether > > or not the SGX support is available. > > > > Signed-off-by: Sean Christopherson > > Reviewed-by: Jarkko Sakkinen > > Tested-by: Jarkko Sakkinen > > Signed-off-by: Jarkko Sakkinen > > --- > > arch/x86/Kconfig | 19 ++++++++++++ > > arch/x86/include/asm/sgx.h | 25 ++++++++++++++++ > > arch/x86/include/asm/sgx_pr.h | 20 +++++++++++++ > > arch/x86/kernel/cpu/Makefile | 1 + > > arch/x86/kernel/cpu/intel_sgx.c | 53 +++++++++++++++++++++++++++++++++ > > 5 files changed, 118 insertions(+) > > create mode 100644 arch/x86/include/asm/sgx.h > > create mode 100644 arch/x86/include/asm/sgx_pr.h > > create mode 100644 arch/x86/kernel/cpu/intel_sgx.c > > > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > > index c07f492b871a..42015d5366ef 100644 > > --- a/arch/x86/Kconfig > > +++ b/arch/x86/Kconfig > > @@ -1925,6 +1925,25 @@ config X86_INTEL_MEMORY_PROTECTION_KEYS > > > > If unsure, say y. > > > > +config INTEL_SGX_CORE > > + prompt "Intel SGX core functionality" > > + def_bool n > > + depends on X86_64 && CPU_SUP_INTEL > > + help > > + Intel Software Guard eXtensions (SGX) is a set of CPU instructions > > + that allows ring 3 applications to create enclaves; private regions > > + of memory that are protected, by hardware, from unauthorized access > > + and/or modification. > > + > > + This option enables kernel recognition of SGX, high-level management > > + of the Enclave Page Cache (EPC), tracking and writing of SGX Launch > > + Enclave Hash MSRs, and allows for virtualization of SGX via KVM. By > > + iteslf, this option does not provide SGX support to userspace. > > + > > + For details, see Documentation/x86/intel_sgx.rst > > + > > + If unsure, say N. > > + > > config EFI > > bool "EFI runtime service support" > > depends on ACPI > > diff --git a/arch/x86/include/asm/sgx.h b/arch/x86/include/asm/sgx.h > > new file mode 100644 > > index 000000000000..fa3e6e0eb8af > > --- /dev/null > > +++ b/arch/x86/include/asm/sgx.h > > @@ -0,0 +1,25 @@ > > +// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) > > +// Copyright(c) 2016-18 Intel Corporation. > > +// > > +// Authors: > > +// > > +// Jarkko Sakkinen > > +// Suresh Siddha > > +// Sean Christopherson > > + > > +#ifndef _ASM_X86_SGX_H > > +#define _ASM_X86_SGX_H > > + > > +#include > > + > > +#define SGX_CPUID 0x12 > > + > Agree with Dave, this can just be remoed and you can use the feature macro from > cpuid.h instead > > Neil Will do, thanks. /Jarkko