Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1453851imm; Tue, 3 Jul 2018 11:24:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfeHBFRDPtxE0vZCa27EFkVfIFm+UpbTxiN5kwF4L4X4AD8BUz5v+EW73nYn49eRGnQhS6M X-Received: by 2002:a17:902:70c6:: with SMTP id l6-v6mr5418141plt.286.1530642245178; Tue, 03 Jul 2018 11:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530642245; cv=none; d=google.com; s=arc-20160816; b=rEUUtgQGzW/tnLxJcCFU04rJZOG1/9c0Ay7jlhz2T4KtpbgxZu0UcIZntoOAlYxNgk bZ28rGjXYORAiWqSq5cuAd+gc1hs2AD0/dpA52PJo/fIGF11vlk5Nc1SVWcbwMdbUQpQ uGUSVpS7GA8r6t2dQAVTRFOmODK1qGmK4U+BZd+l7a9ouAmCGqggIckXO1b6ecEPRCOc UcEY09leZnUBd384+Gz+cOMBhjUcfABBSIKBG+YiKu0cTXdNG4pW80WGduwRB5vGZMKF IZkfb2D1B8PMFIXs+IsrqX7vUV/km4RilGnALsmHsIYVcZKP4cm6V+9jTglJ30za7JAP XM3A== 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:arc-authentication-results; bh=PCjGRxiBYHwzX0n77Ex8mWxudVLB1LEiQq4em5O2D/E=; b=a63tCc68InZp9Icjb1xhQ0+G8QvARvtlKu9kC+KvDIqeVBbqtdK7O8pqwSLSKYNRck 3Zp9jeSsRtJPan5JEgMH0+7N7o499DyQcbgKgz3BiApUqSsyfjlK8ZugaDfnGS5Shy4O h6tzURfrnKrJoR1iAXoGRMYfcDe+ZW3BnZNixVfbIT7C1sNS4CFMQiEbIbOJYi8OfFmX 5mpjoFjsMBJ2XV2/gQAAcWuz2NOwxGN8b99QD3fs+qiAHBxDonY4d2iIvAHRbNNZeYGL swWeZtpQNfXqODsPi0mu932gyapoF+CDO/VkfCtSfmBrknJyleXUjrEfj54EcilLl3Il k+nw== 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 q14-v6si1520463pll.324.2018.07.03.11.23.50; Tue, 03 Jul 2018 11:24:05 -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 S934543AbeGCSWS (ORCPT + 99 others); Tue, 3 Jul 2018 14:22:18 -0400 Received: from mga17.intel.com ([192.55.52.151]:2614 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934309AbeGCSWQ (ORCPT ); Tue, 3 Jul 2018 14:22:16 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jul 2018 11:22:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,304,1526367600"; d="scan'208";a="242707971" Received: from cdikicix-mobl.ger.corp.intel.com (HELO localhost) ([10.249.254.69]) by fmsmga006.fm.intel.com with ESMTP; 03 Jul 2018 11:22:07 -0700 From: Jarkko Sakkinen To: x86@kernel.org, platform-driver-x86@vger.kernel.org Cc: dave.hansen@intel.com, sean.j.christopherson@intel.com, nhorman@redhat.com, npmccallum@redhat.com, linux-sgx@vger.kernel.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Jarkko Sakkinen , Tom Lendacky , Borislav Petkov , Konrad Rzeszutek Wilk , Greg Kroah-Hartman , Janakarajan Natarajan , David Woodhouse , linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)) Subject: [PATCH v12 03/13] x86/sgx: add SGX definitions to msr-index.h Date: Tue, 3 Jul 2018 21:19:48 +0300 Message-Id: <20180703182118.15024-4-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180703182118.15024-1-jarkko.sakkinen@linux.intel.com> References: <20180703182118.15024-1-jarkko.sakkinen@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Christopherson ENCLS and ENCLU are usable if and only if SGX_ENABLE is set and After SGX is activated the IA32_SGXLEPUBKEYHASHn MSRs are writable if SGX_LC_WR is set and the feature control is locked. SGX related bits in IA32_FEATURE_CONTROL cannot be set before SGX is activated by the pre-boot firmware. SGX activation is triggered by setting bit 0 in the MSR 0x7a. Until SGX is activated, the LE hash MSRs are writable to allow pre-boot firmware to lock down the LE root key with a non-Intel value. Signed-off-by: Sean Christopherson Co-developed-by: Haim Cohen --- arch/x86/include/asm/msr-index.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index fda2114197b3..a7355fb7344f 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -479,6 +479,8 @@ #define FEATURE_CONTROL_LOCKED (1<<0) #define FEATURE_CONTROL_VMXON_ENABLED_INSIDE_SMX (1<<1) #define FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX (1<<2) +#define FEATURE_CONTROL_SGX_ENABLE (1<<18) +#define FEATURE_CONTROL_SGX_LE_WR (1<<17) #define FEATURE_CONTROL_LMCE (1<<20) #define MSR_IA32_APICBASE 0x0000001b @@ -545,6 +547,12 @@ #define PACKAGE_THERM_INT_LOW_ENABLE (1 << 1) #define PACKAGE_THERM_INT_PLN_ENABLE (1 << 24) +/* Intel SGX MSRs */ +#define MSR_IA32_SGXLEPUBKEYHASH0 0x0000008C +#define MSR_IA32_SGXLEPUBKEYHASH1 0x0000008D +#define MSR_IA32_SGXLEPUBKEYHASH2 0x0000008E +#define MSR_IA32_SGXLEPUBKEYHASH3 0x0000008F + /* Thermal Thresholds Support */ #define THERM_INT_THRESHOLD0_ENABLE (1 << 15) #define THERM_SHIFT_THRESHOLD0 8 -- 2.17.1