From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C6F0C43334 for ; Tue, 4 Sep 2018 17:49:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 46B78206BA for ; Tue, 4 Sep 2018 17:49:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 46B78206BA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727817AbeIDWPc (ORCPT ); Tue, 4 Sep 2018 18:15:32 -0400 Received: from mga17.intel.com ([192.55.52.151]:61320 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726304AbeIDWPc (ORCPT ); Tue, 4 Sep 2018 18:15:32 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Sep 2018 10:49:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,329,1531810800"; d="scan'208";a="259781815" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.20]) by fmsmga005.fm.intel.com with ESMTP; 04 Sep 2018 10:49:14 -0700 Date: Tue, 4 Sep 2018 10:49:14 -0700 From: Sean Christopherson To: Andy Shevchenko Cc: Jarkko Sakkinen , "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 Subject: Re: [PATCH v13 07/13] x86/sgx: Add data structures for tracking the EPC pages Message-ID: <20180904174914.GA5690@linux.intel.com> References: <20180827185507.17087-1-jarkko.sakkinen@linux.intel.com> <20180827185507.17087-8-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 03, 2018 at 05:41:53PM +0300, Andy Shevchenko wrote: > On Mon, Aug 27, 2018 at 9:58 PM Jarkko Sakkinen > wrote: > > > + 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. For documentation purposes, maybe it would be better to use __private or "#define __sgx_epc __iomem" and use that? From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com ([192.55.52.151]:61320 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726304AbeIDWPc (ORCPT ); Tue, 4 Sep 2018 18:15:32 -0400 Date: Tue, 4 Sep 2018 10:49:14 -0700 From: Sean Christopherson To: Andy Shevchenko CC: Jarkko Sakkinen , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Platform Driver , Dave Hansen , , , , , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , , Linux Kernel Mailing List Subject: Re: [PATCH v13 07/13] x86/sgx: Add data structures for tracking the EPC pages Message-ID: <20180904174914.GA5690@linux.intel.com> References: <20180827185507.17087-1-jarkko.sakkinen@linux.intel.com> <20180827185507.17087-8-jarkko.sakkinen@linux.intel.com> Content-Type: text/plain; charset="us-ascii" In-Reply-To: Sender: List-ID: Return-Path: linux-sgx-owner@vger.kernel.org MIME-Version: 1.0 On Mon, Sep 03, 2018 at 05:41:53PM +0300, Andy Shevchenko wrote: > On Mon, Aug 27, 2018 at 9:58 PM Jarkko Sakkinen > wrote: > > > + 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. For documentation purposes, maybe it would be better to use __private or "#define __sgx_epc __iomem" and use that?