Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5138139imu; Tue, 8 Jan 2019 12:12:07 -0800 (PST) X-Google-Smtp-Source: ALg8bN50+q4s375qw6J359mlPkTOmBjPgIfKOk4ApJ83cQ9XSdQgg42b6pecS6K6CjTZjVEwb2KO X-Received: by 2002:a62:e044:: with SMTP id f65mr3082191pfh.208.1546978327373; Tue, 08 Jan 2019 12:12:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546978327; cv=none; d=google.com; s=arc-20160816; b=yngz1vMji24PLOyTs93WXDx2rx/Roz1zYp0CxiXcpQPE50ssrkrllVWNARMQp0ViCc +BntCHm1A+SK7bE4oAqaUyCWQMvTIlgqtwe0f3Ilmt29J1huq6joV863GuCa6ty4gS5w GPe+FPW9TjsssjevDRZpfsfZmtT+AQF01fi+XGzffesYrecXclDgHicd1Jy6Kv9AKzg/ moIXLiSozSSQrhfg003z/CH6+JwQy4hWzUs0Ja2bth1FFg61nJlHhJVex1X3zrw5UupU YuDv1hFkgPoBOJEmOZeOJwp7AAcpfN161NIwv+NLtpwDpHOEQOYN0vjPLp9doiuWWx59 v8Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=wz7aESa5U8QjhUIZnNIawoSOlJ1OdsN3jSNkCw82zV4=; b=T+aW60it8fuHeUu1VjpcbO9TLxJB2Vz9fFlIhx6hHhA3DxCbvNGdRJY6Zp/xV4NML1 8mK+x1g26vF30Py4H/PlL5YEIaASqq1dqCHS+nveWJ1/tU0mOtxJll8lI9FUZvO2vOJV B8Tnq+AKbl9JtjoS8SOFDZSK3nwV/X0jCQI2EDTRIJ/yFeaF0nnlBc+eydYAYLjD9GlF f8ynJvnkl/5oxEMrWqOaGjaWNxpxdElGvvKLs3dCQVJhWv6cVzoLuUhvm8TjCu24AB/o /pSo4uFy+8zr5siCjMOIZ/e+k1ngMD9nofi4GbOdTxrPyd0zIPQg9Iqp5qC5K+vRw/jj 9gHA== 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 v16si36017891pgg.290.2019.01.08.12.11.33; Tue, 08 Jan 2019 12:12:07 -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 S1730658AbfAHUJI convert rfc822-to-8bit (ORCPT + 99 others); Tue, 8 Jan 2019 15:09:08 -0500 Received: from mga18.intel.com ([134.134.136.126]:51772 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729548AbfAHT1Q (ORCPT ); Tue, 8 Jan 2019 14:27:16 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2019 11:27:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,455,1539673200"; d="scan'208";a="113153477" Received: from kmsmsx153.gar.corp.intel.com ([172.21.73.88]) by fmsmga007.fm.intel.com with ESMTP; 08 Jan 2019 11:27:12 -0800 Received: from pgsmsx112.gar.corp.intel.com ([169.254.3.246]) by KMSMSX153.gar.corp.intel.com ([169.254.5.199]) with mapi id 14.03.0415.000; Wed, 9 Jan 2019 03:27:11 +0800 From: "Huang, Kai" To: "Christopherson, Sean J" , "Andy Lutomirski" CC: Jethro Beekman , Jarkko Sakkinen , Thomas Gleixner , "Ingo Molnar" , Borislav Petkov , "x86@kernel.org" , Dave Hansen , Peter Zijlstra , "H. Peter Anvin" , "linux-kernel@vger.kernel.org" , "linux-sgx@vger.kernel.org" , Josh Triplett , Haitao Huang , "Dr . Greg Wettstein" Subject: RE: x86/sgx: uapi change proposal Thread-Topic: x86/sgx: uapi change proposal Thread-Index: AQHUl3CouNmOMJQZHU2YX8Dh54+gQaWFODMAgAAIjACAAAbWAIAAVlWAgADM8wCAAnSJgIAc/6rw Date: Tue, 8 Jan 2019 19:27:11 +0000 Message-ID: <105F7BF4D0229846AF094488D65A0989355A45B6@PGSMSX112.gar.corp.intel.com> References: <20181214215729.4221-1-sean.j.christopherson@intel.com> <7706b2aa71312e1f0009958bcab24e1e9d8d1237.camel@linux.intel.com> <598cd050-f0b5-d18c-96a0-915f02525e3e@fortanix.com> <20181219091148.GA5121@linux.intel.com> <613c6814-4e71-38e5-444a-545f0e286df8@fortanix.com> <20181219144515.GA30909@linux.intel.com> <20181221162825.GB26865@linux.intel.com> In-Reply-To: <20181221162825.GB26865@linux.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzEzZDI1NGYtMmQxZC00OTRmLThiOGQtZjRhZWQ5ZmQ2MDM4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiekhcL01jWDNMM0drSkxwdW1xYVBTQXpWN3dFaldPd01EcVViSTFZSmIwOE9XNk5KN1hQejk5RWs2NGNFMHJNUnIifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [172.30.20.206] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > > Can one of you explain why SGX_ENCLAVE_CREATE is better than just > > opening a new instance of /dev/sgx for each encalve? > > Directly associating /dev/sgx with an enclave means /dev/sgx can't be used > to provide ioctl()'s for other SGX-related needs, e.g. to mmap() raw EPC and > expose it a VM. Proposed layout in the link below. I'll also respond to > Jarkko's question about exposing EPC through /dev/sgx instead of having > KVM allocate it on behalf of the VM. > > https://lkml.kernel.org/r/20181218185349.GC30082@linux.intel.com Hi Sean, Sorry for replying to old email. But IMHO it is not a must that Qemu needs to open some /dev/sgx and allocate/mmap EPC for guest's virtual EPC slot, instead, KVM could create private slot, which is not visible to Qemu, for virtual EPC, and KVM could call core-SGX EPC allocation API directly. I am not sure what's the good of allowing userspace to alloc/mmap a raw EPC region? Userspace is not allowed to touch EPC anyway, expect enclave code. To me KVM creates private EPC slot is cleaner than exposing /dev/sgx/epc and allowing userspace to map some raw EPC region. Thanks, -Kai