Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2191639imu; Thu, 10 Jan 2019 09:45:24 -0800 (PST) X-Google-Smtp-Source: ALg8bN5ZJZJ3ocj2XODM/Ze6DdxHibxxSsoXwFrQtVBXDVMVV6+FN2ruT6ws0atBPFvjhBiTkI6l X-Received: by 2002:a17:902:680f:: with SMTP id h15mr11091895plk.40.1547142324337; Thu, 10 Jan 2019 09:45:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547142324; cv=none; d=google.com; s=arc-20160816; b=jrNQeFDFlyFSo+276+41C1DCTmJrf8uEJUjrT1Z3u1wQMaf8eG7kG/dbsBU2IFIifG 2QmDSpG+QL3bEWNN2Yv0TSFIlRf9CWmu9Hys5v0b526cEddrEQvJ/9lB9rb+kxGFBEOd ilBOYad9RSDJ+Wf9ZjhENBc1rZi16DMucNZV34XEKFir0SwT+a8OwGiq/iMkcONvdXS5 DWJyGLbGlMK83qSrtPMlfjjarEYuNwAA2lR4dMG6VczPlmFd/YGM4hv1yPrMfegY5+G9 JRMxLe0WrNmf7J2dtSMMI4qKnx2artTLoPlOXF0CdyjHKShoh2u6TYc8Gex4cw5OTC6l coQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=/UUu3YCIAtggLv8esNQGj9XEkebhHCoreZx79r56vlI=; b=XMhBRNv8ZAik8yF/40t3KArPq5BT3Go1ivg67kATqXlEyJy5NODKvfy3tTnMR9Yq1g 4tQNumQ19tig1cuWqPm34WJvT0ACAjEPPIWP1YdJW6fM7VELz2hAVNPnOunf6SYVvhNc OinYg1EoHuZOzquPtEiRLhkb8Qg7zxnXzOgkGDyrMcBj/eLOnDqg+JLDfGAIy/4cNDXT 4Ur9ZEmbnBMRCec78b1gkYkbmpM2HQg1PVpGWTauexmew1S2xQ7NQHnrhXvWKmPXu2eU y3pfLP3iHQ1es6OrgGmu7SHIqv6Hah8XkuIESYpYu245nVbq0HPQNxiPZToCevDefq6A 3UYA== 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 w11si27498550pfk.210.2019.01.10.09.45.09; Thu, 10 Jan 2019 09:45:24 -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 S1730506AbfAJRno (ORCPT + 99 others); Thu, 10 Jan 2019 12:43:44 -0500 Received: from mga11.intel.com ([192.55.52.93]:49121 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730381AbfAJRnn (ORCPT ); Thu, 10 Jan 2019 12:43:43 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2019 09:43:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,462,1539673200"; d="scan'208";a="133452355" Received: from vanderss-mobl1.ger.corp.intel.com (HELO localhost) ([10.249.254.152]) by fmsmga002.fm.intel.com with ESMTP; 10 Jan 2019 09:43:34 -0800 Date: Thu, 10 Jan 2019 19:43:33 +0200 From: Jarkko Sakkinen To: "Huang, Kai" Cc: "Christopherson, Sean J" , Andy Lutomirski , Jethro Beekman , 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 Message-ID: <20190110174333.GI6589@linux.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> <105F7BF4D0229846AF094488D65A0989355A45B6@PGSMSX112.gar.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <105F7BF4D0229846AF094488D65A0989355A45B6@PGSMSX112.gar.corp.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 08, 2019 at 07:27:11PM +0000, Huang, Kai wrote: > > > > > > 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 Side-note: this particular use case does not necessarily be solved in the first upstream patch set, does it? Just try to keep the patch set as small as possible (still be a huge one). /Jarkko