Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp579106imd; Sat, 3 Nov 2018 06:18:30 -0700 (PDT) X-Google-Smtp-Source: AJdET5cOgfFUtWUGNWbvsL9nAbi2MhC877SVDX3s0I787E72a5Svw3bt0IAKUEap49aUqmsnAJBR X-Received: by 2002:a17:902:16a4:: with SMTP id h33-v6mr15223715plh.141.1541251110310; Sat, 03 Nov 2018 06:18:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541251110; cv=none; d=google.com; s=arc-20160816; b=J4ET289ktt1dO5CD3yxoXEq6V0eBaJpEry2Bl4Wve+dskcEbD9JBVJegqRm0xb51vL gW4uZgJYEQs23aYEqAsrrIVLBsS7wlY5G+CJdHw4ipk0i8w1396yGA4BmZ26x0O3u9sc ad40IyoK7CclQzTbCjJVjj+4r4T1MntGcyaRojCW8szUkSSuo4TpdybJRMSMUOLVfk6z 0LPVoDyb4Ubv5C4Zi4i8ZYZqIBao4mj/6/MJr6duO4UUJYco2f0xtBR70PDLm/6jbZ+X b8o2NOCDr8K41nhfU9GArrFAOs/JvgFiHN5Y0nkstmzGiCAZc80chctwsR+YR8KohSeh NajQ== 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=VDmxNKwMic+2kVqQsqB83TKH0HDMXiz95Fgq48fOd2Y=; b=VdBJPHhWKk90uvxONExwsEvek1+CYg4gsfzAVhdrBr51Bor0UV5i2aIkVkV+wTr/Th /a2G6OwQj66MwziSO4voHvnuyw0IEheVpQBX51RGPX6P+VXxXB6C0/0vHZ3UIg8GShdF DUwQWOFOcpFhk0bZ8rasj/hXkWYW742VnaXYFlaol02egemxqgs0swgKKe/akoZsUtOt UFB08phZ/FcAinzfqlOtABHD6zE1xU0hxNesCdjcwxCZ+Kg0jraisl6s23wWRIFTRBiE xVBI4q8HlW4lv6LUmXZgf35y0U0IDUUr8m5tNJQIshr5KDa6KHKbRhyJtvz88y+Yv32m xh9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oamehlBo; 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 u9-v6si36380207pls.150.2018.11.03.06.18.15; Sat, 03 Nov 2018 06:18:30 -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=oamehlBo; 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 S1728667AbeKCW3G (ORCPT + 99 others); Sat, 3 Nov 2018 18:29:06 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:46350 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728425AbeKCW3G (ORCPT ); Sat, 3 Nov 2018 18:29:06 -0400 Received: by mail-qk1-f196.google.com with SMTP id q1so7466523qkf.13; Sat, 03 Nov 2018 06:17:46 -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=VDmxNKwMic+2kVqQsqB83TKH0HDMXiz95Fgq48fOd2Y=; b=oamehlBogbsVdDrDRuay0XGUI3c/fkk6vfyvd9yS8h0C9L79f1pBBTIrHOGNYB+vZR a4M8NGy9soEkXH+sWWJT09bUVkW3XmvweE+mQjhg3cY97uPGY/Qdm/q1s2KHGqdHaaXB GlHFR3B+18F82rwdzCENMGQF5X7Yq45nSGbppQbjj49zIsq/jj5CX/uf4/HQV7R7boo1 zuJVaUCEZQ4Odo/oqfP/bjEqn4IMLEKsM9ecBB6tol3iTp3d5RjodbLROF2soFoZ9KcC bXkBd4Mpka9xiZSCnPELNr4DPw13z5dtOJ0/GxvHh8V5QSo5zuKHrVRZPM6mckbMuXVw eP9A== 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=VDmxNKwMic+2kVqQsqB83TKH0HDMXiz95Fgq48fOd2Y=; b=dRHlGW7pLw3/LhEE88/9pt9eKOUyINEIQSLoA/QWX+qTIEaQ7kN2xAwYuFetDVLvD1 8Yw/ywZAxK7JN1HtZr5tpmv0LVP/dDT2c+S03mmOIaug/xceRk0c+vNdEebzryjeFxMg RExKXaZawF1PJLOp4t3aVnaOjjSmuCPJ8zpXMrxDbeKfCc+HN8LCsJjXgDJD7aecpxZ4 mo2u+6HY55iJgx5TtrXujyJL8zeGbw6TQi2Mxydf+b5Pmw3Qu3TwFPO3PmExbqihUFEm tKwiYwwTZNlEwUuTF788QjaaDUmpukUSRsjeYdrJUZ1kKJ1M5RYq/E+DgCYUVweFPcu7 NaKA== X-Gm-Message-State: AGRZ1gJd14oZ8ZBww6n45aYRpDEb/+qf+TARAUCpKPl1b3Jr09KfHRf/ N3bKeEsdJ4V7i9I2jXrjoBU4zBBJTer5felXNOE= X-Received: by 2002:a0c:e202:: with SMTP id q2mr14091297qvl.180.1541251066244; Sat, 03 Nov 2018 06:17:46 -0700 (PDT) MIME-Version: 1.0 References: <20181102231320.29164-1-jarkko.sakkinen@linux.intel.com> <20181102231320.29164-16-jarkko.sakkinen@linux.intel.com> In-Reply-To: <20181102231320.29164-16-jarkko.sakkinen@linux.intel.com> From: Andy Shevchenko Date: Sat, 3 Nov 2018 15:17:35 +0200 Message-ID: Subject: Re: [PATCH v15 15/23] x86/sgx: Add wrappers for ENCLS leaf functions 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" , suresh.b.siddha@intel.com, 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:18 AM Jarkko Sakkinen wrote: > > ENCLS is an umbrella instruction for a variety of cpl0 SGX functions. > The ENCLS function that is executed is specified in EAX, with each > function potentially having more leaf-specific operands beyond EAX. > ENCLS introduces its own (positive value) error codes that (some) > leafs use to return failure information in EAX. Leafs that return > an error code also modify RFLAGS. And finally, ENCLS generates > ENCLS-specific non-fatal #GPs and #PFs, i.e. a bug-free kernel may > encounter faults on ENCLS that must be handled gracefully. > > Because of the complexity involved in encoding ENCLS and handling its > assortment of failure paths, executing any given leaf is not a simple > matter of emitting ENCLS. > > To enable adding support for ENCLS leafs with minimal fuss, add a > two-layer macro system along with an encoding scheme to allow wrappers > to return trap numbers along ENCLS-specific error codes. The bottom > layer of the macro system splits between the leafs that return an > error code and those that do not. The second layer generates the > correct input/output annotations based on the number of operands for > each leaf function. > +/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */ > +/** I dunno if kernel-doc script still complains about this. > + * Copyright(c) 2016-18 Intel Corporation. > + */ -- With Best Regards, Andy Shevchenko