From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jarkko Sakkinen Subject: Re: [PATCH v13 07/13] x86/sgx: Add data structures for tracking the EPC pages Date: Wed, 5 Sep 2018 20:36:06 +0300 Message-ID: <20180905173606.GF11368@linux.intel.com> References: <20180827185507.17087-1-jarkko.sakkinen@linux.intel.com> <20180827185507.17087-8-jarkko.sakkinen@linux.intel.com> <20180904174914.GA5690@linux.intel.com> <20180904181735.GA5820@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20180904181735.GA5820@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org To: Sean Christopherson Cc: Andy Shevchenko , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Platform Driver , Dave Hansen , nhorman@redhat.com, npmccallum@redhat.com, linux-sgx@vger.kernel.org, serge.ayoun@intel.com, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , suresh.b.siddha@intel.com, Linux Kernel Mailing List List-Id: platform-driver-x86.vger.kernel.org On Tue, Sep 04, 2018 at 11:17:35AM -0700, Sean Christopherson wrote: > On Tue, Sep 04, 2018 at 09:01:15PM +0300, Andy Shevchenko wrote: > > On Tue, Sep 4, 2018 a> +/** > > > > > > > + va = ioremap_cache(addr, size); > > > > > + if (!va) > > > > > + return -ENOMEM; > > > > > > > > I'm not sure this is a right API. Do we operate with memory? Does it > > > > have I/O side effects? > > > > If no, memremap() would be better to use. > > > > > > Preserving __iomem is desirable. There aren't side effects per se, > > > but direct non-enclave accesses to the EPC get abort page semantics so > > > the kernel shouldn't be directly dereferencing a pointer to the EPC. > > > Though by that argument, sgx_epc_bank.va, sgx_epc_addr's return and > > > all ENCLS helpers should be tagged __iomem. > > > > Why? > > Does it related to *any* I/O? > > No, hence my other comment that __private or a new tag altogether may > be more appropriate. The noderef attribute is what we truly care > about. My proposal is that we go with memremap() and use #define __sgx_epc __attribute__((noderef)) It makes sense to check that direct EPC pointers are not passed to functions when they are not supposed to. /Jarkko