From patchwork Tue Apr 4 07:29:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai Huang X-Patchwork-Id: 9660897 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 06F7F6032D for ; Tue, 4 Apr 2017 07:29:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E466728285 for ; Tue, 4 Apr 2017 07:29:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D90B028488; Tue, 4 Apr 2017 07:29:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0016B28285 for ; Tue, 4 Apr 2017 07:29:51 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E5F172193930D; Tue, 4 Apr 2017 00:29:51 -0700 (PDT) X-Original-To: intel-sgx-kernel-dev@lists.01.org Delivered-To: intel-sgx-kernel-dev@lists.01.org Received: from mail-pg0-x241.google.com (mail-pg0-x241.google.com [IPv6:2607:f8b0:400e:c05::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 22A882193930D for ; Tue, 4 Apr 2017 00:29:51 -0700 (PDT) Received: by mail-pg0-x241.google.com with SMTP id 79so35407726pgf.0 for ; Tue, 04 Apr 2017 00:29:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=z/0hh8MgUKWP2FAlDE1LVkQmAiZdrpakoD9OaST7X0g=; b=e+WQ+QF9j3HCwgP6GLD5uOX7acqImtwDtFB5jXtsdC+HWY4vHwE9vK/EIzkUeph3af l52nVQoyqsyrZ5A7qugRo0bS2KJgo5kwHtFlKNVc8kwX848jNgDPI3loUyjcdIqg649i MnPoUOCHFj36AvhyV05XQpQ0IUv7EmIcq5lt08GZNT6roLYYMTnxQTcql9Yl7p28Ft/P PVRjb0UjY/7mCYbmAtzAiWiCh3HjLcQjWgFnmuZ2QK8j0wbmPtSvPv6Y0+zG30ozwM7T uXHd3pi5pG0OqVRebgGRTX5bBSugzveI/p26LRfbl3GrP/U+uOSeCOxV+4BwsJxDanap 1y/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=z/0hh8MgUKWP2FAlDE1LVkQmAiZdrpakoD9OaST7X0g=; b=PQZBaJO0vWmuhIWdkICPmM9wRBIISUa1cwAXhih3XJWTsuaDUB/Ud/SetpNMXAsizw OIQkQf7tOrj4F5umNqGhxxzccjNCcVr+dYo3YaNcFf7GYVfJqJkE5kg4ZYZ3o/jMUH+q OGDuZS20Pso3Ky/696CfzvDXPSjM2Eoy/MH8VIHt8gG5VGLnApit4VhhVvFndABTWOBV 7qW0G8a3j8okP46dQ5RFcTvRsDMOmsMZiSTLUAEBrr0eE98Q/XZqdtodySXXLtgzc5br Kds8hjkD/CBQUelByF/Wc0QIOVtu3sS+Zg2uF8O7YarGWhviPIP6Cbvbst+AnxG8AR8D h9Cw== X-Gm-Message-State: AFeK/H0hoOXb/AwiyFb7ZubP+xhMd2LMKshd8WM+FNq4d/eGP2V607FXLX1NPq7sElvxHw== X-Received: by 10.84.176.100 with SMTP id u91mr27360573plb.112.1491290990627; Tue, 04 Apr 2017 00:29:50 -0700 (PDT) Received: from localhost.localdomain (118-92-235-112.dsl.dyn.ihug.co.nz. [118.92.235.112]) by smtp.gmail.com with ESMTPSA id y7sm29724831pfk.93.2017.04.04.00.29.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Apr 2017 00:29:50 -0700 (PDT) From: Kai Huang X-Google-Original-From: Kai Huang To: intel-sgx-kernel-dev@lists.01.org, jarkko.sakkinen@linux.intel.com Date: Tue, 4 Apr 2017 19:29:32 +1200 Message-Id: <20170404072938.4800-2-kai.huang@linux.intel.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170404072938.4800-1-kai.huang@linux.intel.com> References: <20170404072938.4800-1-kai.huang@linux.intel.com> Subject: [intel-sgx-kernel-dev] [PATCH 1/7] intel_sgx: move ENCLS error codes from uapi/sgx.h to sgx.h X-BeenThere: intel-sgx-kernel-dev@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Project: Intel® Software Guard Extensions for Linux*: https://01.org/intel-software-guard-extensions" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-sgx-kernel-dev-bounces@lists.01.org Sender: "intel-sgx-kernel-dev" X-Virus-Scanned: ClamAV using ClamSMTP KVM code needs to use ENCLS error codes as well, but it makes little sense for KVM to include asm/uapi/sgx.h as it is for user application. Therefore move ENCLS error codes to asm/sgx.h and make asm/uapi/sgx.h include it. Probably a better way is to define new error code for user application, instead of just using ENCLS error code, but in this case SDK needs to be aligned as well. Signed-off-by: Kai Huang --- arch/x86/include/asm/sgx.h | 25 +++++++++++++++++++++++++ arch/x86/include/uapi/asm/sgx.h | 26 +------------------------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/arch/x86/include/asm/sgx.h b/arch/x86/include/asm/sgx.h index 378ad77..190e3ed 100644 --- a/arch/x86/include/asm/sgx.h +++ b/arch/x86/include/asm/sgx.h @@ -185,6 +185,31 @@ enum { EMODT = 0xF, }; +/* SGX leaf instruction return values */ +#define SGX_SUCCESS 0 +#define SGX_INVALID_SIG_STRUCT 1 +#define SGX_INVALID_ATTRIBUTE 2 +#define SGX_BLKSTATE 3 +#define SGX_INVALID_MEASUREMENT 4 +#define SGX_NOTBLOCKABLE 5 +#define SGX_PG_INVLD 6 +#define SGX_LOCKFAIL 7 +#define SGX_INVALID_SIGNATURE 8 +#define SGX_MAC_COMPARE_FAIL 9 +#define SGX_PAGE_NOT_BLOCKED 10 +#define SGX_NOT_TRACKED 11 +#define SGX_VA_SLOT_OCCUPIED 12 +#define SGX_CHILD_PRESENT 13 +#define SGX_ENCLAVE_ACT 14 +#define SGX_ENTRYEPOCH_LOCKED 15 +#define SGX_INVALID_LICENSE 16 +#define SGX_PREV_TRK_INCMPL 17 +#define SGX_PG_IS_SECS 18 +#define SGX_INVALID_CPUSVN 32 +#define SGX_INVALID_ISVSVN 64 +#define SGX_UNMASKED_EVENT 128 +#define SGX_INVALID_KEYNAME 256 + #define __encls_ret(rax, rbx, rcx, rdx) \ ({ \ int ret; \ diff --git a/arch/x86/include/uapi/asm/sgx.h b/arch/x86/include/uapi/asm/sgx.h index 503f6be..b5bd5c3 100644 --- a/arch/x86/include/uapi/asm/sgx.h +++ b/arch/x86/include/uapi/asm/sgx.h @@ -62,6 +62,7 @@ #include #include +#include #define SGX_MAGIC 0xA4 @@ -72,31 +73,6 @@ #define SGX_IOC_ENCLAVE_INIT \ _IOW(SGX_MAGIC, 0x02, struct sgx_enclave_init) -/* SGX leaf instruction return values */ -#define SGX_SUCCESS 0 -#define SGX_INVALID_SIG_STRUCT 1 -#define SGX_INVALID_ATTRIBUTE 2 -#define SGX_BLKSTATE 3 -#define SGX_INVALID_MEASUREMENT 4 -#define SGX_NOTBLOCKABLE 5 -#define SGX_PG_INVLD 6 -#define SGX_LOCKFAIL 7 -#define SGX_INVALID_SIGNATURE 8 -#define SGX_MAC_COMPARE_FAIL 9 -#define SGX_PAGE_NOT_BLOCKED 10 -#define SGX_NOT_TRACKED 11 -#define SGX_VA_SLOT_OCCUPIED 12 -#define SGX_CHILD_PRESENT 13 -#define SGX_ENCLAVE_ACT 14 -#define SGX_ENTRYEPOCH_LOCKED 15 -#define SGX_INVALID_LICENSE 16 -#define SGX_PREV_TRK_INCMPL 17 -#define SGX_PG_IS_SECS 18 -#define SGX_INVALID_CPUSVN 32 -#define SGX_INVALID_ISVSVN 64 -#define SGX_UNMASKED_EVENT 128 -#define SGX_INVALID_KEYNAME 256 - /* IOCTL return values */ #define SGX_POWER_LOST_ENCLAVE 0x40000000 #define SGX_LE_ROLLBACK 0x40000001