From patchwork Sun Jul 9 08:04:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai Huang X-Patchwork-Id: 9831679 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 4D02760318 for ; Sun, 9 Jul 2017 08:08:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41D5527F82 for ; Sun, 9 Jul 2017 08:08:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 362F227F94; Sun, 9 Jul 2017 08:08:18 +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=-3.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A5A4427F82 for ; Sun, 9 Jul 2017 08:08:17 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dU7EH-0004Ns-Ux; Sun, 09 Jul 2017 08:06:09 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dU7EG-0004Nd-JY for xen-devel@lists.xen.org; Sun, 09 Jul 2017 08:06:08 +0000 Received: from [85.158.143.35] by server-11.bemta-6.messagelabs.com id E1/B3-03612-FE3E1695; Sun, 09 Jul 2017 08:06:07 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrHIsWRWlGSWpSXmKPExsVyMfTAEd33jxM jDW7947dY8nExiwOjx9Hdv5kCGKNYM/OS8isSWDOerl7LXHBetOJR+xTmBsaVgl2MXBxCApMY Je48OccG4rAIvGSReP66gwXEkRDoZ5WY1DqHsYuRE8iJk5g97Tc7hF0uMePgLiYQW0hAWaLr2 1F2iFELmSTevf7JCpJgE1CT2LqknQWiwVZiwbkvzCC2iIC0xLXPlxlBGpgFDjJKXJ21DKxBWM Bb4uuGb0ANHEB3qEosXqkFEuYViJf4M+0T1BHyErvaLoKVcwLN/LJ/ATPEETYSv46tZ5rAKLi AkWEVo3pxalFZapGuuV5SUWZ6RkluYmaOrqGBmV5uanFxYnpqTmJSsV5yfu4mRmDIMQDBDsaZ l/0PMUpyMCmJ8or1JkQK8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuDd8igxUkiwKDU9tSItMwcY/ DBpCQ4eJRFe5+lAad7igsTc4sx0iNQpRnuOK1fWfWHi2LB6PZCccmA7kHw14f83JiGWvPy8VC lx3gCQqQIgbRmleXBDYdF6iVFWSpiXEehMIZ6C1KLczBJU+VeM4hyMSsK8N0Cm8GTmlcDtfgV 0FhPQWWx1CSBnlSQipKQaGCddljpRW77sQGrtr4gL4qLKPcrT1qq6Xms+OtN7TiXvpj7B7xNa Hp7Yvyi6LlJi7R+5s70Skc4zm/8/C+m7w3RtEkfvAiP+hz9mC+8VWDWrxuDuBrPUY5Kh9am5i w/tWzaliWO13izp+YtTjiyaptJm9fnw9m0PcpJWGJQZnJE4s96jnqsvdKkSS3FGoqEWc1FxIg C720LI0QIAAA== X-Env-Sender: kaih.linux@gmail.com X-Msg-Ref: server-10.tower-21.messagelabs.com!1499587565!65713550!1 X-Originating-IP: [209.85.192.196] X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50 X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31775 invoked from network); 9 Jul 2017 08:06:07 -0000 Received: from mail-pf0-f196.google.com (HELO mail-pf0-f196.google.com) (209.85.192.196) by server-10.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 9 Jul 2017 08:06:07 -0000 Received: by mail-pf0-f196.google.com with SMTP id c24so10343097pfe.1 for ; Sun, 09 Jul 2017 01:06:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pWEDgqJX2fKtGT1Mvx7QUCQB3EMQNJzk83W2BjUIyQU=; b=AB4OXZKwAtQVaZYxZ1+wCxGiVncBPmLgC379pYcpdRL/uvAIp5ull9HBAUqn3PYB7e s5YvmG3rXFgUC5/kINATiZXYpf3jgJiocIzshDf2glUhmsN1bNmfIeAAC8e4nV4ogbTY eBTT0MaTCXejICpKpKD211/m2qUF+vBxhLgv/HIx7vjTdUzawjHFjpT2472/amvuUY/h pqavoykOFpvJ9QXpL+R5Q+WZkmjPSkQD+EduGw3S//IAjjrSIIe6zrXPmOx4zeVeviyK cFuIv+2IbZm6f2/MUVgDYyeTrZQIur9cGqHeHriTXSKt9KwWh3M2ZKoxQ12wJQyg+Bx7 YYnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pWEDgqJX2fKtGT1Mvx7QUCQB3EMQNJzk83W2BjUIyQU=; b=Lzg4CQ24P5RTDr3YpserhbwVa1pPliRPrHhn0Alrj9/gVhlFNYbqByNVDEKyLe7fp+ JRSTkErp+rOgHEuE03SsF6rtUwC9FLYlGA34c4CqSDegzWiGmJ+y5cTT0rMXB8ovf70H qgMgMbmy6rhLs6LsHAjrBdoQdHGTwEkCFEGjUQMxB4Dwi0iOwwtW02QxcbDOJ/mtPefp PPZsxFGoL3Iue+oVdOFROGlBut5BgWO7JiqrBoZu8r1DwWH0bTLXgL0DnK938atIJiHp jWVHmtPdWxiEIWv1GaH5XZ1kbSjIqlCxT11lCUSqcGpuAoIV+Yq8r41EMomonA6Ss3b+ dmGw== X-Gm-Message-State: AIVw110zsunjOZvXC25TN9PL3k/KuEl0yWhFZFzlviRmcaiYdAAFk4/N 16rldjnUbSIFkygS X-Received: by 10.99.116.2 with SMTP id p2mr9043980pgc.162.1499587565421; Sun, 09 Jul 2017 01:06:05 -0700 (PDT) Received: from localhost.localdomain (118-92-234-57.dsl.dyn.ihug.co.nz. [118.92.234.57]) by smtp.gmail.com with ESMTPSA id k18sm15010002pgf.5.2017.07.09.01.06.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Jul 2017 01:06:04 -0700 (PDT) From: Kai Huang X-Google-Original-From: Kai Huang To: xen-devel@lists.xen.org Date: Sun, 9 Jul 2017 20:04:57 +1200 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: Cc: sstabellini@kernel.org, wei.liu2@citrix.com, George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, tim@xen.org, jbeulich@suse.com Subject: [Xen-devel] [PATCH 01/15] xen: x86: expose SGX to HVM domain in CPU featureset X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Expose SGX in CPU featureset for HVM domain. SGX will not be supported for PV domain, as ENCLS (which SGX driver in guest essentially runs) must run in ring 0, while PV kernel runs in ring 3. Theoretically we can support SGX in PV domain via either emulating #GP caused by ENCLS running in ring 3, or by PV ENCLS but it is really not necessary at this stage. And currently SGX is only exposed to HAP HVM domain (we can add for shadow in the future). SGX Launch Control is also exposed in CPU featureset for HVM domain. SGX Launch Control depends on SGX. Signed-off-by: Kai Huang --- xen/include/public/arch-x86/cpufeatureset.h | 3 ++- xen/tools/gen-cpuid.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h index 97dd3534c5..b6c54e654e 100644 --- a/xen/include/public/arch-x86/cpufeatureset.h +++ b/xen/include/public/arch-x86/cpufeatureset.h @@ -193,7 +193,7 @@ XEN_CPUFEATURE(XSAVES, 4*32+ 3) /*S XSAVES/XRSTORS instructions */ /* Intel-defined CPU features, CPUID level 0x00000007:0.ebx, word 5 */ XEN_CPUFEATURE(FSGSBASE, 5*32+ 0) /*A {RD,WR}{FS,GS}BASE instructions */ XEN_CPUFEATURE(TSC_ADJUST, 5*32+ 1) /*S TSC_ADJUST MSR available */ -XEN_CPUFEATURE(SGX, 5*32+ 2) /* Software Guard extensions */ +XEN_CPUFEATURE(SGX, 5*32+ 2) /*H Intel Software Guard extensions */ XEN_CPUFEATURE(BMI1, 5*32+ 3) /*A 1st bit manipulation extensions */ XEN_CPUFEATURE(HLE, 5*32+ 4) /*A Hardware Lock Elision */ XEN_CPUFEATURE(AVX2, 5*32+ 5) /*A AVX2 instructions */ @@ -229,6 +229,7 @@ XEN_CPUFEATURE(PKU, 6*32+ 3) /*H Protection Keys for Userspace */ XEN_CPUFEATURE(OSPKE, 6*32+ 4) /*! OS Protection Keys Enable */ XEN_CPUFEATURE(AVX512_VPOPCNTDQ, 6*32+14) /*A POPCNT for vectors of DW/QW */ XEN_CPUFEATURE(RDPID, 6*32+22) /*A RDPID instruction */ +XEN_CPUFEATURE(SGX_LAUNCH_CONTROL, 6*32+30) /*H Intel SGX Launch Control */ /* AMD-defined CPU features, CPUID level 0x80000007.edx, word 7 */ XEN_CPUFEATURE(ITSC, 7*32+ 8) /* Invariant TSC */ diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py index 9ec4486f2b..1301eee310 100755 --- a/xen/tools/gen-cpuid.py +++ b/xen/tools/gen-cpuid.py @@ -256,6 +256,9 @@ def crunch_numbers(state): AVX512F: [AVX512DQ, AVX512IFMA, AVX512PF, AVX512ER, AVX512CD, AVX512BW, AVX512VL, AVX512VBMI, AVX512_4VNNIW, AVX512_4FMAPS, AVX512_VPOPCNTDQ], + + # SGX Launch Control depends on SGX + SGX: [SGX_LAUNCH_CONTROL], } deep_features = tuple(sorted(deps.keys()))