From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jarkko Sakkinen Subject: Re: [PATCH v17 06/23] x86/cpu/intel: Detect SGX support and update caps appropriately Date: Sun, 18 Nov 2018 10:37:28 +0200 Message-ID: <20181118083728.GM5897@linux.intel.com> References: <20181116010412.23967-1-jarkko.sakkinen@linux.intel.com> <20181116010412.23967-7-jarkko.sakkinen@linux.intel.com> <71af0361-3296-42a2-d76f-4f1e26e676b8@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <71af0361-3296-42a2-d76f-4f1e26e676b8@intel.com> Sender: linux-kernel-owner@vger.kernel.org To: Dave Hansen Cc: x86@kernel.org, platform-driver-x86@vger.kernel.org, linux-sgx@vger.kernel.org, sean.j.christopherson@intel.com, nhorman@redhat.com, npmccallum@redhat.com, serge.ayoun@intel.com, shay.katz-zamir@intel.com, haitao.huang@linux.intel.com, andriy.shevchenko@linux.intel.com, tglx@linutronix.de, kai.svahn@intel.com, mark.shanahan@intel.com, luto@amacapital.net, Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Konrad Rzeszutek Wilk , David Woodhouse , "Kirill A. Shutemov" , David Wang , "Levin, Alexander (Sasha Levin)" , Jia Zhang , open list:X86 ARCHITECTURE (32-BIT AND 64-BIT) List-Id: platform-driver-x86.vger.kernel.org On Fri, Nov 16, 2018 at 03:32:36PM -0800, Dave Hansen wrote: > On 11/15/18 5:01 PM, Jarkko Sakkinen wrote: > > +static void detect_sgx(struct cpuinfo_x86 *c) > > +{ > > + unsigned long long fc; > > + > > + rdmsrl(MSR_IA32_FEATURE_CONTROL, fc); > > + if (!(fc & FEATURE_CONTROL_LOCKED)) { > > + pr_err_once("sgx: IA32_FEATURE_CONTROL MSR is not locked\n"); > > + goto out_unsupported; > > + } > > This needs a check against the config option somewhere so the compiler > can toss it in its entirety if SGX is config'd out. Certainly. I'll flag it in the next version. /Jarkko