Received: by 2002:a4a:301c:0:0:0:0:0 with SMTP id q28-v6csp901409oof; Tue, 25 Sep 2018 06:12:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV60Xle3F+/P/zwvGeehLmPPdeL5pxUiILwbjlRPCyiG3BknFMr9K1++mMQZ/61koV94nfdHl X-Received: by 2002:a17:902:aa8f:: with SMTP id d15-v6mr1230199plr.64.1537881166034; Tue, 25 Sep 2018 06:12:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537881166; cv=none; d=google.com; s=arc-20160816; b=Ixr3IdRM6jllKHcwtGjFTaADFC8bbyNpFpYz96tuyEeoj4nDNI3VbNQQZLgVfBYtAT r3cfLKa3rzI0tBbdPGWSxTQWHLDOECNvjpLlAktdzN9vJZquqMvBmtlyCDbod7J8ITXo XLgBfdFcFp8kVTvGpYCJMoCtsxke3zN6KdQT4aJ6HRakG1q8TOmR34s4TNatxUftl8d8 5uFEmXdnSoHTTVUOa2WEtujUWRrkmQRXb4NgSOQf8/60ciH+9oFezzJ/JIz9SHzmi34j YT7IbFrSZNy0CI9d1VVo7YeBBwLHjjwAQlpWfEDkCK4mDcWFbX5iKPbRxXn14D7QpUni je4w== 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=1CNSBl5JooCU55x7I9/ewFJHJzsETKOpHVTU8M235Y4=; b=X2vDb5G4+yMCSjj4TTP+r/DgJyN9AdHDGqVjUIJEUtRO7pBnTbfQdZFPI1Zt2Hke4U ggIANe+a5WcpNDj+ly8oqD5uzI2SwadFuE17GmKTMcpO7+ycA9SSwrATvPIRwEBZ0uZU fDEpDGQbr097FjX27X7ctaoLvipnDpzBA/yJgzVlXMMv2BVi8dzRilWLA10QbuO++QrT /+bFs/w1J1l5by72QnG7P6AKFYMEivI+6vUrKvg+qZRthhLDHQ3vzhfmDb1aSC/aImsT de4OXt9EIShUMz55mmBwNSo655C0EMsm7cWHVdGBXltghjyDgjZfDz66fX6nylJrm3q+ 4hig== 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 72-v6si2295913pfq.6.2018.09.25.06.12.29; Tue, 25 Sep 2018 06:12:45 -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 S1729227AbeIYTTv (ORCPT + 99 others); Tue, 25 Sep 2018 15:19:51 -0400 Received: from mga14.intel.com ([192.55.52.115]:53075 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726934AbeIYTTt (ORCPT ); Tue, 25 Sep 2018 15:19:49 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Sep 2018 06:12:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,302,1534834800"; d="scan'208";a="93546705" Received: from thomasvo-mobl2.ger.corp.intel.com (HELO localhost) ([10.252.53.212]) by orsmga001.jf.intel.com with ESMTP; 25 Sep 2018 06:10:11 -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, serge.ayoun@intel.com, shay.katz-zamir@intel.com, linux-sgx@vger.kernel.org, andriy.shevchenko@linux.intel.com, Haim Cohen , Jarkko Sakkinen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Konrad Rzeszutek Wilk , Tom Lendacky , Paolo Bonzini , Greg Kroah-Hartman , Matt Turner , Janakarajan Natarajan , David Woodhouse , Andy Lutomirski , Pavel Tatashin , linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)) Subject: [PATCH v14 05/19] x86/msr: Add SGX definitions to msr-index.h Date: Tue, 25 Sep 2018 16:06:42 +0300 Message-Id: <20180925130845.9962-6-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180925130845.9962-1-jarkko.sakkinen@linux.intel.com> References: <20180925130845.9962-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 Signed-off-by: Haim Cohen Signed-off-by: Jarkko Sakkinen --- arch/x86/include/asm/msr-index.h | 8 ++++++++ arch/x86/kernel/cpu/common.c | 1 + 2 files changed, 9 insertions(+) diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index 4731f0cf97c5..44d7b68e7f52 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -486,6 +486,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 @@ -552,6 +554,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 diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 44c4ef3d989b..aedfd9657a6c 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -52,6 +52,7 @@ #include #include #include +#include #ifdef CONFIG_X86_LOCAL_APIC #include -- 2.17.1