Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp636984imu; Mon, 5 Nov 2018 06:36:38 -0800 (PST) X-Google-Smtp-Source: AJdET5c5gfqRfWPTTZZECRt8kSRIlcX0p+hrjKXoMrKvb83fZI1J9bUfI9fMCi2CmXBq4heOfC3x X-Received: by 2002:a63:4d:: with SMTP id 74mr18066213pga.248.1541428598756; Mon, 05 Nov 2018 06:36:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541428598; cv=none; d=google.com; s=arc-20160816; b=RQEO3TYkdscjqq286xyADIsIb50MxxbhyB4VUNOnL98VlljY+y3O61aQevMOZdunbY a8EzUH6uTBrAxxtPoEBqarZ7/+6SXyrpKB0OlrSkquLGLDmz2tOOHLKk76ScSLaDvyqg szNvY0uyA1YwyB432VNTdVmCtHZdaKkedKU7nljbO4KMThIzEU22PMZUkmVURYRreRPL 7gxkvSc67FO6TZ8s1CWy2CDHK07IUVMn4CzJirS22XA8Su4wiI322+blrVt0K7Hl1kn7 xrqtBEJmhpe9Zj09qA6aWZEJcI28cJ5F8mB1kH6TBtVzUeARXIFjVJVVaLMBOkFF8Wt3 ueIg== 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; bh=l7aVowPMEAThdhY050urQfQPfN55UmbR+astYW7bm70=; b=Nc01911kxwxEy8XuTzcKJEQapGhbAtN+3nt2YjpVLjIzUW1yr/kF0NX4BATbKgKJGk nfmZLwTGk58aNNyypHyPU7ZvKcUN/uhamj+aro+m+oKx3zxPHMgruLs5HODwN98+1rju FMNv9ZMR17+1mq140Fh+KmMwJqyjt90tErxTVscLwRtlLMr5bEvBWMFqHhYPuS5Us7t6 sHXLmriabFRYMCGdrSN0CtYZwql3FEmmSTl8o7cfL2VPv2Km0P1KQjadi9rrFZ3u7teZ pirJG8vZh8qJX5EdIAMhCYheHyzc4eJvSA5obJpVIWQv5nu0qCoryu4T7W0NvWF4TPZr 06Wg== 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 1-v6si16676681plj.53.2018.11.05.06.36.18; Mon, 05 Nov 2018 06:36:38 -0800 (PST) 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 S1729431AbeKEXzz (ORCPT + 99 others); Mon, 5 Nov 2018 18:55:55 -0500 Received: from mga01.intel.com ([192.55.52.88]:55645 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726173AbeKEXzz (ORCPT ); Mon, 5 Nov 2018 18:55:55 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Nov 2018 06:35:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,468,1534834800"; d="scan'208";a="101634418" Received: from fhoeg-mobl.ger.corp.intel.com (HELO localhost) ([10.249.254.66]) by fmsmga002.fm.intel.com with ESMTP; 05 Nov 2018 06:35:48 -0800 Date: Mon, 5 Nov 2018 16:35:46 +0200 From: Jarkko Sakkinen To: Andy Shevchenko Cc: "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Platform Driver , linux-sgx@vger.kernel.org, Dave Hansen , sean.j.christopherson@intel.com, nhorman@redhat.com, npmccallum@redhat.com, serge.ayoun@intel.com, shay.katz-zamir@intel.com, haitao.huang@intel.com, mark.shanahan@intel.com, Andy Shevchenko , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Linux Kernel Mailing List Subject: Re: [PATCH v15 11/23] x86/sgx: Add definitions for SGX's CPUID leaf and variable sub-leafs Message-ID: <20181105143415.GA2798@linux.intel.com> References: <20181102231320.29164-1-jarkko.sakkinen@linux.intel.com> <20181102231320.29164-12-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 03, 2018 at 03:11:39PM +0200, Andy Shevchenko wrote: > On Sat, Nov 3, 2018 at 1:16 AM Jarkko Sakkinen > wrote: > > > > SGX defines its own CPUID leaf, 0x12, along with a variable number of > > sub-leafs. Sub-leafs 0 and 1 are always available if SGX is supported > > and enumerate various SGX features, e.g. instruction sets and enclave > > capabilities. Sub-leafs 2+ are variable, both in their existence and > > in what they enumerate. Bits 3:0 of EAX report the sub-leaf type, > > with the remaining bits in EAX, EBX, ECX and EDX being type-specific. > > Currently, the only known sub-leaf type enumerates an EPC section. An > > EPC section is simply a range of EPC memory available to software. > > The "list" of varaible SGX sub-leafs is NULL-terminated, i.e. software > > is expected to query CPUID until an invalid sub-leaf is encountered. > > > + SGX_CPUID_SUB_LEAF_TYPE_MASK = 0xF, > > GENMASK() if it suits here? > > P.S. Btw, BIT() and GENMASK() macros are now in a separate header, > i.e. linux/bits.h, perhaps you might need to revisit code to include > it explicitly Agreed. I would also think that is should be renamed simply as SGX_CPUID_SUBLEAF_MASK. /Jarkko