Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp758428imm; Wed, 20 Jun 2018 06:13:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJVS+7lEl3p8Dlk8xvg6uVMPCx1aquM1pzxOYYPqIwK9c1mSYEDCeBJp8AOA7AQbANJFwlP X-Received: by 2002:a63:91c8:: with SMTP id l191-v6mr18896983pge.53.1529500411232; Wed, 20 Jun 2018 06:13:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529500411; cv=none; d=google.com; s=arc-20160816; b=TWk8/ZwLIcR0+xxAEp/v0HGdS28EmjydU1Z+xPuNzl9Wrn19v6XxIzyZK8cCoZ9CoJ IBag0JdqzCEmWWCxTIz2oiF1yQBxRGJB1vGSmSzbN1O1+i6Phva/yZy3eYpxEnTEKrpd xw2LJIFCvZUVRBWD+o2MrmsCBqXdrHzcDYSEamQ1MVplU+W+RUSqYekzNvF8ArUhDhxr cDP3CltQqIKhEesiqItrc7E5LtupQRcUOVrlvZTa0Uq6B0RZKB7kgOvPLozjE7KdrmwU g4ClApW7mWuTJIy/UrYiVPPZBfTbsGgTgtYKc2uMvaAZpzmLCsvbyTPCuvIRXbhwhLUF r31A== 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:date:cc:to:from:subject:message-id :arc-authentication-results; bh=vH9kud2QYFK52HN6Y16PkoKgmCPp7u1mcRTQNJu5vps=; b=ee8BPyjur/GvRRpdyJR/pfN5p8dlAoaFAUsM0KhteT1QnS/+n1xrRqvQdDyu+vG561 9ubJdSAZYV10obGekadhi1YJjK+1Gok5rZYMgq2Oxm5gD97ve5A8cjT/kiMivzJugfSG gihCUyOGJJrLPZYLrrid0uB+hM6Ir15LcqrWl58orZeU7i0DuzbrnvA+Y2OJmd1LpsGz KY8nTpStoZrxItLHPLiVtsEjSeDfihVnLAeq1GlHIRLpaWQt7T0L/gy3wDSAGrZ/ghjh fy5sZPBGA8zh81Af3KHFzY/ZcabW7CwRVklIcXZkF4dDQtH8PIEw0JA9s/PBZP3Iukxd F4Nw== 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 v26-v6si1440871pge.323.2018.06.20.06.13.16; Wed, 20 Jun 2018 06:13:31 -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 S1752951AbeFTNMh (ORCPT + 99 others); Wed, 20 Jun 2018 09:12:37 -0400 Received: from mga12.intel.com ([192.55.52.136]:39366 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750852AbeFTNMf (ORCPT ); Wed, 20 Jun 2018 09:12:35 -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 fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jun 2018 06:12:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,247,1526367600"; d="scan'208";a="66176686" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.135]) by orsmga001.jf.intel.com with ESMTP; 20 Jun 2018 06:12:35 -0700 Message-ID: <1529500355.9779.51.camel@intel.com> Subject: Re: [PATCH v11 08/13] x86, sgx: added ENCLS wrappers From: Sean Christopherson To: Jarkko Sakkinen , x86@kernel.org, platform-driver-x86@vger.kernel.org Cc: dave.hansen@intel.com, nhorman@redhat.com, npmccallum@redhat.com, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:INTEL SGX" Date: Wed, 20 Jun 2018 06:12:35 -0700 In-Reply-To: <20180608171216.26521-9-jarkko.sakkinen@linux.intel.com> References: <20180608171216.26521-1-jarkko.sakkinen@linux.intel.com> <20180608171216.26521-9-jarkko.sakkinen@linux.intel.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.5.2-0ubuntu3.2 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 On Fri, 2018-06-08 at 19:09 +0200, Jarkko Sakkinen wrote: > This commit adds wrappers for Intel(R) SGX ENCLS opcode functionality. > > Signed-off-by: Jarkko Sakkinen > --- >  arch/x86/include/asm/sgx.h | 198 +++++++++++++++++++++++++++++++++++++ >  1 file changed, 198 insertions(+) > > diff --git a/arch/x86/include/asm/sgx.h b/arch/x86/include/asm/sgx.h > index fa3e6e0eb8af..a2f727f85b91 100644 > --- a/arch/x86/include/asm/sgx.h > +++ b/arch/x86/include/asm/sgx.h > @@ -10,6 +10,10 @@ >  #ifndef _ASM_X86_SGX_H >  #define _ASM_X86_SGX_H >   > +#include > +#include > +#include > +#include >  #include >   >  #define SGX_CPUID 0x12 > @@ -20,6 +24,200 @@ enum sgx_cpuid { >   SGX_CPUID_EPC_BANKS = 2, >  }; >   > +enum sgx_commands { This should be something like "sgx_encls_leafs" and probably moved to sgx_arch.h (as Dave alluded to, these are architectural values). "sgx_commands" is not accurate (they're only the cpl0 "commands") and will have collision issues in the future, e.g. with the ENCLV instruction and its leafs. > + ECREATE = 0x0, > + EADD = 0x1, > + EINIT = 0x2, > + EREMOVE = 0x3, > + EDGBRD = 0x4, > + EDGBWR = 0x5, > + EEXTEND = 0x6, Even though it's not used in the code (yet...), I think ELDB, leaf 0x7, should be defined here for completeness. > + ELDU = 0x8, > + EBLOCK = 0x9, > + EPA = 0xA, > + EWB = 0xB, > + ETRACK = 0xC, > + EAUG = 0xD, > + EMODPR = 0xE, > + EMODT = 0xF, > +};