Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp574891imd; Sat, 3 Nov 2018 06:13:59 -0700 (PDT) X-Google-Smtp-Source: AJdET5cIP/kB0zXg6e8Nu1tMydin0P6K9SQQ7JVlNynQUEAPguEzNHcCXKZ2jKKTCXQjf8uy+C/K X-Received: by 2002:a17:902:7613:: with SMTP id k19-v6mr15105502pll.98.1541250839007; Sat, 03 Nov 2018 06:13:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541250838; cv=none; d=google.com; s=arc-20160816; b=kMNZSqj386x+CZMEsv6SZCi/bdP+tpZQQOG8YM8JL1NINeHHHyu87KlhNl3BY6Je65 6IOTjUlBPuAfrnZenuAtxOabvtnol8LQaWh83f+R92UlCypl/JNBSJpquaSR2H7+ufJf bcP4aKexE+P7R98JYrwilUjq3iDa4ywv+mXorBvX1nTW7FjEws3maZ47CrSYjkYdubtk 6JeazNIeIPeMDFKdQUq5Z53GyYCoG3k1yakdI41HEk4hi8NCE+qAthnTSJzwH1cvEdub mu0I/kFrX4AYAP8C4tHtYubUJ+rXgUyRh2yF8YNHUfa81QtWFRhzc2v3H7xgy+Wg3nR7 EsRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=3dzFCWaGvY5KFjWHvqsJVWBcDuapQeVNu86FFOkK8IA=; b=fDrJI3xSufaN/wH6GYZt1mEPFYYRKPpYsaYjkJaAmDGUpMsrlEawn3QRvWiaxOir0p /bAwAC6tXxeIJk2D2keVthIZcPEddkAwWxfBc3AqLm/cx5Pbdg3Ckk6Xpr4pradJn8Rt NXkpULH6CHo/a4CO3UxL7cA1XPGeoB5L8RMLlR9vsYV27+fZuuIQokg/bjJu3+BfQ75A 8Vo4sPa8+/5fEPmAhhr3Aaoe6us2HfbJcf3EyuCWwykCjFt7LPmZg7aQlnzJJQmhzHUr wZtH3vdpf7CQLzMUAPTuAK0vhPAk7AEXbps/Ln40emO/8QdgvawYs9PwDSgSasQSDgkk a/6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BYItpg61; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d187-v6si6905109pfa.68.2018.11.03.06.13.43; Sat, 03 Nov 2018 06:13:58 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BYItpg61; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728625AbeKCWXK (ORCPT + 99 others); Sat, 3 Nov 2018 18:23:10 -0400 Received: from mail-qk1-f193.google.com ([209.85.222.193]:37167 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725900AbeKCWXJ (ORCPT ); Sat, 3 Nov 2018 18:23:09 -0400 Received: by mail-qk1-f193.google.com with SMTP id 131so7537454qkd.4; Sat, 03 Nov 2018 06:11:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3dzFCWaGvY5KFjWHvqsJVWBcDuapQeVNu86FFOkK8IA=; b=BYItpg61k3VralrqBQ59UKQlUW2o8WxXX1UGYyAF4huIgePXs6JGu+DmYI5NkrM35e Z9Bk873KIQiTqJEzZ1UmlscHlgkUTgzlnJFVS9I+z6FfalUA9Ocg7/CVlgzjx4jC/zYv Xc7IH5Gj73FHH+SmMerLsRG7bcUEofhfOdI+oZGCrHl/AzFJKM0NnRFMO+p2fJEKpAYK 13OLo6prRIRI9ld5SZd2cznEjUy+HCGpkA4DQdz+RzIal3wOFSGkmsJSNblcQGCOwDBh pfWARxIKfewoTsFJU+i2naJb8946DFe/OT+pfHis3SgMRJz/41UNANpaa5qYAkkWIP/u ZWvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3dzFCWaGvY5KFjWHvqsJVWBcDuapQeVNu86FFOkK8IA=; b=QHHf1o4Yhq7tLRd3PAdqvzJSEFeE6/+Lo+cYVeCwpcG0/N6SNfmUlFNesrzsAod9Aw 7QgfmnxufUm0p8SGZKLRogt6GD4rMo5bAGQz7T7t3kCBZ1MYYSnBYZDika4yuIbTPvLL rBDIp2j+y8LLiG4I6InrtT+kgGWNmzMWD3x/ZMgufOJU5QUGkNeichx0tQt1Wr7rWQaT caThF3pfeTyv1ltCKWHUhkOsWi8rFFhXll1s5c18fBj7jJtTVPczpAQcEBYazY49y364 IyVnlo5fleIWZWI5QmZPreU4/xZYwe3ZIONPyvsmU5bZKTcdBwhxg7Yk0MmSaGDuCJxe +AyQ== X-Gm-Message-State: AGRZ1gIJY1EXMjvlxFY+HFdz9ji9Wg713xTNgRv1LveXH2jG6jsxzaSR TN2XJp/4jxCKS8qXEvqAhgs4BDy7+orp3UkjvZI= X-Received: by 2002:aed:2d24:: with SMTP id h33mr7316208qtd.373.1541250710755; Sat, 03 Nov 2018 06:11:50 -0700 (PDT) MIME-Version: 1.0 References: <20181102231320.29164-1-jarkko.sakkinen@linux.intel.com> <20181102231320.29164-12-jarkko.sakkinen@linux.intel.com> In-Reply-To: <20181102231320.29164-12-jarkko.sakkinen@linux.intel.com> From: Andy Shevchenko Date: Sat, 3 Nov 2018 15:11:39 +0200 Message-ID: Subject: Re: [PATCH v15 11/23] x86/sgx: Add definitions for SGX's CPUID leaf and variable sub-leafs To: Jarkko Sakkinen 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- With Best Regards, Andy Shevchenko